Inconsistent performance

Lexington Luthor lexington.luthor at gmail.com
Thu Apr 19 16:26:15 UTC 2007


Matthew Gibble wrote:
> I am a bit of a newbie to memcached, although I have
> played around with it for about a month or two now.  I
> am writing a low latency server which caches a lot of
> static data to be retrieved quickly on each request. 
> I have noticed some inconsistent performance with
> regards to these retrievals.  In a simple program
> where I am simply retrieving an entry from the cache
> (no sets) I see performance that ranges from 0ms up to
> 30ms or more.  I am using the Java client, although I
> have used the Ruby client as well to verify my
> results.  My questions are:
> 1. What is causing this varied performance when I am
> simply retrieving information from the cache and not
> doing any sets?
> 2. Is there some setting that I can use on the server
> or client that might help me get more regular
> performance?
> 

memcached is certainly not causing your performance problem. Both java 
and ruby have garbage collectors which can cause huge latency problems 
particularly if every 30ms matters to you. I don't know about ruby but 
java's GC can not be turned off in your code, so you will likely have 
GC-related latency problems. Some VM language implementations e.g. 
CPython will let you turn off the GC though.

In the meantime I suggest you use C for measuring memcached's latency. 
You can also strace memcached to find out exactly how long is being 
spent in the code. If your client app is not causing the latency 
problem, very likely too much time is being spent in system calls, and 
you may be able to tweak your kernel's TCP settings or use UDP to 
overcome that.

Regards,
LL



More information about the memcached mailing list