On Jun 9, 2008, at 8:56 PM, Carise Fong wrote:
Hello,
I'm fairly new to memcached and have been reading up on it for the
last couple of weeks or so, while trying to upgrade my company's
current version of memcached (1.1.12) to 1.2.5. One thing I was
asked to check was to make sure the memory is actually getting
locked down when using the "-k" option. I check this using pmap.
When I run memcached like this:
$ sudo memcached -k -u memcache -p 11233 -vv
Running "pmap -xas [memcached pid]" shows numbers under the "Locked"
column, like this: http://pastebin.org/41197
However, when I run memcached in daemon mode, like this:
$ sudo memcached-debug -k -u memcache -p 11233 -d -P /
tmp/.pid.dev.memcached125
I don't see any numbers under the Locked column, only "-", like
this: http://pastebin.org/41198
So, my question is -- why is it that running memcached in daemon
mode does not show any locked memory? I do make sure memcached is
actually storing something (setting data through the client), so
it's not like the cache is just freshly restarted and empty.
If you look at the documentation for mlockall at
http://docs.sun.com/app/docs/doc/816-0213/6m6ne386n?a=view
"Locks established with mlockall() are not inherited by a child
process after a fork(2) call, and are not nested."
If you look in memcached.c you see we call mlockall before trying to
become a daemon..
Trond