我在浏览 Uber Engineering 网站时看到了这一段,它让我很困惑,如果有人能为我解释清楚,那么我将非常感谢他/她:
The Edge The frontline API for our mobile apps consists of over 600 stateless endpoints that join together multiple services. It routes incoming requests from our mobile clients to other APIs or services. It’s all written in Node.js, except at the edge, where our NGINX front end does SSL termination and some authentication. The NGINX front end also proxies to our frontline API through an HAProxy load balancer.
NGINX 已经是一个反向代理 + 负载均衡器,那么 HAProxy 负载均衡器从哪里来,又到底在哪里呢?他所说的“边缘”是什么?要么是写他的人写了一些困惑的单词,要么是我不懂英语。
请帮忙。
最佳答案
看起来他们严格使用 HAProxy 作为负载均衡器,并严格使用 NGINX 来终止 SSL 并进行身份验证。在大多数情况下,没有必要将 HAProxy 与 NGINX 一起使用,正如您提到的,NGINX 具有负载均衡功能,但作为 Uber,他们可能会遇到一些需要同时使用两者的独特问题。根据我看过的资料,比如http://www.loadbalancer.org/blog/nginx-vs-haproxy/和 https://thehftguy.com/2016/10/03/haproxy-vs-nginx-why-you-should-never-use-nginx-for-load-balancing/ ,NGINX 作为 Web 服务器运行得非常好,包括它用作 Node 应用程序的反向代理的用例,但它的负载平衡功能是基本的,并且性能不如 HAProxy。此外,HAProxy 公开了更多的监控指标,并具有更高级的路由功能。
负载均衡不是NGINX的核心功能。在 Node.js 应用程序的上下文中,通常您会看到 NGINX 用作反向代理,这意味着 NGINX 是 Web 服务器,http 请求通过它来。然后,根据主机名和其他规则,它将 HTTP 请求转发到您的 node.js 应用程序运行的任何端口。作为此流程的一部分,NGINX 通常会处理 SSL 终止,因此这个计算密集型任务不会由 Node.js 处理。此外,NGINX 通常用于为 Node.js 应用程序提供静态 Assets ,因为它更高效,尤其是在压缩 Assets 时。
关于node.js - NGINX、边缘、HAPRoxy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55476114/