I am using haproxy to load balance a pool of FTP servers. Since haproxy only handles the command channel and I am using leastconn, it is able to pretty much keep the load balanced between all servers.
However, not all users (or command channels) are equal. For example a specific user may open a lot of file transfers, which are opened independently of the command channel, and are not subject to load balancing. Once a user opens a command channel, the way my FTP servers are configured, all data channels will be established with the same backend server. What I have going on is that a particular server will become very busy, which is the reason for load balancing in the first place. It will respond slowly and HAProxy will continue to send it traffic. A portion of users will experience slowdown even while the majority have no issue. Ideally, it would be great if haproxy would try to connect for something like 2 seconds, and then transparently switch to another backend that is responding more quickly. Optionally, I would like to balance based on the backend's response time, rather than the number of connections (since connections are so unequal with FTP). I read the manual a few times looking for inspiration, the best I have been able to come up with is to have an agent that dynamically adjusts weights given some criteria I am yet to define. Any ideas on how to achieve better balancing? Is anyone using a scheme like the above or did I miss a more obvious solution?