Delay problem
Hello everybody... I've little problem with haproxy: it's working fine in transparent mode (with tproxy enabled) but sometimes (NOT on every reload), when I try to load page (all pages are in jsp), I've delay: I must attend few seconds to have the page completed. All pages are in JAVA (jsp extension) Here's my haproxy.cfg: listen MAIN PUBLIC_IP:80 modehttp option forwardfor acl x_ACL hdr_dom(host) www.x.it acl y_ACL hdr_dom(host) www.y.it source 192.168.0.133 usesrc clientip stats enable stats uri /haproxy stats auth admin:sbereu208 use_backend X if dnshosting_ACL use_backend Y if joomlahost_ACL option redispatch backend BACKEND1 PUBLIC_IP:80 modehttp balance roundrobin option forwardfor acl indirizzo_dnshst path_end / source 192.168.0.133 usesrc clientip redirect location /dnshst/index.jsp if indirizzo_dnshst cookie SERVERID insert nocache # cookie JSESSIONID prefix server resin1.x.it 192.168.0.132 cookie resin1 check port 80 inter 3 rise 2 fall 5 maxconn 300 server resin2.y.it 192.168.0.141 cookie resin2 check port 80 inter 3 rise 2 fall 5 maxconn 300 option redispatch backend BACKEND2 PUBLIC_IP:80 modehttp balance roundrobin acl indirizzo_jhst path_end / source 192.168.0.133 usesrc clientip redirect location /dnshst/jm/index.jsp if indirizzo_jhst cookie SERVERID insert nocache # cookie JSESSIONID prefix server resin1.x.it 192.168.0.132 cookie resin1 check port 80 inter 3 rise 2 fall 5 maxconn 300 server resin2.y.it 192.168.0.141 cookie resin2 check port 80 inter 3 rise 2 fall 5 maxconn 300 option redispatch And here's my iptables rules on haproxy server: echo 1 /proc/sys/net/ipv4/ip_forward /usr/local/sbin/iptables -t mangle -N DIVERT /usr/local/sbin/iptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT /usr/local/sbin/iptables -t mangle -A DIVERT -j MARK --set-mark 1 /usr/local/sbin/iptables -t mangle -A DIVERT -j ACCEPT ip rule add fwmark 1 lookup 100 ip route add local 0.0.0.0/0 dev lo table 100 iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --append FORWARD --in-interface eth1 -j ACCEPT Eth0 is my public interface Eth1 the private one Routing form my two webserver is working fine both for public and private IPs Thanks! Carlo
R: Delay problem
If I try to see web pages without haproxy I've no problem... I'm trying to tune haproxy first Thanks for your help. Carlo -Messaggio originale- Da: John Lauro [mailto:john.la...@covenanteyes.com] Inviato: lunedì 29 giugno 2009 14.25 A: 'Carlo Granisso' Oggetto: RE: Delay problem Reloading just haproxy, or reloading the jsp server? If jsp, I think it's to be expected, although you might be able to do some tuning in haproxy to minimize the amount of traffic to a server coming online. JSP has to compile pages as it encounters them the first time after a reload, making each page slow at first.
R: Delay problem
Ok, it seems that problem was in: contimeout clitimeout I've reduced these parameters and now seems that all is working fine. I've read haproxy documentation but I can't completly understand the meaning of Set the maximum inactivity time on the client side: this mean that after complete download of the page haproxy leave opened the connection until...: 1) Client do some operations 2) Timeout reached Probably my problem was the second point: page was correctly loaded and haproxy wait for other activity. Is it correct? Thanks for your help. Carlo -Messaggio originale- Da: Carlo Granisso [mailto:c.grani...@dnshosting.it] Inviato: lunedì 29 giugno 2009 14.34 A: 'John Lauro' Cc: haproxy@formilux.org Oggetto: R: Delay problem If I try to see web pages without haproxy I've no problem... I'm trying to tune haproxy first Thanks for your help. Carlo -Messaggio originale- Da: John Lauro [mailto:john.la...@covenanteyes.com] Inviato: lunedì 29 giugno 2009 14.25 A: 'Carlo Granisso' Oggetto: RE: Delay problem Reloading just haproxy, or reloading the jsp server? If jsp, I think it's to be expected, although you might be able to do some tuning in haproxy to minimize the amount of traffic to a server coming online. JSP has to compile pages as it encounters them the first time after a reload, making each page slow at first. Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.12.93/2206 - Release Date: 06/29/09 05:54:00
Re: R: Delay problem
Hello, On Mon, Jun 29, 2009 at 04:44:13PM +0200, Carlo Granisso wrote: Ok, it seems that problem was in: contimeout clitimeout I've reduced these parameters and now seems that all is working fine. I've read haproxy documentation but I can't completly understand the meaning of Set the maximum inactivity time on the client side: this mean that after complete download of the page haproxy leave opened the connection until...: 1) Client do some operations 2) Timeout reached Probably my problem was the second point: page was correctly loaded and haproxy wait for other activity. Is it correct? I think it is even simpler than that. You have maxconn 300 on your servers, and you don't have option httpclose, which means that clients can maintain a keep-alive connection open an unused after they retrieve an object. By reducing timeout client, you are forcing those connections to die faster, but it's still not the right way to do this. Please simply add option httpclose and I'm sure the problem will definitely vanish. Regards, Willy