How to load XMLHttpRequest?

How does load balancer actually work?

  • I understand that load balancer get a request and send it over to one of it's nodes. The reason to use load balancer is because one node can't process all the requests. but how come the load balancer can process all the requests? Let's say it can process all the requests because it much more light, it only forwards the requests to one of the node.. More importantly: I guess that the load balancer has its own limit? what happen when the load balancer reaches this limit? you can't put a load balancers in front of cluster of load balancers because you will meet the same problem... What do I miss?

  • Answer:

    Load balancers will usually fall in one of the following categories.   1. Application level load balancers: They operate at the application layer. They are a lot slower than the load balancers that operate at the lower layers   2. L3 load balancers: They operate at the IP level. They are faster than application level load balancers.   3. L2 load balancers: They operate at the TCP level. They have lesser overhead and are really fast.   Your statement about load balancers having a limit is absolutely true. The limit depends upon how the load balancer is implemented. Application layer load balancers usually have a lower max connection limit because they operate at a higher level and hence they have a higher overhead. The lower level load balancers have a higher max connection limit because they have lesser overhead; for example, they do not have to maintain TCP sessions. Another question that you had was about hierarchical load balancing. Yes, quite a few companies do that. In fact, when I used to work at Yahoo!, we did do hierarchical load balancing. The max connection limit of the load balancers totally depends on how connection management is implemented and what mode the load balancer is running in. Watch the video http://www.a10networks.com/elearning/002-Four_SLB_Modes.php to get more insight about the different load balancing modes. EDIT: Since the person who asked this question still wanted some more clarification, I will try and explain things with an example below. Let's say I have a website and for the sake of simplicity, let's consider that it serves only static pages. Initially, I begin with a single server. Let's say the capacity of this server (I will talk only in terms on max connections that the server can handle) is X connections per sec. After a few days of launch, my site goes viral and I am pretty sure I will hit the number X very soon. What I decide to do is add another server which can also handle X number of connections. Now, I have twice the capacity and I can now distribute the load. I realise that in the next couple of months, my website will get a LOT of traffic so I buy a hardware load balancer which can support Z (where Z is a LOT greater than X)  max connections per sec. After a couple of months, I hit the 2X limit very easily and I add more and more servers behind the load balancer. All of this works out really well for me and I soon realise that the we are now close to hitting Z connections per sec. For my site to take that much traffic, I decide that I can add more servers but I need one more load balancer. I buy one more, add more servers behind it. So now I have 2 load balancers and I have to make them both live - what to do? One option is to use DNS based load balancing. I can associate the domain name with both the load balancers and the DNS server will route requests in a round robin manner. Of course, the DNS servers should be able to handle the load (requests) coming in. One can also use a cluster of software based load balancers (not sure if you can achieve it with hardware load balancers). There has been much research into how to do hierarchical load balancing (search google for Hierarchical Load Balancing) but if it's only websites that you want to scale, there are other ways. You can divide you website into certain components like - assets (javascript, css files, images) and content (the actual html pages that contain assets and content). You can host the assets behind a separate set of servers which themselves are load balanced while the content can be hosted behind a separate set of servers. Effectively, you have distributed the traffic into silos and hence you can still scale your website.

Nikhil Singh at Quora Visit the source

Was this solution helpful to you?

Other answers

The load balancer does not actually "process" the requests. To "process" in this context means to do some CPU or I/O work, which is potentially time consuming - and that's the reason why a single machine might not be able to handle all the requests. However, the load balancer just forwards the requests to the backend machines, which actually "process" the requests, receives the responses from the backend machines and sends them back to the client. So in a sense, the LB is like a gateway, passing the requests/responses to the correct guy. In response to the second part of your question, yes, the load balancer will have its own limit in terms of worker/acceptor threads, which are essentially limited by its CPU/memory capabilities. Since its sole job is to be a gateway, it can handle (i.e. forward) far more request/response pairs than a single backend machine can.

Hrishikesh Barua

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.