<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Tahoma size=2>Hello,</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>I am doing some tests to see if memcache will help 
my application.</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>For test purposes, I started memcache with 16MB of 
memory with this command:</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>&nbsp;&nbsp;&nbsp; /usr/bin/memcached -m 16 -p 
11211 -u root</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>I wrote a simple benchmark script in PHP that 
writes a 2k string to memcache 40,000 times, with an incremental key (10,000 - 
39,999) and then reads at random 80,000 keys back.</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>Now, firstly I know that 40,000 2k strings will 
more than fill the cache! The idea was to stress it a little :o)</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>So the benchmark ran quite well, in both reading 
and writing (nowhere near as fast as a local tmpfs mounted ramdisk, but hey, it 
supports distribution across machines).</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>After I have done this benchmark, trying to write 
another sized key (not 2k) takes an age and slows my application down to a halt 
(down from 65 pages per second, to 8 pages per second).</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>So I have been reading about slab allocators and 
see that is the problem - but how can this be fixed?! Why does it take so long 
to find out it cannot store the key?</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>I cannot have my application grind to a halt 
because a cache is full - it would be far better without it.</FONT></DIV>
<DIV><FONT face=Tahoma size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Tahoma size=2>Jamie.</FONT></DIV></BODY></HTML>