Hi Dormando,

Thanks for your response.

On 06/02/2011 23:44, dormando wrote:
I've found (part of) the answer to my own question - the virtual
memory comes from the thread stacks.  Setting -t 1 reduces the virtual
memory to around 20MB.

I've read from other posts that it is no longer possible to have a non-
threaded memcached version.  It appears on my system that the stack
size being used is 10MB.  This is almost certainly way too large.  Is
there any way to conveniently (i.e. without major edits to the source
code) set the thread stack size for the threads that memcached uses,
e.g. through a macro setting?
There's some amount of overhead with pre-allocating the hash table and
this and that... that'll show up as virtual memory until data's written
into it. Also note that memcached will lazily allocate one slab per slab
class, so even if you set -m 12 you'll end up using 50+ megs of ram if you
put one item in each slab class.

You could also use -I to lower the max item size and reduce some overhead.
I tried varying the values for -I, but it made no difference to the overall vmem displayed when starting up (though it may in time).
Don't think it explicitly sets the thread stack size, and I forget how to
tweak that offhand, I think google will tell you :P
I've decided to move my memory caching into eaccelerator (for PHP), since for the current app it doesn't need data to be hosted on multiple machines - and thus both reduces the size of virtual mem and will access the data slightly quicker.

Thanks again,

Dave.

Reply via email to