$ memcached -h
(...)
-m <num> max memory to use for items in megabytes, default is 64 MB
(...)
Be careful to not put it too high, as you certainly don't want to
swap. It is only memory reserved for items, so it means your memcached
daemon needs more memory, and you also need to keep some memory for
the system, plus some other services that may run on the same box.
2009/5/14 TopLess <0w9za2b...@jetable.com>:
$ telnet <server> <port>
stats
(...)
you should have a look at evictions, bytes and limit_maxbytes.
$ telnet <server> <port>
stats slabs
(...)
for each slab, you should check free_chunks and free_chunks_end, and
at global level you should check total_malloced.
2009/5/14 TopLess <0w9za2b...@jetable.com>:
So if you allocate a lot of small chunks for small items, and they are
evicted, the memory cannot be reused for bigger chunks. The only
solution is to restart memcached, a flush will not help.
There is a mode that always allocate 1MB pages, which allows to
reallocate a page to another chunk size. However, I'm not sure that it
is the problem here. Having output of stats and stats slabs will help
to diagnose.
2009/5/14 luciano11 <luci...@gmail.com>:
Here is an example on my server:
$ echo "stats slabs" | netcat <host> <port> | grep chunk_size
STAT 1:chunk_size 104
STAT 4:chunk_size 224
STAT 5:chunk_size 280
STAT 6:chunk_size 352
STAT 7:chunk_size 440
STAT 8:chunk_size 552
STAT 9:chunk_size 696
STAT 10:chunk_size 872
STAT 11:chunk_size 1096
STAT 12:chunk_size 1376
STAT 13:chunk_size 1720
STAT 14:chunk_size 2152
STAT 15:chunk_size 2696
STAT 16:chunk_size 3376
STAT 17:chunk_size 4224
STAT 18:chunk_size 5280
STAT 19:chunk_size 6600
STAT 20:chunk_size 8256
STAT 21:chunk_size 10320
STAT 22:chunk_size 12904
STAT 23:chunk_size 16136
STAT 24:chunk_size 20176
The number after stat is the slabclassid. The chunk_size is in bytes.
If we look at the slabclassid 1:
$ echo "stats slabs" | netcat obeat103 33799 | grep "STAT 1:"
STAT 1:chunk_size 104
STAT 1:chunks_per_page 10082
STAT 1:total_pages 4
STAT 1:total_chunks 40328
STAT 1:used_chunks 10504
STAT 1:free_chunks 29824
STAT 1:free_chunks_end 5154
So chunks in this page are 104 bytes, and there are 10082 chunks by
page, i.e the page is 0.999954 MB. On my server, 4 pages have been
allocated for this slabclassid, resulting in 40328 chunks of 104 bytes
availables. But in fact, only 10504 of these chunks are used.
2009/5/15 TopLess <0w9za2b...@jetable.com>:
Hi,
to help us to diagnose this problem, this is our stats :
Memory usage (server) :
free : 11.7 GB
used : 3.98 GB