db.collection.stats() returns

wiredTiger: {
    "transaction" : {
        "update conflicts" : NumberInt(1410)

It's MongoDB 3.6, but I don't use its new features related to client sessions and retryable writes.

Couldn't find much of documentation about meaning of the number apart from

Conflict between concurrent operations.

This error is generated when an operation cannot be completed due to a conflict with concurrent operations. The operation may be retried; if a transaction is in progress, it should be rolled back and the operation retried in a new transaction.

at http://source.wiredtiger.com/3.0.0/group__wt.html#ga5ee3c6fcd074e11efd118f3e68e91db8

Does it mean there were 1410 failed updates since the collection was created, or some of them were successfully "retried" implicitly?


The number records how many times two or more threads are trying to update the same document inside the WiredTiger storage engine. It is not persisted between server restarts.

This statistic is specific to the WiredTiger storage engine (as it is under the WiredTiger section). Under MongoDB this is known as write conflict, and will be transparently retried under valid conditions.

That is, the update is retried by MongoDB (using the WiredTiger's API) until it completes without a conflict. From the client perspective, the write succeeds and is otherwise normal except for increased latency.

Write conflicts indicates that multiple clients are trying to update exactly the same document within the same fraction of a second. This window is the time between the execution of the WiredTiger API's WT_SESSION::begin_transaction() and WT_SESSION::commit_transaction() operations. There is no fixed minimum time for these operations. It could be double or even single-digit microseconds if the amount of data to be written is small and the server has no queues for CPU or memory channels. There is no fixed maximum time either, although it is somewhat dependent on the performance of the server.

These conflicts can arise due to WiredTiger's optimistic concurrency control, which is described in concurrency FAQ for WiredTiger.

Note that comments in WiredTiger's source code might be misleading from MongoDB's point of view, since WiredTiger and MongoDB uses mostly the same term, but attach slightly different meanings to them.

For example, "transaction" in WiredTiger has always been available, but "transaction" in MongoDB means a multi-document ACID transaction feature for MongoDB 4.0 (not yet released as of this writing).

| improve this answer | |
  • Thanks for the explanation of lifetime of the stats. I get it as the value comes from active primary only. Could you elaborate "transparently retried under valid conditions" bit? It's the least documented part, and I am still not sure whether all of these 1410 updates resulted with nMatched:1, nModified:0 or some conditions were accidentally met and there we no sign of the write conflict on the client side? – Alex Blex May 2 '18 at 10:54
  • I edited the answer with the relevant details. Hope it's clearer now. – kevinadi May 2 '18 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.