On Thu, 5 Apr 2007 03:34:50 -0500
"Rob Sanheim" <[EMAIL PROTECTED]> wrote:

> 
> So for page caching across a cluster, or static resources in general
> w/ a rails cluster, is NFS a bad idea?  I've read a lot of posts where
> folks talk about how unreliable NFS has been in the past, and it has
> issues with locking and what not.  My company has had issues as well
> when servers are restarted and have issues reconnecting to the NFS
> mount.

In most of the cases I've seen people using NFS they tend to run into
problems either with reliability or with overloading traffic.  On the
reliability end, they expect NFS to work transactionally for reads and
writes of entire files, or expect the locks to work flawlessly.  With
overloading traffic it seems they expect NFS to take less traffic than
HTTP (partially true) but then slam tons of file reads/writes over NFS
and HTTP at the same time.  In some cases I've seen people effectively
send the contents of a file 3-4 times over the network for each single
HTTP request.

I'm sure other people could chime in with their setups, but the only
configuration I've seen work reasonably well is the following:

1) Setup a "static server" that has an NFS mountable and writable
directory.
2) This static server then has a fast as hell HTTP server (nginx works
well) that reads the files in this mountable directory straight off the
disk NOT OFF NFS.
3) All of the rails backends then write to the NFS mount to put the
asset onto the static server, and write their URLs to point at
this new static asset URL instead of the rails URL or do a redirect.

This works best for assets that you can classify and which aren't going
to change often.  The key is that you've written the asset fully BEFORE
you send the response that the client uses to read the asset.  If you
try to do it in parallel then the client could end up reading a
partially written asset.

There's also problems with this NFS usage potentially stopping a
Mongrel server if NFS has problems writing the file.  I actually don't
advise NFS, so you can also try other options like Samba, Lustre, CODA,
etc.

-- 
Zed A. Shaw, MUDCRAP-CE Master Black Belt Sifu
http://www.zedshaw.com/
http://www.awprofessional.com/title/0321483502 -- The Mongrel Book
http://mongrel.rubyforge.org/

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to