memcached memory usage

Veres Lajos vlajos at
Wed Dec 7 10:59:03 UTC 2005

On Wed, 7 Dec 2005, Denis Antipov wrote:

> Hello, folks
> I've been continuing to test memcached and trying to go about my problem
> with overwritten/lost data in memcached without the use of a database or
> some other solid data source. Yes I'm stubborn. Anyway. I've written a
> script that shows, IMHO, that memcached doesn't utilize memory efficiently,
> either due to it's queue and class slab allocation algorithm, or some other
> unknown to me reason. See the PHP script below. I've used Apache Bench with
> 50000 requests on a memcached with 1Gb maxbytes. The script outputs a CSV
> line for each data "set" in memcached. It records time, current items, total
> items, the key, and the data size that was stored for that key (the amount
> of data is random for each key). For my run, I noticed that at about 15K
> items no more bytes were "used", meaning that no more memory was allocated
> and no more items can be stored, the overwriting has begun. The problem is
> that bytes kept staying at 560Mb which means it's using 56% of the allowed
> memory. I've read about memory space inefficiency with the classes and such,
> but 50%!!! Isn't it a bit low?!!! Can we address this issue somehow, was
> there anything done besides the class reasignment script in scripts, which
> I'm not sure how would solve this problem anyway?
> Thanks,


We have similar experiences.
We are using 2 cache server.
php statistics says for them:
bytes used=39M
limit max bytes=64M

ps -F says:
root      9394     1  0 18542 72984  3 Nov30 ?        S     33:26 /usr/bin/memcached -m 64 -p 11211 -u

Veres Lajos
vlajos at
+36 20 438 5909

More information about the memcached mailing list