I’m quite new to HAProxy and I currently have a config set up so that the backend is a set of aws ecs servers that I can stream to with obs. I put the maxconn for each server in the backend at 10, and I have a controller that spins up new aws servers on the fly to cope with the incoming streams if the total capacity of the backend is reached. Unfortunately it takes around 2-3 min to spin up a new server and then dynamically reload haproxy, so the excess streams that come in during that timeframe in which backend servers are being spun up are disconnected. I was thinking that I could just redirect the excess streams to a separate web server that would wait a little bit (30s) and then just send the streams back to the proxy over and over until stream capacity was increased.
This is what I have come up with thus far (don’t know if correct), is this the best way to do it or is there another way to just queue streams until there is space?
acl full_capacity be_conn_free(backend) eq 0
use_backend looping_backend if full_capacity