2

We are a company running a website with ~800k unique visitors each month with a constant growth rate of 35-40%. We have just gone from having one server to a dedicated mysql database and an nginx+passenger front end server. We're hitting the next bottleneck after being fine for a little while and are thinking of scaling horizontally by adding a load balanced front-end server solution (We measured the font end to be the bottleneck). The files are obviously located on the single front end server we have now.

What is the best option for keeping the files for the site synced between 2 front end servers? I have googled quite a bit and someone recommended "rsync". The only problem I have with that is the gap you get when the cron job didn't run for a while. Our content updates often and we promote it on the front page. Another solution seems to be NFS and mount up the files to the second front end server as well. Any problems with this solution? Any recommendations are welcome.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
miccet
  • 131
  • 5

1 Answers1

1

We run shared web host with a replicated file system AFS, and it works reasonably well for us (for certain definition of "reasonably well.") Things to watch out for:

  • Running a network filesystem server is a nontrivial amount of system administration, especially if you want to do it well (for example, replicate your fileservers for high availability.)

  • You lose the ability to do certain filesystem operations (for example, fine-grained locking and inotify watches.) If you have a pretty ordinary website, this is not a problem, but something to watch out for (we've certainly been hurt by lack of an inotify, for reloading FastCGI applications).

  • If you are using file-based session handling, you need to make sure you either make sessions sticky to one server, or make sure these sessions get replicated. This is more of a "now I have multiple front-end servers" than a network filesystem issue.

  • Tune your cache parameters carefully. They can make or break your application.

  • NFS's security model is very stupid, so you probably want to route it over a secure backend network.

Obviously, the complexity increases a lot when you do this. Good luck.

Edward Z. Yang
  • 406
  • 3
  • 8