Reputation: 6111
I was asked in Interview and really confused on answer for below Question.
If say some site is getting 500 requests per second and the mechanism they handle to solve large number of hits is through Load Balancer.
In above case, all the request will first go to Load Balancer, it is then Load Balancer responsibility to pass on request to actual server which will give the response.
So Load Balancer is the entry point for all request and it too have some capacity to handle the request? So how much request Load Balancer can accept and if it accept upto some limit then how system works in such case?
I am sorry if my Question is meaningless, Please explain?
Thanks.
Upvotes: 1
Views: 269
Reputation: 795
I would say that if the amount of connections rise up to the limits of the Load Balancer entry point, then you can implement a DNS level balancing (If name resolution is used in the requests). Each request will be driven (e.g. "round-robined" ) to different entry point thanks to the DNS resolution which is the responsible of switching among different resolutions for the same name in the requests, and sending those requests to different Load Balancers or directly to different servers (latter one, would imply a different LB technique).
But the 500 requests per second shouldn't be a problem for a server responsible of balancing. HAProxy can handle thousands of requests/second without problem, driven different sessions to different servers, or also keeping active sessions distributed in different servers.
HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for web sites crawling under very high loads while needing persistence or Layer7 processing. Supporting tens of thousands of connections is clearly realistic with todays hardware.
Upvotes: 0
Reputation: 9055
A load balancer is usually running a lightweight event based HTTP server (NginX, for example) that maintains a connection to a backend server for each incoming request.
A popular setup is:
NginX
| \
| \
Apache Apache ...
Since NginX can handle a lot more connections and has a fairly predictable memory usage pattern, it can usually be used as a frontend for several Apache backend servers (running PHP, Python, Ruby, etc).
Replace Apache with Tomcat/Jetty/insert your favorite servlet container here and the same logic applies.
The main point here is that your backend servers are usually doing something a lot more time consuming (Running some scripting language, querying a DB, etc) that it is more than likely that each backend server is not bottlenecked by its HTTP server component but rather by the application logic.
There is no one size fits all solution to these kinds of problems. Another solution (amongst many), once you outgrow the capacity of a single load balancer machine is to use DNS round-robin between several balancers supporting several backend servers.
Upvotes: 2