Resume and bio of the author Couple of articles related to my hobby - robotics
My impressions about immigration to Australia. In Russian only. Recipes for everyday problems solving
Linux-related posts Windows-related posts
Software-related posts A lot of info about hardware
Different tools you might find useful Posts about various web technologies
Everything that doesn't fit the rest of the menu RSS feed for this blog

Tag Cloud



Andrey Mikhalchuk’s Blog

Technoblog about life

Oct 28, 2010 Rails: what happens when memcached goes down

I tried to figure out how rails reacts to the fact that memcached goes down. Unfortunately there is no god documentation about this besides saying that everything will be fine. Also there are couple misleading posts in different forums saying that rails will never rediscover memcached server that went down and came back again. Here’s what is actually happening…

Since no good documentation on subject is provided I ran couple tests with memcached in verbose mode:
memcached -vvv
So my tests started when everything was working fine and my rails app was happily hitting the cache. Then I killed memcached (with simple ^C) and refreshed the page again. With no noticeable lag rails figured out that memcached is down. It refreshed the page just like if all the keys it requested from cache missed. Then I brought memcached back to live and refreshed the page again. Rails didn’t hit memcached (and thus most probably lead some people to false assumption Rails will never figure out that memcached is back). So I kept refreshing the page and, oh miracle, 20 seconds later Rails decided to ping memcached, found it is alive and started using it again.
Apparently the same thing is happening when rails app starts before memcached. So the documentation is right and everything will be figured out by rails and memcached automagically, you do not need to worry about this. Awesome pair of technologies!

This post is published in Software, Web.

No comments

No comments so far

Leave a Reply

You must be logged in to post a comment.

Site Map (c) Andrey Mikhalchuk, 2005-2008