Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongo DB High CPU Usage

Usually , what are the checks/actions we need to do when we receive an alert from MongoDB about CPU high usage like below?

**System: CPU (User) % has gone above 95

CPU usage is maxing out available resources and may be throttled shortly. Ensure no index is missing and scale up. Please navigate to the System CPU metrics page to see usage details.**

like image 531
RagaSGNur Avatar asked Jun 12 '26 21:06

RagaSGNur


1 Answers

  1. Check if you have COLLSCAN queries in your mongo.log files -> this mean you dont use indexes and your performance is suffering unnecessary.
  2. Check for other slow queries in your logs even using indexes.
  3. CPU in mongoDB is used mainly for sorting and aggregation , check your queries.
  4. It maybe your database growed enought and you need to think about resources extension or sharding?

Some commands that can be of help:

 top -H -p <mongod PID>
 mongotop
 mongostat
 db.currentOp()
 sar
like image 64
R2D2 Avatar answered Jun 14 '26 13:06

R2D2



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!