Needs nginx refinement and load balancing

Now I am reading Instagram design and I found this description of my load balancing system.

Every request to Instagram's servers goes through load balancing machines; we used to run 2 nginx machines and DNS Round-Robin between them. The disadvantage of this approach is the time it takes to update DNS if one of the computers needs to be decomposed. Recently, we have switched to using Amazons elastic load balancing with triple NGINX instances that can be swapped out and disabled (and automatically disabled if they fail the health check). We also terminate our SSL at the ELB level, which reduces the CPU load on nginx. We are using Amazons Route53 for DNS, which recently added a pretty good GUI tool to the AWS console.

Question. Is it correct that at the moment they have a DNS server that uses RR to decide which nginx server to send the request to. And each of these nginx servers in turn passes the request to the cluster?

And the second question. What's the difference between nginx and a load balancer. Why can't we use nginx?

+3


source to share


1 answer


For your first question, I believe the answer seems to be that Instagram is now using Route53 to map DNS to an elastic load balancer, which does two things: it routes traffic fairly evenly to three NGINX load balancers and exposes SSL for all traffic ... The NGINX servers then act as load balancers for the content / application servers further down the stack. Using ELB instead of circular DNS means they can add / remove / update instances attached to ELB without ever worrying about DNS or TTL updates.



As for the second question, you can use NGINX as easily as HAproxy or other load balancing services. I'm sure part of the appeal to Instagram when choosing NGINX is its incredible speed and that it's asynchronous and "event-driven" instead of streaming like Apache2. When set up correctly, this can mean fewer headaches under heavy loads.

+2


source







All Articles