I face a problem which connected with MongoDb performance. Queries are tens of seconds and by means of command db.currentOp()
I can see, that all my queries are waiting database lock. For example:
just simple query
"desc" : "conn36316",
"threadId" : "7420",
"connectionId" : 36316,
"client" : "127.0.0.1:34538",
"active" : true,
"opid" : 197242270,
"secs_running" : 190,
"microsecs_running" : NumberLong(190574655),
"op" : "query",
"ns" : "db.items",
"query" : {
"find" : "items",
"filter" : {
"$msg" : "query not recording (too large)"
}
},
"numYields" : 92,
"locks" : {
"Global" : "r",
"Database" : "r"
},
"waitingForLock" : true,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(186)
},
"acquireWaitCount" : {
"r" : NumberLong(1)
},
"timeAcquiringMicros" : {
"r" : NumberLong(24392)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(93)
},
"acquireWaitCount" : {
"r" : NumberLong(53)
},
"timeAcquiringMicros" : {
"r" : NumberLong(60099891)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(92)
}
}
}
build index query
"desc" : "TTLMonitor",
"threadId" : "12592",
"active" : true,
"opid" : 958,
"op" : "none",
"ns" : "",
"query" : {
},
"numYields" : 0,
"locks" : {
"Global" : "r",
"Database" : "r"
},
"waitingForLock" : true,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(4)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(2)
},
"acquireWaitCount" : {
"r" : NumberLong(1)
},
"timeAcquiringMicros" : {
"r" : NumberLong("3571165481")
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(3)
}
}
}
As you can see waiting for acquiring lock takes enormous time. For common query it equals 60 sec., and for index it equals 3571 sec.!
My work computer can create similar index much faster that it can be create on server.
My server is virtual machine with 10 cores, 40GB of memory and disk is raid1 array.
I'm using MongoDb version 3.2.6 (WiredTiger).
What could be the problem? How can I diagnose the problem?
My problem was the low speed disk subsystem, the replacement of the ssd according to the official documentation solved the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With