Ruby on Rails Caching: memcached Connection Lost Problem - FiveRuns' Memcache-client to Rescue

Submitted by kai on Sun, 2008-10-05 23:56. ::

You use memcached server and memcached-client for caching with your Ruby on Rails application. One day, monit tells you that memcached got restarted. Sounds good. But when you check your Ruby on Rails app, it gives you 500 errrors all over the place. You check your server logs. Tons of errors on 'lost connection' with memcache. It turned out that memcached-client doesn't automatically retry on failed memcached connection.

Fortunately, FiveRuns fixed memcached-client and released it

To install:


sudo gem install fiveruns-memcache-client --source http://gems.github.com

edit appropriate Ruby on Rails environment where you need to turn on caching:


#gem 'memcache-client'

#once memcache-client loses connection to memcached, it won't retry.
#use fiverun's memcache-client because it can deal with retry after losing connection to memcached
#http://github.com/fiveruns/memcache-client/tree/master
gem 'fiveruns-memcache-client'

Post new comment



The content of this field is kept private and will not be shown publicly.


*

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • WikiText is converted to HTML (supported WikiText formatting will show in the long tip format).
Verify comment authorship
Captcha Image: you will need to recognize the text in it.
*
Please type in the letters/numbers that are shown in the image above.