0

I have a MongoDB database with ~100GB data size. I ran a test with 300 threads and a total 10,000 'read' queries. I notice on the MMS lock% it is showing 0.6 ~ 1% of write lock. My question is, the queries are purely 'read', why is it showing write lock?

2
  • Have you tried running db.serverStatus() to get more info on where the locks are occurring? Nov 18, 2014 at 20:23
  • Yes, and in MMS I can select which db the lock% was on. write locks occur on db I performed read-only queries. I had db profiler turned on, but that should only write to 'local' database
    – Howard Lee
    Nov 18, 2014 at 21:49

1 Answer 1

0

First off, to correct the comment: the profiler does not write to the local database, it writes to whatever database you are profiling in the system.profile collection. So if you were reading from database foo and had profiling turned on, the collection would be foo.system.profile. You could turn on profiling for the local database, and hence have the profiler write there of course, but it is not a default of any kind.

Then, if you have the profiler enabled, regardless of where it writes too, all writes require a write lock whether they are to the system.profile collection or anywhere else. Just because it is getting input internally does not exclude the system.profile collection from following the same rules as any other collection on a database.

If you turn the profiler off I would expect the lock to disappear. There may still be the occasional blip in the global lock percentage in the stats but that is essentially just background noise.

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.