Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've recently been inspired by a blog post from AudioBox highlighting some of their experiences with Amazon EC2 and why they switched over to a self-managed VPS. While the EC2 services certainly look useful, they seem a bit pricey for something I aughta be able to setup on my own.

This is uncharted territory for me, but I'm learning fast. After a bit a finagling, I managed to setup a simple network with a single load balancer running on Nginx, a database server, and two backend servers. And I'm using chef recipes to provision all these nodes on demand. Here's my very basic nginx.config to make this all work:

upstream backend {

server {
   listen 80;

   location / {
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Real-IP  $remote_addr;
       proxy_set_header Host $http_host;
       proxy_redirect off;

       if (!-f $request_filename) {
         proxy_pass http://backend;

One of the backend servers is sitting in EU, and everything else is sitting in a New York datacenter currently. I'm wondering how do I account for network latency? For instance, is a customer in the EU always going to have to go through my load balancer in New York in order to reach my EU backend? Should I add an additional load balancer and database server to my EU backend to further reduce latency for EU customers? And how do I ensure that requests are always routed to the closest available node?

Bonus Question

While my current setup works, it's only because I managed to MacGyver together snippets here and there from various blog posts and such. I don't really have a clear understanding as to how all these concepts fit together. Are there any good resources out there describing this paradigm I can refer to along my journey?

share|improve this question

On your upstream you can set a brunch of directives regarding this based on latency, priority and so on ;-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.