Last active
May 16, 2018 20:23
-
-
Save sarjarapu/7c37ab737496536369cae297d0d96abf to your computer and use it in GitHub Desktop.
The MongoDB currentOp command to help you find all the operations running longer than 300 milliseconds.
This file contains 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 characters
db.adminCommand({ | |
"currentOp": true, | |
"microsecs_running" : {"$gte" : 300000} | |
}) | |
/* | |
// output for the above command | |
{ | |
"inprog": [{ | |
"host": "shyam-macbook.local:27017", | |
"desc": "conn", | |
"threadId": "0x70000a805000", | |
"connectionId": 3807, | |
"client": "127.0.0.1:52818", | |
"appName": "MongoDB Shell", | |
"clientMetadata": { | |
"application": { | |
"name": "MongoDB Shell" | |
}, | |
"driver": { | |
"name": "MongoDB Internal Client", | |
"version": "3.6.2" | |
}, | |
"os": { | |
"type": "Darwin", | |
"name": "Mac OS X", | |
"architecture": "x86_64", | |
"version": "17.5.0" | |
} | |
}, | |
"active": true, | |
"currentOpTime": "2018-05-16T15:20:22.253-0500", | |
"opid": 835646, | |
"secs_running": NumberLong(0), | |
"microsecs_running": NumberLong(343179), | |
"op": "update", | |
"ns": "guidebook.restaurants", | |
"command": { | |
"q": { | |
}, | |
"u": { | |
"$inc": { | |
"visitor_count": 1 | |
} | |
}, | |
"multi": true, | |
"upsert": false | |
}, | |
"planSummary": "COLLSCAN", | |
"numYields": 400, | |
"locks": { | |
"Global": "w", | |
"Database": "w", | |
"Collection": "w" | |
}, | |
"waitingForLock": false, | |
"lockStats": { | |
"Global": { | |
"acquireCount": { | |
"r": NumberLong(401), | |
"w": NumberLong(401) | |
} | |
}, | |
"Database": { | |
"acquireCount": { | |
"w": NumberLong(401) | |
} | |
}, | |
"Collection": { | |
"acquireCount": { | |
"w": NumberLong(401) | |
} | |
} | |
} | |
}], | |
"ok": 1 | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment