Write conflict - 3.4

Hi,

With 3.4, and Linux environment, I see log is filling up with write conflicts as below

DBException thrown :: caused by :: 112 WriteConflict

What does it mean and how to resolve? in detail

Hi @santhosh_K

What’s the full error message you’re seeing, and what method are you using to connect to MongoDB?

Typically WriteConflict was caused by two or more threads/processes trying to update one document at exactly the same time. Since this is not easy to do with a small number of threads/clients, usually this means that there are a large-ish number of threads/clients trying to access the database and update one document at the same time.

Usually this is due to the design of the application. It means that you’re artificially bottlenecking the app on a single document. Without more information, I would suggest you to consider some alternative schema design that doesn’t rely on a single document to be able to serve multiple clients simultaneously.

Note that as per the support policy, MongoDB 3.4 series is out of support since Jan 2020. I would encourage you to upgrade to a newer, supported version of MongoDB.

Best regards,
Kevin