zoukankan      html  css  js  c++  java
  • mongodb占用大量内存

    分析了下mongodb的BsonChunkPool占用了大量内存,

    找到一篇文章 

     

    The BsonChunkPool exists so that large memory buffers (chunks) can be reused, thus easing the amount of work the garbage collector has to do.

    Initially the pool is empty, but as buffers are returned to the pool the pool is no longer empty. Whatever memory is held in the pool will not be garbage collected. This is by design. That memory is intended to be reused. This is not a memory leak.

    The default configuration of the BsonChunkPool is such that it can hold a maximum of 8192 chunks of 64KB each, so if the pool were to grow to its maximum size it would use 512MB of memory (even more than the 7 or 35 MB you are observing).

    If for some reason you don't want the BsonChunkPool to use that much memory, you can configure it differently by putting the following statement at the beginning of your application:

    BsonChunkPool.Default = new BsonChunkPool(16, 64 * 1024); // e.g. max 16 chunks of 64KB each, for a total of 1MB
    

    We haven't experimented with different values for chunk counts and sizes so if you do decide to change the default BsonChunkPool configuration you should do some benchmarking and verify that it doesn't have an adverse impact on your performance.

    From jira: BsonChunkPool and memory leak

    mongodb - BsonChunkPool and memory leak - Stack Overflow

  • 相关阅读:
    集合的概述
    mysql修改用户名密码
    CentOS7 安装Chrome的方法
    常用sql汇总
    Rabbitmq六大应用模式
    高可用RabbitMQ集群搭建
    docker-compose
    Haystack
    幂等性问题剖析
    用redis构建分布式锁
  • 原文地址:https://www.cnblogs.com/xinzhyu/p/15150988.html
Copyright © 2011-2022 走看看