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

cleaner416 cleaner416 at gmail.com
Fri Sep 7 17:26:08 EDT 2007

Thanks, Terry.  That's very helpful.

On Sep 7, 2007, at 4:01 PM, Reese, Terry wrote:

> So we had some similar problems related to running our rails  
> application using either memcache or an sql-based sessioning  
> solution using a number of mongrels with Apache's balancer.  In the  
> end, I think the problem we had was related to a race condition  
> when setting session data between ajax calls.  On the rails trac  
> instance, there has been a plugin developed for these types of  
> conditions called smartsessionstore.  It works with the sql_session  
> plugin, meaning your sessioning will be sql based so not quite as  
> fast as memcache, but I'm not sure if the difference is actually  
> noticable to users.  Here's the link: http://www.texperts.com/ 
> 2007/05/01/race-conditions-in-rails-sessions-and-how-to-fix-them/
> --TR
> From: mongrel-users-bounces at rubyforge.org [mailto:mongrel-users- 
> bounces at rubyforge.org] On Behalf Of cleaner416
> Sent: Friday, September 07, 2007 10:37 AM
> To: mongrel-users at rubyforge.org
> Subject: [Mongrel] memcached and fragment storage,session storage  
> with a mongrel cluster
> Greetings,
> 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 app.
> I searched around a bit and simply added two lines to my
> development.rb:
> 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
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users

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

More information about the Mongrel-users mailing list