The move to memcached_client 1.6.5 in Rails 2.3 seems to have made the
Rails cache about 10x slower. Since that's the opposite effect I
would expect, I was hoping somebody would explain where I'm misreading
these numbers?
I noticed my fragment caching was slow -- it shouldn't take 2ms just
to read a 2k string from a localhost memcached server:
Cached fragment hit: views/sightings/1556/row (2.3ms)
Cached fragment hit: views/sightings/1557/row (2.4ms)
Cached fragment hit: views/sightings/1558/row (2.2ms)
Then i did some quick and dirty benchmarks on the console:
First, with the "1.6.5" version bundled with rails 2.3
# => cache benchmark: (182.9ms)
Then I switch memcache_client versions, to 1.5.0:
# => cache benchmark: (18.6ms)
By the way -- I should clarify that the _actual memcache-client
library_ is significantly faster, as the benchmarks included in the
new (Mike Perham's) branch of memcache-client show.
I've added a FAQ entry explaining what is going on. 1.6+ is much
faster than 1.5.0 only when multiple servers are being used. I'm
guessing your benchmark is testing just localhost:11211.
Simple answer, turn off socket timeouts in order to dramatically speed
up memcache-client but realize you might be woken up at 3am when
production melts down, as I was.
Simple answer, turn off socket timeouts in order to dramatically speed
up memcache-client but realize you might be woken up at 3am when
production melts down, as I was.
Better answer -- split the difference: install mike's memcache-
client-1.7.2 (from github) and the SystemTimer gem, which speeds up
1.6.5 substantially without turning off the timeouts.
My problem is that I added fragment caching thinking .03ms fetch times
were normal, and now when it takes 3-4ms (with the timeouts) to get
each fragment... stuff gets really slow. So until i refactor, timeouts
are off.