nginx之需要澄清 nginx 和负载平衡
我现在正在阅读 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 服务器轮流将请求重新发送到集群?
第二个问题是。 nginx 和负载均衡器有什么区别。为什么我们不能改用 nginx?
请您参考如下方法:
对于你的第一个问题,我相信答案似乎是 Instagram 现在使用 Route53 将 DNS 映射到弹性负载均衡器,它做两件事:将流量相当均匀地路由到三个 NGINX 负载均衡器,并为所有流量提供 SSL。然后,NGINX 服务器充当负载均衡器到堆栈更下方的内容/应用程序服务器。使用 ELB 而不是循环 DNS 意味着他们可以添加/删除/更新附加到 ELB 的实例,而无需担心 DNS 更新或 TTL。
至于第二个问题,您可以像使用HAproxy或其他服务一样轻松地使用NGINX进行负载均衡。我确信 Instagram 选择 NGINX 的部分吸引力在于它令人难以置信的速度,并且它是异步和“事件驱动”的,而不是像 Apache2 那样线程化。如果设置正确,这可能意味着在重负荷下减少头痛。
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。



