8月 052017
 

缘起:

dubbo-monitor容器swap使用率超过 20% ,而且在不断上升,为什么呢?

 

下面是容器dubbo-monitor在drop-caches前后的对比:

 

drop-cache后,容器的swap使用率没有变化

 

结论:

  1. docker stats 显示的内存使用是包含cache的
  2. 该容器的部分cache信息会被swap出内存
    1. cache和swap之间存在一些不默契;cache认为内存够多,还可以cache更多信息;swap机制为,经内存充裕,只要是不常被访问的内存数据,尽量swap出来; 于是乎,就形成了一个恶性循环,导致swap占用越来越大
    2. 解决办法: 定期drop一下cache
  3. 系统不会傻到把cache内容换出到swap中的,swap确实为进程使用的(虚拟)内存的一部分
  4. 一个允许最大使用2g内存的java进程,swap出来500m或1g不足为奇,如果给他的swap大小为2g的话,占用50%的swap都有可能
 Posted by at 下午 2:47

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据