FiveRuns Blog

On Rails production performance and monitoring

Posts
11 comments

FiveRuns and Seattle.rb's memcache-client

In order to scale our service, a large portion of our Manage service runs asynchronously from the http://manage.fiveruns.com website. We use Starling, the fantastic queuing system behind Twitter, to manage jobs to be processed. One interesting twist to Starling is that it uses the memcached client API so any memcached client library can access Starling without any extra effort.

Since our service is 24/7, we needed fault tolerance, high availability and other such high-falootin’ ideals. Our plan was to have two Starling servers, one on each app server, with the job processors using the local Starling server on their own machine by default, falling back to the server on the other machine if the local Staring daemon died.

Seattle.rb’s memcache-client 1.5.0 library supports multiple servers and does make an effort to switch between them but it has three known problems:

  1. set() fails when the socket has been disconnected (via Twitter)
  2. it does not retry if a socket operation fails (via Will Bryant)
  3. it does not retry the current operation on another server if a server dies

The latter issue means that data will be lost when a server dies. We’ve fixed all three issues in our Github repository for memcache-client and Zachary Pinter is working on getting our updated code pushed into Edge Rails. Hopefully we’ll see an updated memcached client in Rails soon. In the mean time, please feel free to fork or clone our repository and use it in your own project!

Bookmark and Share
Continued Discussion

11 responses to this entry

I’ve actually had really good results with Evan Weaver’s memcache client: http://github.com/fauna/memcached/tree/master

What’s the advantage of memcache-client over (in my experience) faster lib?

Jeremy Jeremy said:

on June 12, 2008 at 10:30 AM

The only advantage appears to be one of marketing. When trying to determine what the “standard” Ruby memcached client is, memcache-client kept coming up. Evan’s client certainly looks like an attractive option. Thanks for the pointer, Jeremy.

Mike Perham Mike Perham said:

on June 18, 2008 at 03:02 PM

It looks like you forgot to update the README doc for your fork:

“http://github.com/advany/starling/tree/master”

as well as the install directions:

sudo gem install advany-starling

Chris Kilmer Chris Kilmer said:

on June 18, 2008 at 05:10 PM

Are there any resources on how to get fiveruns-memcache-client up and running? It seems like the instructions say do $sudo gem install fiveruns-memcache-client, but this generate all sorts of gem not found hiccups.

Aaron Gibralter Aaron Gibralter said:

on July 08, 2008 at 08:19 AM

The gem name was set incorrectly. If you do a gem install now, it should work fine.

Mike Perham Mike Perham said:

on July 09, 2008 at 03:54 PM

Hey. Nice work. I found that I had to remove the memcache client from the Rails vendor in order to load the gem. Don’t know if there’s a nicer way to do this such that I don’t have to edit the Rails version used.

Any luck getting the fixes pushed to the version that ships with Rails? Does that version even do the CRC32 natively?

Morten Morten said:

on September 09, 2008 at 06:48 AM

Where can I ask questions about getting this to work? I’m tearing my hair out.

Brian Ablaza Brian Ablaza said:

on September 29, 2008 at 10:32 AM

Brian: We are not aware of any mailing lists specific to Starling. Maybe you can find help in blog posts about it, like this Ruby Inside article or this Rubypond article, for example.

Oliver Schmelzle Oliver Schmelzle said:

on September 30, 2008 at 02:52 PM

Thanks for responding. I’ll check them out.

Brian Ablaza Brian Ablaza said:

on October 02, 2008 at 10:45 AM

Hi,

Memcache gives me the following error when I run this code?

>

C:\ruby\lib\ruby\gems\1.8\gems\fiveruns-memcache-client-1.5.0.5\lib/memcache.rb:580: in `with_socket_management’: No connection to server (DEAD: execution expired, will retry at Tue Dec 16 11:16:36 -0800 2008) (MemCache::MemCacheError)

from C:\ruby\lib\ruby\gems\1.8\gems\fiveruns-memcache-client-1.5.0.5\lib/memcache.rb:261:in `set’ from C:\ruby\lib\ruby\gems\1.8\gems\fiveruns-memcache-client-1.5.0.5\lib/memcache.rb:596:in `with_server’ from C:\ruby\lib\ruby\gems\1.8\gems\fiveruns-memcache-client-1.5.0.5\lib/memcache.rb:256:in `set’

<<<

My test code is as follows:

require ‘memcache’ memcache_options = { :compression => true, :debug => false, :namespace => ‘my_test_space’, :readonly => false, :urlencode => false }

Cache = MemCache.new memcache_options puts Cache.inspect

Cache.servers = ‘localhost:11211’ Cache.set ‘my_test_space’, ‘xyz’ test = Cache.get ‘my_test_space’ Cache.delete ‘my_test_space’

I am using fiveruns-memcache-client (1.5.0.5)

Could you please tell me what I am doing wrong here ? I am using it on Windows XP? Is there any platform dependencies?

Thanks Much

Sam

Sam Sam said:

on December 16, 2008 at 01:24 PM

Is the 1.6.0 branch of memcache-client found at http://github.com/mperham/memcache-client/tree/master now the definitive version? Does anyone know how Fauna’s memecached compares, performance-wise to fiveruns-memcache-client and memcache-client?

Todd Tyree Todd Tyree said:

on January 21, 2009 at 03:04 AM

Contribute

Continue the conversation and share your thoughts. A name is required. Your e-mail address will not be displayed on the site. Textile formatting may be used in your comments (but will not be rendered in the live comment preview).

→ Posted by You on June 09, 2009 at 12:21 PM

Flickr

FiveRuns tagged photos on Flickr.

  • dwi_1201b
  • dwi_1106e
  • Bruce Williams
  • dwi_1201a
  • fiveruns-penn-and-teller-3
  • Bruce Williams
  • fiveruns-penn-and-teller-9
  • ye old scroll of shameful tunes

See more FiveRuns tagged photos…

Other Categories

Entries are also organized under the following general topic categories.