Hi,

On Wed, Aug 04, 2010 at 12:44:33PM +0800, overred wrote:
> Hi,
>    I am a Haproxy user.and had some problomes.
>    
> my load balancer policy is:
> #haproxy.cfg
> global
>         daemon       
>         maxconn 409600
>         chroot /usr/local/haproxy 
>         uid 99
>         gid 99      
>         #nbproc 4
>         #debug
>         #quiet
> defaults
> 
>         balance  hdr(X-Up-Calling-Line-ID)
>         hash-type consistent
> #       hash-type  map-based
>         mode    http
>         #option  httplog
>         #option  dontlognull
>         option forwardfor
>         retries 5
>         #option httpclose
>         option dontlognull
>         option forwardfor
>         no option redispatch
>         
>         maxconn 409600
>         contimeout      5000
>         clitimeout      50000
>         srvtimeout      50000
> #frontend http-in
> #j2me-server
> #       bind *:80
> listen  j2me-server 0.0.0.0:80
>       #  cookie  SERVERID rewrite
>       #  balance roundrobin
> #       capture request header X-Up-Calling-Line-ID len  11
> #       balance  hdr(hdr_sub(X-Up-Calling-Line-ID))
> #       balance  source
>         balance  hdr(X-Up-Calling-Line-ID)
>         hash-type consistent
>         stats uri /site-stats  
>         stats realm Haproxy\ statistics 
>         stats auth fetion:fetion
>         no option redispatch
>         cookie SERVERID insert indirect  
>         option httpchk HEAD /test.htm HTTP/1.0
> #       server  j2me89_1 192.168.147.10:80 check inter 2000 rise 2 fall 5
>         server  j2me89_1 192.168.98.89:80 check inter 2000 rise 2 fall 5
>         server  j2me90_2 192.168.98.90:80 check inter 2000 rise 2 fall 5
>         server  j2me91_3 192.168.98.91:80 check inter 2000 weight 3 rise 2 
> fall 5
>         server  j2me92_4 192.168.98.92:80 check inter 2000 weight 3 rise 2 
> fall 5
>         server  j2me93_5 192.168.98.93:80 check inter 2000 weight 3 rise 2 
> fall 5
>         server  j2me94_6 192.168.98.94:80 check inter 2000 weight 3 rise 2 
> fall 5
>         server  j2me102_7 192.168.98.102:80 check inter 2000 weight 3 rise 2 
> fall 5
>         server  j2me103_8 192.168.98.103:80 check inter 2000 rise 2 fall 5
>         server  j2me104_9 192.168.98.104:80 check inter 2000 rise 2 fall 5
>         server  j2me105_10 192.168.98.105:80 check inter 2000 rise 2 fall 5
> 
> 
> the hash type is:  balance  hdr(X-Up-Calling-Line-ID),"X-Up-Calling-Line-ID" 
> is a http request header like :
> GET /test.aspx HTTP/1.1
> X-Up-Calling-Line-ID: 13888888888
> 
> 
> but 200 balance is wrong with 200,000 requests(the X-Up-Calling-Line-ID is 
> random).
> this 200 X-Up-Calling-Line-ID load to the different realserver.

I don't understand what you mean here. Do you mean that when the ID
equals 200 it does not always go to the same real server ?

> In principle,will load to the same realserver with the same header of 
> X-Up-Calling-Line-ID(hash-type consistent too).

Yes, in principle, as long as none of your servers fail, a same header
value will always go to the same server. If this is not the case for you,
you should check your logs to ensure that your servers are not randomly
failing. Well, check your stats instead, sine your logs are not enabled ;-)

> Is something wrong with my haproxy.cfg or other?

The only thing I see is the very high maxconn which probably does not match
what you need because reaching such levels requires very fine system tuning.
Ah I see something. You have disabled "option httpclose", which means that
only the first request of each connection is analysed. If your clients have
keep-alive enabled, then it is possible that you observe incorrect balance
for the 2nd and up requests of each connection.

You'd better use "option http-server-close" so that client keep-alive
remains active, still allowing haproxy to parse all requests.

Regards,
Willy


Reply via email to