0

I have decided to scale a service and added load balancing using NGINX upstream.

My Setup

upstream main {
  server example1.com:8909 weight=1;
  server example2.com:8909 weight=1;
  ...
}

server {
  listen 80;
  server_name example.com;
  location / {
    proxy_set_header Host $host;
    proxy_pass  http://main;
  }
}

And Apache2 handles the request on each server. The load balancing server also houses an apache instance, the code and the main database (they will move eventually).

The code folder (/var/www/) is shared as nfs on the network. Also the other servers access the database remotely.

When I access, only when i hit the server housing the loadbalancer and database that it is instant. When I hit any other server it takes like 5-8 seconds to load.

Note: The hosting service does not support private ip, so they are all on public ip for now

0

I was considering deleting the question but in case it helps someone who has the same problem.

I am hosting my website on digitalocean.com and turns out they don't support private Ip yet. So when creating my new cluster of servers I added it by mistake in a different data center. ( the ping was returning 75ms response as opposed to the less than 1ms they promised). As soon as I realized that and moved my application the same data center the site speed was back to normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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