使用超过最大内存的Memcached

时间:2011-05-24 14:47:44

标签: memcached memory-management

我在memcache上有一个安装,我想在我的生产环境中使用但是当我运行了几个测试时,似乎memcache即使耗尽了所有已分配的内存也没有释放内存,我登录并运行了flush_all命令,但对象仍然在缓存中。 以下是一些测试的输出


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-tool 127.0.0.1:11211 stats

 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

1 个答案:

答案 0 :(得分:4)

  

-m告诉memcached用于项目存储的RAM(以兆字节为单位)。注意   小心翼翼,这不是一个全球性的   内存限制,所以memcached将使用一个   比你告诉它的内存少了几个百分点。   将其设置为安全值。将其设置为   少于48兆字节不起作用   适当地在1.4.x及更早版本中。它会   仍然使用记忆。

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