Shared DocRoot For Redundant Web Servers

Events happening in the community are now at Drupal community events on www.drupal.org.
nerdcore's picture

I have setup an AWS Virtual Private Cloud (VPC) with Public and Private subnets, and thought it would be a good idea to place a large filesystem attached to an NFS server in the Private portion of my VPC for the purposes of sharing a common DRUPAL_ROOT directory across multiple web server instances in the Public subnet. The web servers are hit in a round-robin fashion as defined in my Varnish config, sitting on its own EC2 Instance in front of the web servers.

After the load started to increase over the course of a couple of days, all of a sudden my Apache instances became unavailable due to a "Stale NFS file handle".

I'm unsure of the options here. I've contacted AWS Support and they sent me back a cryptic email describing the use of S3 for these purposes. I don't know how to make sense of this:

"Amazon S3 is similar to another web host (imagine it is just a simple web service that can have objects stored on it). Other AWS users use Amazon S3 to store files just like you are storing, as well as use Amazon S3 as a place to upload new files, serve files to their end users (downloads).

When building your application alongside and with Amazon S3, you can minimize what objects you place onto your web servers and application servers.

For a PHP-driven DocumentRoot, Amazon S3 can definitely be useful."

Should I abandon NFS in favour of S3? What are the limitations or drawbacks of these options? Are there other options I have not even considered?

Any advice greatly appreciated.

Comments

no no no s3! docroot is best kept locally

tripper54's picture

Trying to store your codebase on s3 will lead to all sorts of performance issues.

You're best off storing docroot locally on each web server instance. If you're autoscaling, a startup script on your AMI can pull down your codebase from a central store of some kind.

In my experience it's best to use an NFS server to store your files directory only.

You may consider Maginatics MagFS?

braimond's picture

It will allow you to build a distributed file system on top of S3, without the performance penalties of using S3. I'll be happy to walk you through the configuration and validate that it fits your needs. If interested, please contact me at braimond@maginatics.com.

This is why we have AMIs

thatoneguy's picture

We use AMIs that have Drupal installed locally. Updates to the code base are handled by updating the AMI itself, updating the database, and destroying/recreating instances. This lets us use autoscaling quite nicely. NFS for a docroot is a horrible performance bottleneck. NFS for the sites/*/files directories might be better, but we actually use the Amazon S3 module, slightly modified (we leverage instance profiles rather than putting keys in the database).

Amazon Web Services (S3, EC2)

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: