Load Balancer
Inspired by Google system design interview: Design Spotify (with ex-Google EM)
Single point of contact for user requests.
It does health checks for all servers to know if some have issues.
Distribution:
- Round Robin: simple and sequential
- IP hashing: allows the same user to go to the same server
- Least connections: uses servers that have more capacities first
If you have a single load balancer, then you've created a single point of failure again.
There is usually at least one passive load balancer that can take over if the active one fails (todo something something active/passive replication)
They do health checks to servers to know if they can use them.
Benefits
- services do not have to worry about customer facing issues (rate limiting, https)
Metrics to split requests
Could be metrics to handle scalability and how many servers are needed too.
- open connections
- CPU
CPU is not often a good one, depending on the service, especially if it's mostly waiting on a database for example
Sources
- Google system design interview: Design Spotify (with ex-Google EM) inspired this note
Referenced by
- Forward proxy vs Reverse proxy vs API GatewayEstablished
Forward proxy: next to the client before reaching internet. Reverse proxy: server side to go to the right server. API gateway: reverse proxy that does more than routing. it handles auth, rate…