[Mongrel] memcached and fragment storage, session storage with a mongrel cluster

cleaner416 cleaner416 at gmail.com
Fri Sep 7 13:37:06 EDT 2007


I posted this not on the Rails mailing list and didn't get a definitive
response so I thought I'd post it here, since I figure lots of you  
are using
mongrel with Rails apps. Any suggestions would be greatly appreciated.

I've been using file-based fragment caching and DB-based session
caching quite extensively.  I decided to try out memcached for both to
see if I could achieve a meaningful performance gain for a particular  

I searched around a bit and simply added two lines to my

config.action_controller.fragment_cache_store = :mem_cache_store
config.action_controller.session_store = :mem_cache_store

(I also changed config.action_controller.perform_caching = true for
testing )

This works like a charm on my development box.  (Mac) I've got  
memcached -vv
running in another terminal window I can see it doing it's thing.

However, as soon as I tried this on my production box, (by adding the
above lines to production.rb) I ran into some odd problems.   My
production setup is pretty vanilla: Apache 2.2 load balancing to a
couple of mongrel instances via mongrel cluster on a fedora core 5
box.   It seems as if a memcache pool is being created for each
mongrel instance, instead of the app.  Is there some other kind of
config I need to do in production.rb?  The stuff I've found via
googling seems to apply to Rails < 1.2

Thanks much

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20070907/308447f3/attachment-0001.html 

More information about the Mongrel-users mailing list