Newbie question: memcached slow the first time a value is read?

Tim Strehle tim at
Wed Dec 7 12:49:53 UTC 2005


Alex Stapleton wrote:
> On 7 Dec 2005, at 11:49, Ask Bjørn Hansen wrote:
>> If I'm reading this right (darn proportional fonts) then yes, you  are 
>> swapping memcached!
>> (and/or you are swapping something else which on most webservers is  a 
>> terribly terribly thing to do).
> You may also want to set swappiness to 0 so that Linux is less likely  
> to swap it out and will favour eating up the page cache instead.
> echo 0 > /proc/sys/vm/swappiness
> Should do it. Depends on what else your using the machine for though.

thanks a lot for your responses!

You're right, memcached data had been swapped to disk. A simple "swapoff 
-a" fixed this, now memcached is always as fast as expected. (Not sure 
whether I want to do this on a production web server, though...)

Seems like I'll have to learn a little bit more about Linux swapping; 
there was definitely no user process taking that much from the 3 GB RAM 
to force memcached's 1.5 GB into swap space - so (knowing as little as I 
do) I suspect the Linux filesystem caching mechanism did this. I'll look 
into "/proc/sys/vm/swappiness" as well.

Thanks again for the help,

Tim Strehle                 
Digital Collections         

More information about the memcached mailing list