从最基本的层面来说,负载均衡由三个主要组件构成:
- Pools(存储池):包含一个或多个端点。
- Endpoints(端点):响应单个请求的服务器或节点。
- Load balancer(负载均衡器):决定哪些流量分配给各个存储池。
通常情况下,发送到你的应用程序的请求会直接流向各个独立服务器。
在使用负载均衡器后,请求首先经过负载均衡器。随后,负载均衡器将请求路由到指定的存储池。
flowchart LR
accTitle: 负载均衡流程
accDescr: 负载均衡涉及负载均衡器、池、端点、监控器和健康检查。
B[请求 1] --> A
C[请求 2] --> A
D[请求 3] --> A
A[负载均衡器] -- 请求 1 --> P1
A -- 请求 2 --> P2
A -- 请求 3 --> P3
subgraph P1 [池 1]
Endpoint1((端点 1))
Endpoint2((端点 2))
end
subgraph P2 [池 2]
Endpoint3((端点 3))
Endpoint4((端点 4))
end
subgraph P3 [池 3]
Endpoint5((端点 5))
Endpoint6((端点 6))
end
在每个存储池内部,请求随后被推送到具体的端点。最后由该端点对请求做出响应。
flowchart LR
accTitle: Pool traffic flow
accDescr: When an incoming request reaches a pool, it then goes to an endpoint within the pool.
A[Request 1] --Routed by pool--> Endpoint2
subgraph P1 [Pool]
Endpoint1((Endpoint 1))
Endpoint2((Endpoint 2))
end
从 负载均衡器 --> 存储池 --> 端点 的这一递进流程是负载均衡器工作原理的核心部分。