Abstract
- A Reverse Proxy (反向代理) that does Load Balancing
- 2 types Application Load Balancer and Network Load Balancer. The example above is an External Application Load Balancer
Failover Capability
If one server goes offline, all the traffic will be routed to other servers by Load Balancer. This prevents the website from going offline or the downtime incurred by spinning up a new server.
We will also add a new healthy web server to the server pool to balance the load. Thus making the system Fault Tolerance (容错性).
It is good to have multiple load balancers if we want to eliminate a single point of failure.
Scalability
If the traffic grows rapidly, and current set of servers are not enough to handle the traffic. We only need to add more servers to the server pool, and the Load Balancer automatically starts to send requests to them.
Load-balancing Strategies
Round-Robin Load-balancing
- Load Balancer distributes incoming requests equally among the available Server in a circular order. Simple and straightforward
- Usually the default load-balancing strategy, for example in AWS ALB
Weighted Round Robin Load-balancing
- Similar to Round-Robin Load-balancing, but Server are assigned different weights. Servers with higher weights receive more requests than those with lower weights
- This is commonly used in A/B Testing
Least Connection Load-balancing
- Sends requests to Load Balancer with least active connections
Terminologies
Sticky Session
- Also known as session affinity or session persistence
- Refers to the practice of directing a Client’s requests to the same Server consistently for the duration of a session or user’s interaction