search

Home  >  Q&A  >  body text

mongodb cpu 占用150%?

mongodb 的 cpu 占用一直很高,长期保持在150%。准确的说是cpu时间片的占用,所用的服务器是4核的物理机,cpu占用在30%到40%之间,不知道这样是否正常。

服务读写都不是特别高

top

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1025 mongodb 20 0 7632304 340452 291908 S 157.8 4.2 87414:58 mongod

mongostat

insert query update delete getmore command flushes mapped vsize res faults qr|qw ar|aw netIn netOut conn time

*0    *0     *0     *0       0 26181|0       0   3.5G  7.3G 334.0M      0   0|0   0|0    3m     2m   28 18:20:00
*0    *0     *0     *0       0 22740|0       0   3.5G  7.3G 334.0M      0   0|0   0|0    2m     1m   28 18:20:01
*0    *0     *0     *0       0 19667|0       1   3.5G  7.3G 334.0M      0   0|0   0|0    2m     1m   28 18:20:02
*0    *0     *0     *0       0 19194|0       0   3.5G  7.3G 334.0M      0   0|0   0|0    2m     1m   28 18:20:03
*0    *0     *0     *0       0 19212|0       0   3.5G  7.3G 334.0M      0   0|0   1|0    2m     1m   28 18:20:04
*0    *0     *0     *0       0 19168|0       0   3.5G  7.3G 334.0M      0   0|0   1|0    2m     1m   28 18:20:05
*0    *0     *0     *0       0 19205|0       0   3.5G  7.3G 334.0M      0   0|0   0|0    2m     1m   28 18:20:06
*0    *0     *0     *0       0 19207|0       0   3.5G  7.3G 334.0M      0   0|0   1|0    2m     1m   28 18:20:07
*0    *0     *0     *0       0 19218|0       0   3.5G  7.3G 334.0M      0   0|0   0|0    2m     1m   28 18:20:08
*0    *0     *0     *0       0 19206|0       0   3.5G  7.3G 334.0M      0   0|0   1|0    2m     1m   28 18:20:09

mongotop


                      ns    total     read    write    2015-09-16T18:21:42+08:00

log_inst.log_inst_2015_09_16 185ms 185ms 0ms
log_info.log_info_2015_09_16 164ms 164ms 0ms
log_data.log_data_2015_09_16 163ms 163ms 0ms

           pprt.pprt_sub    130ms    130ms      0ms
           pprt.pprt_hub    128ms    128ms      0ms
      admin.system.roles      0ms      0ms      0ms
    admin.system.version      0ms      0ms      0ms
       local.startup_log      0ms      0ms      0ms
    local.system.indexes      0ms      0ms      0ms
 local.system.namespaces      0ms      0ms      0ms
 
習慣沉默習慣沉默2803 days ago937

reply all(3)I'll reply

  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-04-28 09:07:26

    Use iostat to check whether there is a problem with the system I/O.

    reply
    0
  • 某草草

    某草草2017-04-28 09:07:26

    Has the index been created?

    reply
    0
  • 怪我咯

    怪我咯2017-04-28 09:07:26

    It should be that the index is missing
    Look at the mongo logs and find the queries with many and slow queries
    Create the index accordingly

    reply
    0
  • Cancelreply