简体   繁体   中英

How to track Mongo DB query response time in Production Environment?

We are uisng Mongdb for one of our Application that is running in production currently .

Sometimes we are experiencing slowness in the User Front End (ie the Data is loading slowly to the User who has loggged in )

We want to rule out the possible issues of the slowness . My question is , is there any way we can know how much time the Mongo DB query is taken to respond ??

Thank you very much .

Updated Part

Thanks , this was a sample result taken from the Mongo db develoment box

{ "ts" : ISODate("2013-01-02T19:11:16.822Z"), "op" : "query", "ns" : "ravi.system.indexes", "query" : { "expireAfterSeconds" : { "$exists" : true } }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 1, "keyUpdates" : 0, "numYield" : 0, "lockStats" : { "timeLockedMicros" : { "r" : NumberLong(65), "w" : NumberLong(0) }, "timeAcquiringMicros" : { "r" : NumberLong(4), "w" : NumberLong(5) } }, "nreturned" : 0, "responseLength" : 20, "millis" : 0, "client" : "0.0.0.0", "user" : "" }

{ "ts" : ISODate("2013-01-02T19:10:16.822Z"), "op" : "query", "ns" : "ravi.system.indexes", "query" : { "expireAfterSeconds" : { "$exists" : true } }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 1, "keyUpdates" : 0, "numYield" : 0, "lockStats" : { "timeLockedMicros" : { "r" : NumberLong(66), "w" : NumberLong(0) }, "timeAcquiringMicros" : { "r" : NumberLong(4), "w" : NumberLong(4) } }, "nreturned" : 0, "responseLength" : 20, "millis" : 0, "client" : "0.0.0.0", "user" : "" }

But from this how can i really know what time is taken for each query ??

use profiler, set db.setProfilingLevel(2) to enable it. and db.system.profile.find().sort({$natural:-1}) to view the records

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM