3

I have a weird one here. We have set up our production MongoDB which was populated by our test one so we had something to work off of. As soon as we started the service we hit instant 100% CPU load with nothing running, so we removed the server from it's replica set and got it down to 2-3% CPU.

When we had all of our users active we saw it spike back up to 100% and we said we would leave it over night and monitor it for any signs of improvement.

The next morning we came in and the CPU was down to around 40% and it seemed very stable. Now about a week later we have come across the same issue as above except this has been happening for almost 4 days where we are maxed on CPU.

I used the db.currentOP() command and found one from "WT RecordStoreThread: local.oplog.rs" that has been running for 355254 seconds which equated to around 98 hours which matches the CPU being maxed.

The machine has 8 cores @ 2.4GHz and 16GB RAM so I wouldn't think that CPU would be this massive an issue at such an early stage.

Our config file looks like the following with the IP and Port stared out:

systemLog:
   destination: file
   path: E:\data\log\mongod.log
storage:
   dbPath: E:\data\db
net:
   port: xxxxx
   bindIp: xxx.xxx.xxx.xxx
#replication:
#   replSetName: "rs1"
security:
   authorization: enabled
#   keyFile: E:\data\mongodb.key

I have restarted the service today hoping to maybe release some resources but it instantly maxed out again.

I have looked at other issues on SO and none seem to have a real answer to resolve this problem. Thanks for taking the time to read this and if anybody has come across the same issue or might have any idea on how to solve it that would be great to get your feedback!

2 Answers 2

4

Strange indeed.

That local.oplog.rs is journaling what is enable (default) at 64 bit systems (32bit default value is false). So, running time for that thread should be same than your mongod uptime.

But journaling should not rise CPU usage. When you have high CPU usage, what mongotop and mongostat shows? What is happening in the system?

If you look result of top-command, "who" is eating most CPU power (one or more mongod processes?) and what is highest %-value us(er), sy(stem), ni(ce), id(le), wa(it)?

1
  • Hi JJussi thank you for the reply. We seemed to have solved the issue and it was by completely turning everything off and just having the database running. When it was running on it's own it was using 1% CPU which was fine. I then logged in and noticed a massive spike to 15% and it stayed there with just myself logged in. I used your commands and found one query that was never supposed to be getting called in the first place. After removing this query and a few other unnecessary ones with every single user active we were only using 8% CPU. Everything has gone back to normal so thank you! Sep 25, 2017 at 9:01
1

I have the same problem, MongoDB use all CPU resources (12 vCPU, 1.119 % CPU).

enter image description here

After create a INDEX for the most asked field, the usage rises down to 12%

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.