加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

澄清Nginx和所需的负载平衡

发布时间:2020-12-13 20:54:23 所属栏目: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

我现在正在阅读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映射到Elastic Load Balancer,它执行两件事:将流量平均地路由到三个NGINX负载均衡器,并且为所有流量提供SSL.然后,NGINX服务器充当堆栈下方的内容/应用程序服务器的负载平衡器.使用ELB代替轮询DNS意味着他们可以添加/删除/更新附加到ELB的实例,而不必担心DNS更新或TTL.

至于第二个问题,您可以像使用HAproxy或其他服务一样容易地使用NGINX进行负载平衡.我敢肯定,选择NGINX对Instagram的吸引力在于它的惊人速度,并且它是异步的并且是“事件驱动的”,而不是像Apache2这样的线程.正确设置后,可以减轻重物下的头痛.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读