Hi all. I resend this just to highlight the question from below.
> Finally the question is, afaiu, how to balance based on test_ha AND > counter_out AND lua.parseElement This are different tables. Best regards Aleks Am 09.03.2018 um 18:28 schrieb Aleksandar Lazic: > Hi Amit. > > *Please keep the mailing list in loop, thanks.* > > In case you haven't received my last mail here is the web link to the > maillinglist archive. > > https://www.mail-archive.com/haproxy@formilux.org/msg29252.html > > Am 09.03.2018 um 07:43 schrieb amit raj: > >> Hello Alex, >> >> Two things we have to achieve with the HAPROXY to be very clear. >> >> 1.The most important thing we want to achieve is uniform Load Balancing >> (with sessions and bytes in and bytes out parameter should be uniform >> across all the backend). > > Let me describe what I have understood. > > You want to use more the one balancing decision base. > > * session (cookie, url, ...) > * bytes in. I assume from the client > * bytes out. I assume from the client > > I this right? # <= Please answer this question, thanks. > > Please can you describe in a ASCII flow how the decision flow should work. > > What I have seen in the doc are this acl samples > > https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#7.3.1-table_bytes_in_rate > > https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#7.3.1-table_bytes_out_rate > > > But I'm not sure if this is what you need. > >> 2.When we have tried using keep-alive mode for achieving uniform load >> balancing , the HAPROXY is sending RST for closing the connection with >> the backend , this is what we really do not want .As per our use case >> HAPROXY should use FIN to close the backend connection. >> >> Currently we are using "option-http-tunnel" in the frontend of the >> application and "no-http-tunnel" and "keep-alive" in the backend this >> solves our RST issue and HAPROXY is closing the connection properly with >> FIN.But the uniform Load Balancing as I mentioned in point one got >> screwed up. >> >> Following are my basic HAPROXY config we are using for testing and >> fixing the issue. > > Thank you for the full haproxy config. > >> global >> >> log /dev/log local0 >> log /dev/log local1 notice >> # lua-load /etc/haproxy/parseJsonValue.lua >> stats socket /var/run/haproxy/haproxy.sock mode 777 level admin >> expose-fd listeners >> chroot /var/lib/haproxy >> #lua-load /etc/haproxy/lua >> stats timeout 30s >> user haproxy >> group haproxy >> # daemon >> maxconn 2000 >> >> defaults >> >> log global >> mode http >> retries 3 >> option httplog >> #option http-server-close >> option dontlognull >> option forwardfor >> timeout connect 5000 >> timeout client 50000 >> timeout server 50000 >> errorfile 400 /etc/haproxy/errors/400.http >> errorfile 403 /etc/haproxy/errors/403.http >> errorfile 408 /etc/haproxy/errors/408.http >> errorfile 500 /etc/haproxy/errors/500.http >> errorfile 502 /etc/haproxy/errors/502.http >> errorfile 503 /etc/haproxy/errors/503.http >> errorfile 504 /etc/haproxy/errors/504.http >> >> #------------------ >> # internal statistics >> #------------------ >> >> listen stats >> bind ipv4@:8999 >> mode http >> stats enable >> stats uri /stats >> #------------------ >> # frontend instances >> #------------------ >> >> frontend test_ha >> >> bind ipv4@:8080 >> option http-tunnel >> # http-request add-header X-Internal-Value %[lua.parseJsonValue] >> default_backend test_back >> >> #------------------ >> # backend instances >> #------------------ >> >> backend test_back >> >> # http-request set-header X-LB %[req.hdr(Host),lower]%[req.uri,lower] >> balance roundrobin >> >> no option http-tunnel >> option http-keep-alive> # option http-server-close >> #option http-buffer-request >> >> # stick-table type string size 30k expire 30m >> # stick on "lua.parseElement" table test_back >> >> server test2 test02.xyz.abc.com:80 <http://test02.xyz.abc.com:80> >> server test3 test03.xy.abc.com:80 <http://test03.xy.abc.com:80> >> >> Please let me know if you need any other info. > > Ah I think I understand now what you mean. > > https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4-stick-table > > I haven't used stick-table very extensive so I hope a more experienced > Person will correct my suggestion. > > -------------- > frontend test_ha > > bind ipv4@:8080 > option http-tunnel > # http-request add-header X-Internal-Value %[lua.parseJsonValue] > > stick-table type integer size 30k expire 30m store bytes_in_cnt > > default_backend counter_out > > backend counter_out > bind ipv4@:8081 > option http-tunnel > > stick-table type integer size 30k expire 30m store bytes_out_cnt > default_backend test_ha > > backend be_test_ha > > bind ipv4@:8082 > option http-tunnel > > # http-request add-header X-Internal-Value %[lua.parseJsonValue] > > default_backend test_back > > backend test_back > > # http-request set-header X-LB %[req.hdr(Host),lower]%[req.uri,lower] > balance roundrobin> > no option http-tunnel > option http-keep-alive > # option http-server-close > #option http-buffer-request > > # stick-table type string size 30k expire 30m > # stick on "lua.parseElement" table test_back > > server test2 test02.xyz.abc.com:80 <http://test02.xyz.abc.com:80> > server test3 test03.xy.abc.com:80 <http://test03.xy.abc.com:80> > ----------------- > > Finally the question is, afaiu, how to balance based on test_ha AND > counter_out AND lua.parseElement > > Best regards > Aleks >