We have a web application which runs on a cloud of webservers. In the evening the web application is used mostly from our local office which uses a NAT to connect several machines to the internet. Requests to the webapp go from the client PC's through the NAT, over the internet, through a load balancer and afterwards to a node in the cloud. The load balancer uses Source IP persistence. Illustrated simply below is our situation.

Cloud <--> Load Balancer <--> INTERNET <--> NAT <--> 20 clients

Because the LB uses Source IP persistence all the web requests from all the clients hit the same node in the cloud. This is, of course due to the NAT which makes sure every TCP/IP packet contains the same source IP.

Because all the requests hit the same node in the cloud very often the node produces a 503 error: http://www.checkupdown.com/status/E503.html, because the node gets overloaded with connections.

What is the best solution for this problem? Note that we do not have control over the load balancer and the nodes in the cloud. We only have shell access to upload files for our web application.

  1. Install a web server at our local office which can handle 20 clients? (We actually don't want to do server maintainance.)
  2. Connect every client to the WAN such that every client gets its own IP adres? (Insecure and infeasible with IPv4, maybe feasible with IPv6.)
  3. See if our webhost can configure the load balancer to use DNS-based load balancing? (Will this solve our problem? Where will the DNS cache reside?)
  4. See if our webhost can configure the load balancer to use a HTTP cookie for load balancing? (Probably the best solution if nodes have a static IP adres.)
  5. Another solution all together...

Option 4 is the "easiest" because it means (1) no new server and (2) no IP reconfiguration on your network.

DNS could work (you're talking about DNS round-robin, right?) but is probably more work than cookie based load balancing. I would have a chat with your host about that.

Another alternative would be to set up multi-NAT on your firewall so that your internal clients are distributed across a couple of external IP's. Conceptually, you can think of it as a reverse load balancer.

However, are your client numbers accurate? 20 clients overload your web app? Maybe you should address the problem that your app can't handle that many clients. Without know ANYTHING about your app, 20 seems pretty low. But I could be wrong. :)

A third alternative: does your app require stickiness? If your clients can jump from web server to web server with no problems, then forget per-IP load balancing and do per-connection round-robin or per-connection fewest connection.

  • Yes it think it is also low. But I know that my host only allows 50 connections per IP adres if more connections are used every new connection will get a 503 error. – meijuh Oct 4 '12 at 19:49
  • See my third alternative. – longneck Oct 4 '12 at 19:52
  • I guess my app doesn't need stickiness. For what I know; my webapplication runs on a cluster with another few hundred other applications of other customers. Those other customers probably use PHP sessions stored on a file system. However, we store sessions in the database. I believe it is hard to share PHP sessions amongst web servers. – meijuh Oct 4 '12 at 19:57
  • 1
    I think we have either have to drop the persistance part for load balancing or indeed see if using a HTTP cookie is possible. – meijuh Oct 4 '12 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.