Further to this I've found if I add a large comment at the bottom of the file 
to increase the file size then the problem goes away.

It might be that xlightweb (it's a rather rubbish container but I'm stuck with 
it) is doing something weird for this file, but if I remove the haproxy layer 
and have the ip balancer talk directly to the web servers the problem doesn't 
manifest in a browser.


On Jan 8, 2013, at 11:20 AM, William Lewis <[email protected]> wrote:

> Hi,
> 
> I'm going slightly crazy trying to work out this problem and I hope someone 
> can help.
> 
> I have 2 hosts, each host is running an instance of haproxy and an instance 
> of a java web server xlightweb. Between these hosts and the outside world 
> there is a dumb round robin ip balancer that holds no state.
> 
> Each of the haproxy are configured to balance between both the localhost 
> instance of the web server and the instance on the other host.
> 
> (This is a currently a proof of concept system before I deploy haproxy on its 
> own machines in front of many more web servers)
> 
> 
> The problem that I'm having is that serving a particular javascript file is 
> failing when the haproxy on host A is fetching it from host B and when the 
> haproxy on host B is fetching it from host A.
> It always affects the same javascript file only, and there are many more 
> javascript files in use which are being served fine.
> 
> Logs from haproxy host A
> 
> be/host_a 1/0/1/13/18 200 16389   --NI 1/1/0/0/0 0/0 {Mozilla/5.0(iPad; U; 
> CPU OS 6_0 like Mac OS X|} {} "GET /app/js/libs/jq.mobi.js HTTP/1.1"
> be/host_b 4640/0/0/7/4648 200 14955   SDNI 0/0/0/0/0 0/0 {Mozilla/5.0(iPad; 
> U; CPU OS 6_0 like Mac OS X|} {} "GET /app/js/libs/jq.mobi.js HTTP/1.1"
> 
> Logs from haproxy host B
> 
> be/host_a 0/0/1/13/17 200 14956   SDNI 0/0/0/0/0 0/0 {Mozilla/5.0(iPad; U; 
> CPU OS 6_0 like Mac OS X|} {} "GET /app/js/libs/jq.mobi.js HTTP/1.1"
> be/host_b 0/0/0/4/5 200 16388   --NI 1/1/0/1/0 0/0 {Mozilla/5.0(iPad; U; CPU 
> OS 6_0 like Mac OS X|} {} "GET /app/js/libs/jq.mobi.js HTTP/1.1"
> 
> 
> My haproxy configuration is this
> 
> global
>    daemon
>    quiet
>    maxconn 200000
>    pidfile /local/migwproxy/haproxy.pid
>    uid     60003
>    gid     1001
>    chroot  /local/migwproxy/run
>    log     127.0.0.1       local0
>    log     127.0.0.1       local1 notice
>    log-tag migwproxy
> 
> defaults
>    log global
> 
>    balance roundrobin
>    mode http
>    monitor-uri /migwproxy
>    http-check send-state    
> 
>    retries 3
> 
>    timeout connect 6000
>    timeout client 1020000
>    timeout server 1020000
>    timeout http-request 6000
> 
>    option forwardfor except 127.0.0.1    
>    option http-server-close
>    option httplog
>    option log-health-checks
>    option log-separate-errors    
>    option redispatch
>    option tcpka
> 
> frontend external
>    bind *:9000
> 
>    maxconn 200000
> 
>    # Capture User-Agent and X-Forward-For headers to the log
>    capture request header User-agent len 45
>    capture request header X-Forwarded-For len 15
>    # Capture any 302 redirects to the log
>    capture response header Location len 20
> 
> 
>    # We keep track of connection rates and connection numbers
>    stick-table type ip size 200k expire 2m store conn_rate(3s),conn_cur
>    # And we do this per source address
>    tcp-request connection track-sc1 src
> 
>    acl source_rate_abuser sc1_conn_rate gt 200
>    acl source_connections_abuser sc1_conn_cur gt 3000
> 
>    acl acl_photorating hdr(host) -i photorating.mshot.example.com -i 
> photorating.mshoteu.example.com -i photorating.mshotus.example.com -i 
> api.photorating.mshot.example.com -i api.photorating.mshoteu.example.com -i 
> api.photorating.mshotus.example.com -i push.photorating.mshot.example.com -i 
> push.photorating.mshoteu.example.com -i push.photorating.mshotus.example.com
> 
>    use_backend be if acl_photorating !source_rate_abuser || acl_photorating 
> !source_connections_abuser
>    use_backend be-slow if acl_photorating source_rate_abuser || 
> acl_photorating source_connections_abuser
> 
> 
> backend be
> 
>    cookie ha-server-photorating insert domain .example.com
> 
>    server host_a 10.10.184.103:34025 cookie host_a check inter 5000 maxconn 
> 500
>    server host_b 10.10.184.11:25117 cookie hosst_b check inter 5000 maxconn 
> 500
> 
> backend be-slow
> 
>    cookie ha-server-photorating insert domain .example.com
> 
>    server host_a 10.10.184.103:34025 cookie host_a check inter 5000 maxconn 
> 500
>    server host_b 10.10.184.11:25117 cookie hosst_b check inter 5000 maxconn 
> 500
> 
> 
> You can also see a live example here, http://netproteus.com/test.html
> 
> 
> Any insight, greatly appreciated.
> 
> 
> Will Lewis


Reply via email to