cleaner416
2007-Sep-06 21:48 UTC
memcached and fragment storage, session storage with a mongrel cluster
Greetings, 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 performance gain. 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. 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2007-Sep-06 23:11 UTC
Re: memcached and fragment storage, session storage with a mongrel cluster
> Greetings, > > 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 performance gain. > > 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. 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.2I don''t know the specific answer, but it might be a memcache key prefix issue. You can set a namespace for memcache and it will prefix every key with that. Perhaps with what you have above the prefix is using something unique to each mongrel instance (like it''s pid or port). Not a fix, but maybe will help guide you... good luck. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---