I'm wondering whether there would be an advantage or not to know the loadavg of each backend server and ask HAProxy to send the next request to the computer with the lowest loadavg.
However, I have not seen anything that would offer such a capability in HAProxy. Maybe it is not available?
I have found this post that shows a frontend definition with a
use_backend command, but I am thinking that the map is going to be loaded once and cached for the whole duration of the HAProxy run. In otherwise, dynamically changing the map sorting the items by loadavg would make no difference...
frontend ft_items [...] use_backend %[path,lower,map(/etc/haproxy/items.map,bk_default)]
It is not clear to me that roundrobin would be good enough for my application because some requests take 50ms (images, CSS, etc.) and others can take a good 2s (Large Reports). So checking the loadavg of a computer seems more likely to fit the bill of this application.