MongoDB constantly high cpu usage

前端 未结 2 1237
再見小時候
再見小時候 2021-02-04 00:58

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

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 01:27

    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.

提交回复
热议问题