[英]How to track Mongo DB query response time in Production Environment?
我們正在為Mongdb建立一個正在生產中的應用程序。
有時我們在用戶前端遇到速度慢的情況(即,數據正在緩慢地加載到已登錄的用戶)
我們要排除速度慢的可能問題。 我的問題是,有什么辦法可以知道Mongo DB查詢需要多少時間來響應?
非常感謝你 。
更新的部分
謝謝,這是從Mongo db開發箱中獲取的示例結果
{ "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" : "" }
但是從這個我怎么才能真正知道每個查詢花費的時間?
使用事件探查器,設置db.setProfilingLevel(2)
啟用它。 和db.system.profile.find().sort({$natural:-1})
來查看記錄
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.