Well, I'd like to hear how that goes too. I'll eventually get a memcached setup going so I'll report back on that too.
Thanks Raul... I noticed that memcached had the ability to do that. I'm a little afraid to use memcache with my first large rails deployment.. and I'm not sure our servers are beefy enough.
I think I may make a new model of items to remove from the cache and just stick in the full path... Then on each server just have a small perl daemon running that monitors the db for new items to remove...
OK, after a little research the solution appears to be memcached. I haven't implemented it yet but there's a recipe for it in the "Rails Cookbook":http://www.oreilly.com/catalog/9780596527310/ that clearly shows how it can utilize the memory on multiple servers for caching. Also, the "Cache_fu plugin":http://errtheblog.com/posts/57-kickin-ass-w-cachefu looks pretty choice as well to simplify things. There's definitely some administrative overhead and some code changes that comes along but it doesn't seem too intense.
I will eventually be trying this route. When I do I'll post back.
I have been struggling with the same issue. I am going live with an app spread out over 4 servers next month and this is one of the last things on my todo list.
Asked over here as well and go no replies: http://railsforum.com/viewtopic.php?id=15952
At this point its either...
Put cache on NFS share between all 4... (not good) Rsync the cache dirs (I was left with some crazy rsync stuff and its not that pretty) Another model with items to expire.. all servers run some sort of rake task to read this model and expire data.
I also got ideas for several other hacky solutions.. but haven't started on anything yet and nothing seems like the "correct" way to do it...
Anyone else on this? Perhaps the sweeper at Server_B could call a rake take on Server_A?
Love some advice!
This is a great question. I've got 6 production servers and I played around with caching during development, but now that I've gone live I have sweeper tests on my todo list but I haven't yet gone forward on that. I've been really anxious to find out about this very thing though so if time permits tomorrow I will give it a go and update this thread. It's just a single MySQL database server but 6 front end web servers packed with mongrel clusters. I'm hoping sweepers will work across servers otherwise I'll have to implement a shared location for caching. Boo!
The plan: I am building out my architecture with a standard nginx front and multiple app servers behind, with each app running a mongrel cluster.
The situation: I currently employ caching (mixture of different sorts (page, fragment, etc..), and I use the standard Sweeper methodology to expire cache.
The question: Once I have multiple servers, how will the sweeper on instance Server_A.mongrel_L know to expire cache when a new object was created using instance Server_B.mongrel_M?
Hoping this question makes sense!
(The only idea I can think of is to have a shared public directory, perhaps housed on the same machine housing nginx?)
[note: the PragPro beta of 'Deploying Rails Apps' is fantastic, but does not cover this issue]