MongoDB的CPU使用率不断提高 [英] MongoDB constantly high cpu usage

查看:50
本文介绍了MongoDB的CPU使用率不断提高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据docker容器的统计信息,我的mongo数据库持续消耗250%至350%的cpu.令人印象深刻的是,它是一个单核系统:P

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

可悲的是,这是我的生产实例,更可悲的是,它必须存在直到下一次产品备份为止,这还需要3.5个小时.

The sad part is that this is my production instance and much more sad is that it has to live until the next prod-backup and thats 3.5 more hours to go.

我尝试做一个mongotop,但它告诉我所有显示的集合的状态为0ms.我还能做其他事情来弄清楚发生了什么吗?

I tried to do a mongotop but it tells me 0ms stats for all shown collections. Can I do anything else to figure out what's going on?

PS:数据库已使用了9周,没有造成任何问题.

PS: The db is up for 9 weeks and didn't cause problems.

推荐答案

有一个名为 db.currentOp(),其中列出了当前正在运行的查询以及非常详细的信息,还包括了查询的运行持续时间(secs_running).

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).

然后可以将currentOp.opid db.killOp()<一起使用/a>终止该查询/操作.

You can then use the currentOp.opid with db.killOp() to kill that query/operation.

如果db.currentOp()不返回任何结果,因为没有查询造成严重破坏,则还有此处是一个教程",该教程来自课程.

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.

这篇关于MongoDB的CPU使用率不断提高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆