Fast writes, slow reads

Brad Fitzpatrick
Sun, 10 Aug 2003 16:39:18 -0700 (PDT)


Can you reproduce this slow behavior with the Linux x86 binary at ?

I want to rule out any sort of build differences, since the binary above
is what we use on LiveJournal.  (and it flies for us...)

If it's still slow with that binary and with the Perl client, it's
definitely time to point fingers at libevent.  Nothing I see in the PHP
client should make things slow, just incorrectly warning in some cases.

If you can, make yourself a new kernel.  Here's the latest patch, against

- Brad

On Sun, 10 Aug 2003, Brion Vibber wrote:

> I'm finding that reading data back from memcached is surprisingly slow.
> I've probably done something wrong. :)
> I wrote a simple loop that reads 500 integers or strings, adding each
> one to the cache if it's not already in. The first run, which checks for
> 500 uncached items and adds 500 items to the cache, runs fast enough;
> more or less a second.
> The second run, which fetches back the set values, consistently takes
> about 50 seconds, about a tenth of a second per fetched item. 1000 items
> take 100 seconds, 50 items take 5 seconds.
> Since I expect to do a lot more reading than writing, this has me a
> little worried! I'm getting this same slow read speed from the PHP and
> Perl clients, and both talking to a local server on the BSD box or over
> the network to the Linux box.
> Moving the Perl client from the 2 GHz Athlon (BSD) to the 266 MHz
> Pentium II (Linux), oddly enough my speeds increase a bit: it takes a
> mere 20 seconds to fetch 500 items (though the check + add sequence goes
> up to 2 seconds). It doesn't seem to make a difference whether it's
> talking to the local or the remote server.
> Any ideas? I've attached the Perl version of the test script; I'm using
> the 1.0.6 MemCachedClient... Perl 5.6.1 is installed on the FreeBSD box,
> 5.8.0 on the Linux box.
> -- brion vibber (brion @