HAproxy limits web tabs

I’m using HAproxy to route trafic to 2 apps running on the server.
One of the apps is ThingsStack. Problem I have is that now I can’t open more than 3 tabs that have direct link to the device data [ probably done over MQTT ]. If I open another browser or incognito window I can open another 3 tabs and then I have the same problem. Next tab is just loading [on chrome spinning counter-clockwise]. If I close one tab with device data another tab that is loading will load.
Before using HaProxy I had no issues opening as much tabs as needed.
I have nothing in HaProxy config file that is used to limit connections per user.

Any guidelines ? Any settings that I can adjust to allow more traffic/connections per session.

When problem occurs I have no queued request shown in stats page. maxconn is set to 300000, 250000 allowed on that backend.

Also worth noting that I have no problems connecting 10 MQTT clinets on the server form my service, from single PC [created just to test if MQTT tcp is making problems].

Without knowing the exact specifics (i.e. backend server configuration, browser, etc.) I would suggest taking the following into consideration:

  • first of all most browsers (including Chrome and Firefox) impose a maximum 6 parallel HTTP/1.1 connections, thus you can have at most 6 in-flight requests;
  • I have a hunch that your web application uses HTTP long-polling (i.e. sends a request, and the server delays the response until it has something to give;) thus the limit of 3 tabs might be from 2 such pending requests; (use the developers tools from your browser to see how many pending requests you have;)
  • this limit does not apply to HTTP/2, which I don’t think is enabled by default by HAProxy, thus previously your server might have spoken natively HTTP/2 and now it doesn’t; (again use the developers tools to check the protocol of requests both with and without HAProxy;)

Thank you !

Looks like HaProxy didn’t use HTTP/2 by default. After adding “alpn h2,http/1.1” to the frontend bind it works.

Yes, it might have solved the problem you’re seeing, but now you’ve just moved the problem elsewhere, namely the backend max connections limit. By default HAProxy also uses HTTP/1.1 to speak with the backend (regardless if you are using HTTP/2 on the frontend.)

Thus if you now have 100 tabs opened, you’ll just have 200 connections opened with your server. (Which if it’s using one thread per connection is quite bad news.)

I would suggest:

  • try to disable HTTP long pooling in your server; (this might increase request load, and latency, but it works with HTTP/1.1;)
  • try to enable HTTP/2 also on the backend side; (I don’t know how stable HTTP/2 on the backend is; on older HAProxy versions it’s not even supported;)

Although if the server was designed to support HTTP long pooling and many clients it might not be a problem.