According to docker container statistics, my mongo database consumes constantly between 250 and 350% cpu. That\'s pretty impressive since it\'s a single core system :P
T
There is a function called db.currentOp() which lists the currently running queries with very detailed information, it also includes the duration they have been running (secs_running
).
You can then use the currentOp.opid
with db.killOp() to kill that query/operation.
If db.currentOp()
doesn't return any results, because there is no query which went havoc, then there's also db.setProfilingLevel() which will enable profiling by storing queries into the "local" database. Here's a "Tutorial" which is from the "M102: MongoDB for DBAs" Course.
Further information can also be found in this detailed article "Troubleshooting MongoDB 100% CPU load and slow queries" from Igor Khomenko.