开发者社区 问答 正文

mongos相当的吃内存,是啥原因?:报错

top - 15:55:30 up 8 days, 23:25, ? users,  load average: 0.15, 0.04, 0.01
Tasks: 132 total,   1 running, 131 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.2%sy,  0.0%ni, 99.4%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  30212128k total, 25190188k used,  5021940k free,   384288k buffers
Swap:  2104504k total,        0k used,  2104504k free,   643000k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                                             
24072 root      20   0 22.9g  22g 3400 S  2.3 78.7 128:36.19 mongos

有人知道这个原因不?
重点是他吧内存吃完啦,系统也死啦,远程也链接不了系统,只能让机房重启,相当严重啊

展开
收起
kun坤 2020-06-14 14:31:22 463 分享 版权
1 条回答
写回答
取消 提交回答
  • 内存低于16G的,就不要玩mongodb了######呵呵,mogodb的速度就是操作内存!######哥,我30G的内存呢######NB了######Objects 3217961
    Data Size 1.26g
    Storage Size 1.61g
    Extents 137
    Indexes 60
    Index Size 209.54m

    数据也不大######有多少吃多少,cpu用得多了,就吃少了.######

    引用来自“LimSteven”的答案

    有多少吃多少,cpu用得多了,就吃少了.

    cpu用得多了,就吃少了.  不明白这句话

    重点是,他吧内存吃完后,就真的吃完啦,是实打实的内存,不是缓存,最后搞得系统死机,严重啊

    连限制进程的内存都不起作用

    ######

    http://docs.mongodb.org/manual/faq/fundamentals/#does-mongodb-require-a-lot-of-ram

    MongoDB automatically uses all free memory on the machine as its cache.....If another process suddenly needs half the server’s RAM, MongoDB will yield cached memory to the other process.


    ######

    引用来自“Wolsan_Hsu”的答案

    http://docs.mongodb.org/manual/faq/fundamentals/#does-mongodb-require-a-lot-of-ram

    MongoDB automatically uses all free memory on the machine as its cache.....If another process suddenly needs half the server’s RAM, MongoDB will yield cached memory to the other process.


    谢谢你

    从我的top中可以观察到

    Mem:  30212128k total, 25190188k used,  5021940k free,   384288k buffers

    总内存30G used使用啦25G左右,free 只有5G 而缓存buffers则只有3.8G

    按照linux内存使用规则 使用内存=used-buffers-cached(25-3.8=21.2)

    这里算出来的21G是是实打实的被占用啦,是不会释放的.(21.2+5(这个是剩余)=27.2)

    总内存是30G 用30-27.2就可以知道cached用啦8.8G,

    相对我Data Size 1.26g 这么大,退一步在加上Index Size 209.54m 

    也不应该使用21G这么大的内存吧,应该是mongos有内存泄漏吧


    ######用 free -m 来查看######

    哈哈算错啦,top是没有cached的

    所以使用内存就是used-buffers(25-3.8=21.2)

    ######因为速度快
    2020-06-14 14:31:27
    赞同 展开评论
问答标签:
问答地址: