How does a typical http(s) load balancer work?
I know that there are some situations that we encounter heavy http(s) load on a server and we should use a load balancer to distribute load among several back-end servers.
But I've a confusion here! Lets suppose that too many users (lets say 100,000) are trying to access simultaneously to example.com:80
and a load balancer (e.g Apache mod_proxy_balancer
or any other stand-alone load balancer) wants to distribute this load among several back-end servers, but still all traffic has to be passed across the front-end server which brings about a heavy traffic on that server & even though all the requests are parsing at back-end servers, front-end server still have to manage them (suppose that in best case it has to create a single unique thread for every request which causes this server simply crash after creating 100,000 threads at a moment!).
Now my question (that may sounds funny to an expert!) is that how a load balancer can handle such situation? In other words, how front-end server can establish a link directly between clients & back-end servers without having to tolerate such heavy network load? (I know in this situation we can't call back-end servers really 'back-end'! but assume that its OK for now) Does this scenario need any application-specific alter? (e.g. in order to simply redirect clients with http Location
header to other servers)
Solution 1:
This depends on the purpose of the load balancer i.e. what type of workload it's supposed to balance. The reverse proxy based HTTP(S) load balancers are distributing the load between application back-ends generating the content.
Reverse proxies are not trying to balance network load, and compared to all the tasks dynamic applications do, passing network traffic (and possibly serving static content) is a relatively simple task.
For example, database access can be load balanced, too. Most of the database queries involves only reading from the database, so while writes needs to be replicated immediately across all the database servers, reads can be distributed evenly.
Network load balancing is a different area. For example, one common method for balancing (network) load between cluster servers is round-robin DNS records, where the same hostname simply has more than one A
records.