我现在正在阅读Instagram的设计,我发现了它们的负载平衡系统的描述.
Every request to Instagram servers goes through load balancing machines; we used to run 2 Nginx machines and DNS Round-Robin between them. The downside of this approach is the time it takes for DNS to update in case one of the machines needs to get decomissioned. Recently,we moved to using Amazon’s Elastic Load Balancer,with 3 Nginx instances behind it that can be swapped in and out (and are automatically taken out of rotation if they fail a health check). We also terminate our SSL at the ELB level,which lessens the cpu load on Nginx. We use Amazon’s Route53 for DNS,which they’ve recently added a pretty good GUI tool for in the AWS console.
问题是.我说的对吗,现在他们有一个DNS服务器,该服务器使用RR来决定在哪个Nginx服务器上发送请求.每个Nginx服务器又将请求重新发送到集群吗?
至于第二个问题,您可以像使用HAproxy或其他服务一样容易地使用Nginx进行负载平衡.我敢肯定,选择Nginx对Instagram的吸引力在于它的惊人速度,并且它是异步的并且是“事件驱动的”,而不是像Apache2这样的线程.正确设置后,可以减轻重物下的头痛.