About memcached

Hi all,

There is a new plugin for memcached query cache, I was hoping it will
bring some performance boost for my application, so I write a simple
ruby program to benchmark normal memcached performance, the result is
very frustrating:

require 'memcache'

CACHE = MemCache.new('localhost:11211')

def mem_write
  File.open("./dbmrec.txt", "r") do |f|
    while line = f.gets
      str, num = line.split(' ')
      CACHE[str] = num
    end
  end
end

dbmrec.txt contains 31196 lines of record like:

lwatch 38535
netwox-doc 70502
octave-audio 92312
octave-informationtheory 92004
pyrenamer 5049
ruby1.9-examples 13590
safecat 74989

It needs around 25s to successfully terminate compare to 0.5s forthe
same program using tokyocabinet.

So, my question is, am I missing something? This will be even slower
than normal sql insert/select I guess.

Thanks for any comment.

Difei

On Sep 18, 1:19 am, Difei Z. [email protected]
wrote:

There is a new plugin for memcached query cache, I was hoping it will
bring some performance boost for my application, so I write a simple
ruby program to benchmark normal memcached performance, the result is
very frustrating:

while line = f.gets
str, num = line.split(’ ')
CACHE[str] = num
end

So, my question is, am I missing something? This will be even slower
than normal sql insert/select I guess.

I don’t think repeated writes with no reads is a very good performance
test for memcached. Test reading instead. I’d test by populating the
cache to something that would look like steady state (i.e. you don’t
want all your data in cache, because that’s unrealistic, but you don’t
want to start empty), then starting the clock and doing lots of reads,
some of which will be cache misses and have to go to DB.

Kevin

Kevin Peterson wrote:

On Sep 18, 1:19�am, Difei Z. [email protected]
wrote:

� There is a new plugin for memcached query cache, I was hoping it will
bring some performance boost for my application, so I write a simple
ruby program to benchmark normal memcached performance, the result is
very frustrating:

� � while line = f.gets
� � � str, num = line.split(’ ')
� � � CACHE[str] = num
� � end

� So, my question is, am I missing something? This will be even slower
than normal sql insert/select I guess.

I don’t think repeated writes with no reads is a very good performance
test for memcached. Test reading instead. I’d test by populating the
cache to something that would look like steady state (i.e. you don’t
want all your data in cache, because that’s unrealistic, but you don’t
want to start empty), then starting the clock and doing lots of reads,
some of which will be cache misses and have to go to DB.

Kevin

Hi, I was using Ruby-Memcached, after changing it to memcached-client,
the speed is now much faster (3s), but it still can not beat
tokyocabinet.