On Mar 25, 2008, at 6:45 AM, Jeff wrote: > > Does anyone have a preferred way of doing page/action caching across > multiple machines? I know with fragment caching you can use > memcached. But page caching usually goes in the document root, so it > is not usually in a shared directory. > > I saw one suggestion which was to change the page cache directory to / > public/cache, and then modify the Apache re-write rules to check for > static content in /public first, and then /public/cache second. But > that seems klunky. > > Another crazy idea I heard was to possibly NFS/GFS mount the entire > application directory, and then your second application machine has > everything shared with the first one. (Only PID file locations would > need to be kept separate.) > > Does anyone have any experience or preferred methods on this? There > is suprisingly little documentation on scaling Rails to multiple > boxes. > > thanks, > Jeff > > co-founder, cto > www.patientslikeme.com
We use GFS to share a /data partition between multiple servers. The rails apps and assets + page caches are available in a consistent way across multiple boxes this way. It works very well. GFS has context dependant symlinks so you can have private directories for pid and log files on each machine even though they all write to the same path. I must warn you that getting GFS and red hat cluster suite setup and working properly is a battle though and took us a long time to get completely stable, in the end it's totally worth it though. Another option if you don't have a SAN is to use memcached for your page caches and use the memcached module in nginx so nginx will hit memcached first for cached pages and if the cache misses it will fall back to your rails app which serves the page and stores it in memcached. You use the uri for the memcached key. This is much easier to setup than GFS, but GFS performs much better than memcached for page cached pages in our test. On one of our larger clients clusters we are able to get 25kreq/sec for a GFS page cache and only 8kreq/sec for a memcached page cache. Still both perform very well so it's just a matter of how much time you want to spend getting things set up. Of course all engineyard slices come with GFS and SAN storage ;) Cheers- - Ezra Zygmuntowicz -- Founder & Software Architect -- [EMAIL PROTECTED] -- EngineYard.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Deploying Rails" group. To post to this group, send email to rubyonrails-deployment@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-deployment?hl=en -~----------~----~----~----~------~----~------~--~---