I am using HAProxy for load balancing my HTTP requests. I would like to know if there is any way to customize the selection of backend server based on the responses returned by each server. I have a servlet which can return the responses (number of clients connected to it). I would like to use this information and route the request to the backend server which has the lowest number.
My HAProxy configuration looks like:
listen http_front xx.xx.xx.xx:8080 mode http option httpchk GET /servlet/IHealthCheckServlet server app1 xx.xx.xx.xx:8080 check port 8080 server app2 xx.xx.xx.xx:8080 check port 8080 server app3 xx.xx.xx.xx:8080 check port 8080
Can you help me in this regard.