My MongoDB Server CPU Performance is some times hitting 99% because of which the application is getting slower.
I'm using ROBOMONGO tool through which I've run a query to get the current Operations on the DB (db.currentOP()) and I'm running this query every second and I'm getting an array result with number of operations and at a point I'm getting 1000+ requests.
Can any one guide me the way to find the queries running on the database.
I'm using a Chat application so I couldn't find the exact place where it is happening on Live Environment.
BTW, Our server Configuration is :
R3.xlarge
4vCPU
30.5GB RAM
Sample Log :
{
"desc" : "conn17",
"threadId" : "7220",
"connectionId" : 17,
"client" : "SAMPLE_IP_ADDRESS:57979",
"active" : true,
"opid" : 487161,
"secs_running" : 0,
"microsecs_running" : NumberLong(51785),
"op" : "command",
"ns" : "uandmeprod_main.$cmd",
"query" : {
"count" : "USERINFO",
"query" :
},
"numYields" : 0,
"locks" :
,
"waitingForLock" : true,
"lockStats" : {
"Global" : {
"acquireCount" :
},
"MMAPV1Journal" : {
"acquireCount" :
},
"Database" : {
"acquireCount" :
},
"Collection" : {
"acquireCount" :
,
"acquireWaitCount" :
}
}
},
{
"desc" : "conn427",
"threadId" : "18704",
"connectionId" : 427,
"client" : "SAMPLE_IP_ADDRESS:61212",
"active" : true,
"opid" : 486758,
"secs_running" : 0,
"microsecs_running" : NumberLong(279493),
"op" : "query",
"ns" : "uandmeprod_main.USERINFO",
"query" : {
"find" : "USERINFO",
"filter" :
},
"numYields" : 0,
"locks" :
,
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" :
},
"MMAPV1Journal" : {
"acquireCount" :
},
"Database" : {
"acquireCount" :
},
"Collection" : {
"acquireCount" :
}
}
},
{
"desc" : "conn1336",
"threadId" : "6964",
"connectionId" : 1336,
"client" : "SAMPLE_IP_ADDRESS:63173",
"active" : true,
"opid" : 486632,
"secs_running" : 0,
"microsecs_running" : NumberLong(284492),
"op" : "query",
"ns" : "uandmeprod_main.USERINFO",
"query" : {
"find" : "USERINFO",
"filter" :
},
"numYields" : 0,
"locks" :
,
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" :
},
"MMAPV1Journal" : {
"acquireCount" :
},
"Database" : {
"acquireCount" :
},
"Collection" : {
"acquireCount" :
}
}
}
My MongoDB Server CPU Performance is some times hitting 99% because of which the application is getting slower.
Hi Santhosh,
There are many things that can cause a server to use high CPU. Assuming that this is a dedicated server only running a standalone mongod server, you could start a diagnosis of the issue using the following:
If you have further questions, it would help others if you could provide:
See also db.currentOp to understand better the output of the document. You may also benefited from reviewing Monitoring for MongoDB and FAQ: MongoDB Concurrency
Also, I’d recommend to enrol to MongoDB University free online course M201: Performance and/or M312: Diagnostics and Debugging to learn more. The next session of the course will start on 28th March which gives you plenty of time to register.
Regards,
Wan