[Ruby] memcache-client advice
James Hillyerd
james at hillyerd.com
Fri Apr 20 15:55:44 PDT 2007
As a followup, I spent some time playing with memcache-client 1.3.0
in irb today with a couple memcached servers.
It seems to be the library is fault tolerant of memcached's exiting.
But if I suspend a running memcached (Ctrl-Z), CACHE.get will hang
for at least a few minutes... I gave up waiting.
I'm not familiar with socket programming... Is there a timeout that
could be set somewhere to force it to give up if the TCP conn hangs
for a few seconds?
If anyone wants to duplicate, this is all I was doing:
require 'rubygems'
require 'memcache'
CACHE = MemCache.new %w(localhost:11211, localhost:12221), :namespace => 'test'
(1..10).each { |i| CACHE.set "foo#{i}", "bar#{i}" }
(1..10).collect { |i| CACHE.get "foo#{i}" }
-james
On 4/19/07, James Hillyerd <james at hillyerd.com> wrote:
> Hello.
>
> We're using memcache-client to store sessions and cache some data.
> Right now we have two app servers, each one with a memcached instance.
> Rails is setup to talk to both memcacheds. The problem is if one of
> those memcached instances goes down due to maintenance or server
> problems, our webapp completely locks up.
>
> I traced it back to rails not being able to connect to the missing
> memcache server, and if I edit the config file to only use the local
> memcache, things start working again. But this removes our ability to
> failover, or at least limp along on a single app server.
>
> I saw something about a request_timeout attribute in the MemCache
> class, but it didn't look like it's actually used in the code.
>
> Any recommendations?
>
> Thanks.
>
> -james
>
> --
> James A. Hillyerd <james at hillyerd.com>
> Chief Technical Officer - ActiveRain Corp
>
--
James A. Hillyerd <james at hillyerd.com>
Chief Technical Officer - ActiveRain Corp
More information about the Ruby
mailing list