0

I am using HA Proxy for load balancing purpose. I have two servers (S1) and (S2) getting requests from devices via HA proxy.

Number of devices is more than 2000.

Those devices sending multiple requests (download an item) to HA proxy and HA proxy forwarding those requests to S1 & S2.

The problem is if a device1 (D1) send a request to download a item (image/movie) and response takes time because of downloading the item; meanwhile device2 (D2) boots up and send the same request to download and again this request lands to server (S1 or S2) via HA Proxy and download start happening, since download still in progress, a device3 (D3) boots up and send the same request to download. Like this all devices are start sending same request to download the same content loading my servers (S1 & S2) hugely.

What i need is some how, if we can stop the same download request to get forwarded by HA Proxy to Servers (S1 or S2).

My intention to find a solution at HA Proxy level to stop sending the same requests again and again. If one request is still in progress then, all subsequent same request either queued or discared by HA Proxy.

Please help.

Ravish
  • 1
  • 1

1 Answers1

0

That is really an application design problem. You could split the download requests out to a different IP i.e. downloads.myapp.com and set maxconn=1 i.e. 1 request at a time? Or you could balance on URL so the same download request goes to the same application server: But it sounds like you just need in memory caching of content or more servers or faster I/O.

  • I am using Squid in-front of HAProxy, so that content are cached in Squid and devices takes the content first from Squid. If they don't find content in squid then send download request to HA Proxy. Since, devices boots in the morning no content in cache, and if 1 request for download in process all devices start sending the same request to download the same content. – Ravish Oct 07 '16 at 07:44
  • What if you sent the request before everyone logs in? setup an automatic script to run every morning... ... so that it would be cached? In any case I don't think HAProxy can help with your problem - but I could well be wrong as I don't fully understand it. – Malcolm turnbull Oct 09 '16 at 17:40