2011-05-24 160 views
2

我有一个安装在我想在我的生产环境中使用的memcache,但是当我运行了一些测试时,似乎memcache并没有释放内存,即使它已经用完了所有它分配了内存,同时我登录并运行了flush_all命令,但对象仍在缓存中。 这里是输出来自一些测试Memcached使用超过最大内存


memcached-tool 

memcache-top v0.6  (default port: 11211, color: on, refresh: 3 seconds) 

INSTANCE    USAGE HIT % CONN TIME EVICT/s READ/s WRITE/s 

127.0.0.1:11211   427.1% 0.0% 18  1.4ms 0.0  244  261.0K 

AVERAGE:    427.1% 0.0% 18  1.4ms 0.0  244  261.0K 

TOTAL:   4.3MB/ 1.0MB   18  1.4ms 0.0  244  261.0K 

memcached-tool 127.0.0.1:11211 display 


    No Item_Size Max_age Pages Count Full? Evicted Evict_Time OOM 

    1  560B   4s  1 1872  yes  0  0 15488 

    2  704B  32s  1  559  no  0  0 0 

    3  880B   4s  1 1191  yes  0  0 1335 

    4  1.1K   9s  1  116  no  0  0 0 

    5  1.4K  21s  1  14  no  0  0 0 

    6  1.7K   4s  1  17  no  0  0 0 

    7  2.1K  84s  1  24  no  0  0 0 

    8  2.7K  130s  1  60  no  0  0 0 

    9  3.3K  25s  1  290  no  0  0 0 

10  4.2K   9s  1  194  no  0  0 0 

11  5.2K   9s  1  116  no  0  0 0 

15 12.7K  816s  1  1  no  0  0 0 

16 15.9K  769s  1  5  no  0  0 0 

18 24.8K  786s  1  1  no  0  0 0 

21 48.5K  816s  1  1  no  0  0 0 

memcached的工具127.0.0.1:11211统计

127.0.0.1:11211 Field  Value 

    accepting_conns   1 

      auth_cmds   0 

     auth_errors   0 

       bytes  4478060 

      bytes_read 23964596 

     bytes_written 546642860 

      cas_badval   0 

      cas_hits   0 

      cas_misses   0 

      cmd_flush   0 

      cmd_get  240894 

      cmd_set  4504 

     conn_yields   0 



    connection_structures   21 

    curr_connections   18 

      curr_items  4461 

      decr_hits   0 

     decr_misses   0 

     delete_hits   0 

     delete_misses   0 

      evictions   0 

      get_hits  43756 

      get_misses  197138 

      incr_hits   0 

     incr_misses   0 

     limit_maxbytes  1048576 

listen_disabled_num   0 

       pid  8731 

     pointer_size   64 

      reclaimed   0 

     rusage_system 5.047232 

     rusage_user 4.311344 

      threads   4 

       time 1306247929 

    total_connections  3092 

     total_items  4504 


       uptime  1240 

      version  1.4.5 

回答

4

-m告诉memcached多少内存用于项目存储(以兆字节为单位)。请注意0​​请注意,这不是全局 内存限制,因此memcached将使用比您告诉的内存少几%的内存。 将此设置为安全值。将其设置为 少于48兆字节在1.4.x及更早版本中不能正常工作 。它会 仍然使用内存。

来源:http://code.google.com/p/memcached/wiki/NewConfiguringServer