-
-
Save demesew/0d8cd012c5a09285e46c7acebf1b0a4d to your computer and use it in GitHub Desktop.
Revisions
-
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 28 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -97,34 +97,31 @@ db.system.profile.aggregate( "avg response time":{$avg:"$millis"} }}); db.system.profile.aggregate([ { $project : { "op" : "$op", "millis" : "$millis", "timeAcquiringMicrosrMS" : { $divide : [ "$lockStats.timeAcquiringMicros.r", 1000 ] }, "timeAcquiringMicroswMS" : { $divide : [ "$lockStats.timeAcquiringMicros.w", 1000 ] }, "timeLockedMicrosrMS" : { $divide : [ "$lockStats.timeLockedMicros.r", 1000 ] }, "timeLockedMicroswMS" : { $divide : [ "$lockStats.timeLockedMicros.w", 1000 ] } } }, { $project : { "op" : "$op", "millis" : "$millis", "total_time" : { $add : [ "$millis", "$timeAcquiringMicrosrMS", "$timeAcquiringMicroswMS" ] }, "timeAcquiringMicrosrMS" : "$timeAcquiringMicrosrMS", "timeAcquiringMicroswMS" : "$timeAcquiringMicroswMS", "timeLockedMicrosrMS" : "$timeLockedMicrosrMS", "timeLockedMicroswMS" : "$timeLockedMicroswMS" } }, { $group : { _id : "$op", "average response time" : { $avg : "$millis" }, "average response time + acquire time": { $avg: "$total_time"}, "average acquire time reads" : { $avg : "$timeAcquiringMicrosrMS" }, "average acquire time writes" : { $avg : "$timeAcquiringMicroswMS" }, "average lock time reads" : { $avg : "$timeLockedMicrosrMS" }, "average lock time writes" : { $avg : "$timeLockedMicroswMS" } } } ]); -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 30 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -97,4 +97,34 @@ db.system.profile.aggregate( "avg response time":{$avg:"$millis"} }}); db.system.profile.aggregate( [ { $project : { "op" : "$op", "millis" : "$millis", "timeAcquiringMicrosrMS" : { $divide : [ "$lockStats.timeAcquiringMicros.r", 1000 ] }, "timeAcquiringMicroswMS" : { $divide : [ "$lockStats.timeAcquiringMicros.w", 1000 ] }, "timeLockedMicrosrMS" : { $divide : [ "$lockStats.timeLockedMicros.r", 1000 ] }, "timeLockedMicroswMS" : { $divide : [ "$lockStats.timeLockedMicros.w", 1000 ] } } }, { $project : { "op" : "$op", "millis" : "$millis", "total_time" : { $add : [ "$millis", "$timeAcquiringMicrosrMS", "$timeAcquiringMicroswMS" ] }, "timeAcquiringMicrosrMS" : "$timeAcquiringMicrosrMS", "timeAcquiringMicroswMS" : "$timeAcquiringMicroswMS", "timeLockedMicrosrMS" : "$timeLockedMicrosrMS", "timeLockedMicroswMS" : "$timeLockedMicroswMS" } }, { $group : { _id : "$op", "average response time" : { $avg : "$millis" }, "average response time + acquire time": { $avg: "$total_time"}, "average acquire time reads" : { $avg : "$timeAcquiringMicrosrMS" }, "average acquire time writes" : { $avg : "$timeAcquiringMicroswMS" }, "average lock time reads" : { $avg : "$timeLockedMicrosrMS" }, "average lock time writes" : { $avg : "$timeLockedMicroswMS" } } } ] ); -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ show profile db.system.profile.find({}).sort({$natural:-1}) // sort by slow queries first db.system.profile.find({}).sort({$millis:-1})Alimit(10); // anything > 20ms db.system.profile.find({"millis":{$gt:20}}) @@ -39,7 +39,7 @@ db.system.profile.find({"millis":{$gt:20}}) db.system.profile.find({"ns":"test.foo"}).sort({"millis":-1}) // regular expression on namespace db.system.profile.find( { "ns": /test.foo/ } ).sort({millis:-1,$ts:-1}) // anything thats moved db.system.profile.find({"moved":true}) -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ show profile db.system.profile.find({}).sort({$natural:-1}) // sort by slow queries first db.system.profile.find({}).sort({$millis:-1})A.limit(10); // anything > 20ms db.system.profile.find({"millis":{$gt:20}}) -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ show profile db.system.profile.find({}).sort({$natural:-1}) // sort by slow queries first db.system.profile.find({}).sort({$millis:-1})Alimit(10) // anything > 20ms db.system.profile.find({"millis":{$gt:20}}) -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,6 +29,9 @@ show profile // sort by natural order (time in) db.system.profile.find({}).sort({$natural:-1}) // sort by slow queries first db.system.profile.find({}).sort({$millis:-1})A.limit(10) // anything > 20ms db.system.profile.find({"millis":{$gt:20}}) -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // a list of useful queries for profiler analysis. Starting with the most basic. // 2.4 compatible // // output explained: -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,21 +5,21 @@ // output explained: // { "ts" : ISODate("2012-09-14T16:34:00.010Z"), // date it occurred "op" : "query", // the operation type "ns" : "game.players", // the db and collection "query" : { "total_games" : 1000 }, // query document "ntoreturn" : 0, // # docs returned with limit() "ntoskip" : 0, // # of docs to skip() "nscanned" : 959967, // number of docs scanned "keyUpdates" : 0, // updates of secondary indexes "numYield" : 1, // # of times yields took place "lockStats" : { ... }, // subdoc of lock stats "nreturned" : 0, // # docs actually returned "responseLength" : 20, // size of doc "millis" : 859, // how long it took "client" : "127.0.0.1", // client asked for it "user" : "" // the user asking for it } -
Kenny Gorman revised this gist
Aug 11, 2014 . 1 changed file with 24 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,27 @@ // // // output explained: // { "ts" : ISODate("2012-09-14T16:34:00.010Z"), // date it occurred "op" : "query", // the operation type "ns" : "game.players", // the db and collection "query" : { "total_games" : 1000 }, // query document "ntoreturn" : 0, // # docs returned with limit() "ntoskip" : 0, // # of docs to skip() "nscanned" : 959967, // number of docs scanned "keyUpdates" : 0, // updates of secondary indexes "numYield" : 1, // # of times yields took place "lockStats" : { ... }, // subdoc of lock stats "nreturned" : 0, // # docs actually returned "responseLength" : 20, // size of doc "millis" : 859, // how long it took "client" : "127.0.0.1", // client asked for it "user" : "" // the user asking for it } // last few entries show profile @@ -14,6 +35,9 @@ db.system.profile.find({"millis":{$gt:20}}) // single coll order by response time db.system.profile.find({"ns":"test.foo"}).sort({"millis":-1}) // regular expression on namespace db.system.profile.find( { info: /test.foo/ } ).sort({millis:-1,$ts:-1}) // anything thats moved db.system.profile.find({"moved":true}) -
Kenny Gorman created this gist
Aug 11, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ // a list of useful queries for profiler analysis. Starting with the most basic. // // // last few entries show profile // sort by natural order (time in) db.system.profile.find({}).sort({$natural:-1}) // anything > 20ms db.system.profile.find({"millis":{$gt:20}}) // single coll order by response time db.system.profile.find({"ns":"test.foo"}).sort({"millis":-1}) // anything thats moved db.system.profile.find({"moved":true}) // large scans db.system.profile.find({"nscanned":{$gt:10000}}) // anything doing range or full scans db.system.profile.find({"nreturned":{$gt:1}}) // // using the agg framework // // response time by operation type db.system.profile.aggregate( { $group : { _id :"$op", count:{$sum:1}, "max response time":{$max:"$millis"}, "avg response time":{$avg:"$millis"} }}); // slowest by namespace db.system.profile.aggregate( { $group : { _id :"$ns", count:{$sum:1}, "max response time":{$max:"$millis"}, "avg response time":{$avg:"$millis"} }}, {$sort: { "max response time":-1} }); // slowest by client db.system.profile.aggregate( {$group : { _id :"$client", count:{$sum:1}, "max response time":{$max:"$millis"}, "avg response time":{$avg:"$millis"} }}, {$sort: { "max response time":-1} }); // summary moved vs non-moved db.system.profile.aggregate( { $group : { _id :"$moved", count:{$sum:1}, "max response time":{$max:"$millis"}, "avg response time":{$avg:"$millis"} }});