I am using MongoDB server version: 3.6.4 (WiredTiger storage engine) with 3 node replica set on AWS r4 large machines.
Sharing the CPU Utilization graph of all the nodes
I tried to run
db.currentOp({"secs_running": {$gte: 3}})
I can see only
{
"inprog" : [
{
"host" : "XXXXXXXXXXXXX",
"desc" : "WT RecordStoreThread: local.oplog.rs",
"active" : true,
"currentOpTime" : "2018-05-23T12:41:42.272+0000",
"opid" : 18,
"secs_running" : NumberLong(16636),
"microsecs_running" : NumberLong("16636047730"),
"op" : "none",
"ns" : "local.oplog.rs",
"command" : {
},
"numYields" : 0,
"locks" : {
},
"waitingForLock" : false,
"lockStats" : {
"Global" : {
"acquireCount" : {
"r" : NumberLong(1),
"w" : NumberLong(1)
}
},
"Database" : {
"acquireCount" : {
"w" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"w" : NumberLong(1)
}
}
}
}
],
"ok" : 1,
"operationTime" : Timestamp(1527079298, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1527079298, 1),
"signature" : {
"hash" : BinData(0,"XXXXXXXXXXXXX"),
"keyId" : NumberLong(0)
}
}
}
I tried to restart the secondary machines, but after sometimes CPU utilisation reaches the peak.
I have set readPreference as secondaryPreferred
Thanks in advance
secondaryPreferred
read preference? High CPU could be indicative of queries that are doing work (in-memory sorts, aggregation, JavaScript evaluation) or background index builds. If you change your application read preference to the default (primary
) does the CPU usage follow the workload?