Mongodb big cpu without slow queries

hello,

we have problem with mongodb big cpu usage without slow queries,
do you know what is next step in goal for detect reason and fix problem?

Hi,
how did you check that there were no slow queries or COLLSCAN’s ?
What about other metrics like the current number of available WiredTiger tickets?
You need to provide more information (including mongo version and deployment type - eg. Replica Set or Sharded cluster)

1 Like

hi,

in mongo is log, where appear all requests which is slower then 100ms

db.serverStatus().wiredTiger.cache
{
“application threads page read from disk to cache count” : 2342,
“application threads page read from disk to cache time (usecs)” : 131576,
“application threads page write from cache to disk count” : 74736,
“application threads page write from cache to disk time (usecs)” : 894555,
“bytes allocated for updates” : 739705320,
“bytes belonging to page images in the cache” : 128861140,
“bytes belonging to the history store table in the cache” : 571,
“bytes currently in the cache” : 878399222,
“bytes dirty in the cache cumulative” : 12955102239,
“bytes not belonging to page images in the cache” : 749538081,
“bytes read into cache” : 123093866,
“bytes written from cache” : 3180820163,
“cache overflow score” : 0,
“checkpoint blocked page eviction” : 77,
“checkpoint of history store file blocked non-history store page eviction” : 0,
“eviction calls to get a page” : 6654,
“eviction calls to get a page found queue empty” : 4557,
“eviction calls to get a page found queue empty after locking” : 5,
“eviction currently operating in aggressive mode” : 0,
“eviction empty score” : 0,
“eviction gave up due to detecting an out of order on disk value behind the last update on the chain” : 0,
“eviction gave up due to detecting an out of order tombstone ahead of the selected on disk update” : 0,
“eviction gave up due to detecting an out of order tombstone ahead of the selected on disk update after validating the update chain” : 0,
“eviction gave up due to detecting out of order timestamps on the update chain after the selected on disk update” : 0,
“eviction passes of a file” : 137,
“eviction server candidate queue empty when topping up” : 8,
“eviction server candidate queue not empty when topping up” : 0,
“eviction server evicting pages” : 0,
“eviction server slept, because we did not make progress with eviction” : 52590,
“eviction server unable to reach eviction goal” : 0,
“eviction server waiting for a leaf page” : 882148,
“eviction state” : 64,
“eviction walk most recent sleeps for checkpoint handle gathering” : 0,
“eviction walk target pages histogram - 0-9” : 37,
“eviction walk target pages histogram - 10-31” : 95,
“eviction walk target pages histogram - 128 and higher” : 0,
“eviction walk target pages histogram - 32-63” : 5,
“eviction walk target pages histogram - 64-128” : 0,
“eviction walk target pages reduced due to history store cache pressure” : 0,
“eviction walk target strategy both clean and dirty pages” : 0,
“eviction walk target strategy only clean pages” : 0,
“eviction walk target strategy only dirty pages” : 137,
“eviction walks abandoned” : 29,
“eviction walks gave up because they restarted their walk twice” : 92,
“eviction walks gave up because they saw too many pages and found no candidates” : 0,
“eviction walks gave up because they saw too many pages and found too few candidates” : 0,
“eviction walks reached end of tree” : 227,
“eviction walks restarted” : 0,
“eviction walks started from root of tree” : 135,
“eviction walks started from saved location in tree” : 2,
“eviction worker thread active” : 4,
“eviction worker thread created” : 0,
“eviction worker thread evicting pages” : 1767,
“eviction worker thread removed” : 0,
“eviction worker thread stable number” : 0,
“files with active eviction walks” : 0,
“files with new eviction walks started” : 135,
“force re-tuning of eviction workers once in a while” : 0,
“forced eviction - history store pages failed to evict while session has history store cursor open” : 0,
“forced eviction - history store pages selected while session has history store cursor open” : 0,

“forced eviction - history store pages successfully evicted while session has history store cursor open” : 0,
“forced eviction - pages evicted that were clean count” : 0,
“forced eviction - pages evicted that were clean time (usecs)” : 0,
“forced eviction - pages evicted that were dirty count” : 348,
“forced eviction - pages evicted that were dirty time (usecs)” : 527113,
“forced eviction - pages selected because of a large number of updates to a single item” : 0,
“forced eviction - pages selected because of too many deleted items count” : 639,
“forced eviction - pages selected count” : 939,
“forced eviction - pages selected unable to be evicted count” : 104,
“forced eviction - pages selected unable to be evicted time” : 142,
“hazard pointer blocked page eviction” : 105,
“hazard pointer check calls” : 2706,
“hazard pointer check entries walked” : 39667,
“hazard pointer maximum array length” : 2,
“history store score” : 0,
“history store table insert calls” : 0,
“history store table insert calls that returned restart” : 0,
“history store table max on-disk size” : 0,
“history store table on-disk size” : 4096,
“history store table out-of-order resolved updates that lose their durable timestamp” : 0,
“history store table out-of-order updates that were fixed up by reinserting with the fixed timestamp” : 0,
“history store table reads” : 0,
“history store table reads missed” : 0,
“history store table reads requiring squashed modifies” : 0,
“history store table truncation by rollback to stable to remove an unstable update” : 0,
“history store table truncation by rollback to stable to remove an update” : 0,
“history store table truncation to remove an update” : 0,
“history store table truncation to remove range of updates due to key being removed from the data page during reconciliation” : 0,
“history store table truncation to remove range of updates due to out-of-order timestamp update on data page” : 0,
“history store table writes requiring squashed modifies” : 0,
“in-memory page passed criteria to be split” : 974,
“in-memory page splits” : 487,
“internal pages evicted” : 2,
“internal pages queued for eviction” : 1,
“internal pages seen by eviction walk” : 38,
“internal pages seen by eviction walk that are already queued” : 0,
“internal pages split during eviction” : 0,
“leaf pages split during eviction” : 110,
“maximum bytes configured” : 33094107136,
“maximum page size at eviction” : 4911259,
“modified pages evicted” : 2037,
“modified pages evicted by application threads” : 0,
“operations timed out waiting for space in cache” : 0,
“overflow pages read into cache” : 0,
“page split during eviction deepened the tree” : 0,
“page written requiring history store records” : 0,
“pages currently held in the cache” : 2227,
“pages evicted by application threads” : 0,
“pages evicted in parallel with checkpoint” : 988,
“pages queued for eviction” : 800,
“pages queued for eviction post lru sorting” : 510,
“pages queued for urgent eviction” : 1572,
“pages queued for urgent eviction during walk” : 222,
“pages queued for urgent eviction from history store due to high dirty content” : 0,
“pages read into cache” : 2454,
“pages read into cache after truncate” : 38,
“pages read into cache after truncate in prepare state” : 0,
“pages requested from the cache” : 150589702,
“pages seen by eviction walk” : 2345,
“pages seen by eviction walk that are already queued” : 463,
“pages selected for eviction unable to be evicted” : 182,
“pages selected for eviction unable to be evicted as the parent page has overflow items” : 0,

“pages selected for eviction unable to be evicted because of active children on an internal page” : 0,
“pages selected for eviction unable to be evicted because of failure in reconciliation” : 0,
“pages selected for eviction unable to be evicted because of race between checkpoint and out of order timestamps handling” : 0,
“pages walked for eviction” : 30554,
“pages written from cache” : 75277,
“pages written requiring in-memory restoration” : 1662,
“percentage overhead” : 8,
“the number of times full update inserted to history store” : 0,
“the number of times reverse modify inserted to history store” : 0,
“tracked bytes belonging to internal pages in the cache” : 4629506,
“tracked bytes belonging to leaf pages in the cache” : 873769716,
“tracked dirty bytes in the cache” : 631664742,
“tracked dirty pages in the cache” : 1089,
“unmodified pages evicted” : 0
}

this all stats

we have standalone server, not replicaset

What is your mongo version ? There is a very good tool keyhole, it will help you collects information about your instance, also you can use keyhole to analyze your mongod log file - The logs keep a history of the server operations over time. Keyhole, with the -loginfo option, reads mongo logs and prints a summary of slow operations grouped by query patterns.

Is MongoDB only one instance that is running on your machine or there is also some other server? Is the CPU consumption high all the time or only from time to time ?
in the beginning, during high CPU usage, can you provide the output of:

top
iostat
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10
db.currentOp({"secs_running": {$gte: 3}})
db.serverStatus().wiredTiger.concurrentTransactions
db.serverStatus().globalLock