Memcached and fragment storage, session storage with a mongr

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

config.action_controller.session_store = :mem_cache_store
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

I 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.