r/AskComputerScience • • Nov 23 '24

Scaling LB

For making highly scalable, highly available applications - applications are put behind a load balancer and LB will distribute traffic between them.

Let say load balancer is reaching its peak traffic then what ? How is traffic handled in that scenario.

3 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/meditonsin Nov 23 '24

Also Anycast.

1

u/teraflop Nov 23 '24

Anycast can be part of the solution, and it works great for stateless datagram-oriented protocols such as DNS.

But to use anycast with TCP, you also need to ensure that whenever packets addressed to the same LB IP get routed via anycast to different LB instances, those instances route packets in exactly the same way to the same backend. Otherwise, the backend won't be able to keep track of the TCP connection state and the connection will just get dropped anyway.

The straightforward way to do this is using consistent hashing, e.g. as implemented in Google's Maglev.