8

I'm trying to understand how load balancing works. I have read the basics however I don't understand how a load balancer doesn't go down because of all the traffic.

Lets say I have 1 load balance server and 3 regular servers. The 3 regular servers have different ip addresses. The load balancer divides the traffic between the 3.

If the load balancer acts as a 'reverse proxy' in a sense, how can it handle all the traffic, since one web server couldn't as 3 are needed.

I know you could have multiple load balancers. but how does a load balancer not suffer from an accidental DDOS attack if all the traffic is going through this 1 server.

Thanks in advance.

0

1 Answer 1

9

The load balancer isn't doing anywhere near as much processing as each one of those backend servers.

It's possible to DDoS a load balancer, the same way it's possible to DDoS any other server, but the load balancer itself is really just checking the "Host: " header, and / or handling the SSL sessions (assuming you're also using the load balancer as the SSL endpoint), whereas the actual app servers need to handle the app logic, read from the drive, the database, etc.

If the app servers were just serving the same string for every connection, then yes, the load balancer would be kind of pointless.

Interestingly, some load balancers don't even need to check application-level requests. Thanks to Direct Server Return (DSR), you can load-balance at the IP level. This has advantages and disadvantages; on the one hand, application acceleration techniques (such as SSL session handling) cannot be done at an IP-level load balancer. On the other hand, the load balancer doesn't need to serve response packets (except for, perhaps, ICMP), so it doesn't really need much outgoing throughput, and (as before) it only needs enough incoming throughput to handle incoming application traffic.

Then again, if you're really dealing with an enormous amount of traffic, you can employ all these methods simultaneously; you can use DNS to distribute load across clusters, each cluster can have an IP-level reverse proxy backed by application-level reverse proxies.

5
  • Perfect, thanks. So do load balancers usually have a high download/upload speed connection?
    – Simon
    Commented Aug 3, 2015 at 23:26
  • @Simon Well, with most servers, you'll want more outgoing throughput than incoming, because the majority of requests will be relatively short in proportion to the length of responses. So yeah, you'll want your load balancer to have a relatively high-throughput pipe, at least for outgoing traffic. Of course, as you mentioned, there's also more to load balancing than just using a load balancer; it's useful to have multiple IPs per domain, and it's useful to be able to have some control over your own DNS infrastructure, so you can respond to a DNS request with the IP of the closest reverse proxy. Commented Aug 3, 2015 at 23:35
  • 1
    @ParthianShot The outgoing traffic doesn't even have to go through the load balancers. You can have traffic from the client go through the load balancer on the way in but the traffic go directly from server to client on the way out. This is known as DSR and can reduce the load on the load balancers.
    – kasperd
    Commented Aug 4, 2015 at 22:38
  • @kasperd Nice! Hadn't thought of that. I suppose you'd still need to use the same IP address, and do some deep magic at the perimeter routers, or generate a redirect. Commented Aug 4, 2015 at 23:26
  • Oh- wait... I was imagining a handoff situation, like a server-facilitated TCP hole punch between two peers. But it just takes advantage of destination-based routing, so all incoming packets must go through the load balancer, regardless of session info. Still, cool. Commented Aug 4, 2015 at 23:35

Not the answer you're looking for? Browse other questions tagged .