Rohit,
Thanks for your reply. That works very well, thanks - it's now reduced
to just a few MB's virtual mem.
I'll need to check what stack size is appropriate for the memcached
threads, but I'm guessing it's probably not more than 64 or 128KB.
I'll add an issue notice to the memcached bug tracker to suggest setting
the stack size explicitly when starting threads.
Thanks again,
Dave.
On 07/02/2011 10:08, Rohit Karlupia wrote:
If it helps, you could reduce the stack size on linux using ulimit -s
<stackSizeInKB)
thanks!
rohitk
On Mon, Feb 7, 2011 at 1:32 PM, letmewatch.TV <pay.letmewatch.tv
<http://pay.letmewatch.tv>@gmail.com <http://gmail.com>> wrote:
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.