Unicorn, Rails and Memcached
normalperson at yhbt.net
Tue Jan 5 17:34:45 EST 2010
Stefan Maier <stefanmaier at gmail.com> wrote:
> I am running unicorn with rails and memcached. The combination usually
> works flawlessly but sometimes when I retrieve an item from memcached i
> get a different, unrelated item.
> At the moment I'm more or less investigating in all directions and after
> I thought that maybe the forking nature of unicorn has something to do
> with it.
If you're using "preload_app true" in your config file, then all the
gotchas from Passenger with sharing memcached sockets across processes
apply to Unicorn as well.
> So, are there any steps you have to take to ensure unicorn works with
Which memcached library are you using?
I believe some memcached libraries will delay opening a socket until
it's actually needed (inside the worker processes), but if you use
memcached in your app initialization code, then the socket will be
opened in the master process (which is bad).
So the safe thing would be to reconnect to your memcached servers in the
More information about the mongrel-unicorn