Re: balancing the load evenly

2009-08-09 Thread Willy Tarreau
Hello,

On Thu, Aug 06, 2009 at 04:38:57PM +0200, Magnus Hansen @ mingoville wrote:
> Hello...
> 
> I am very happy with the haproxy, but the result of my loadbalancing  
> confuses me...
> 
> I believe my configuration is fine, but one of my servers are getting  
> hit much more than the others
> I have tried with leastconn, roundrobin, and source. All are producing  
> more or less the same result which is that the same one of my servers  
> is chosen above the others...
> 
> My main newbee question is of course Am i missing something?
> 
> The one usually getting hit is jettysmall1 and even lowering the  
> weight seems to help The lowest weight i have tried is half as  
> much as the others

well, the fact that "balance source" does not cause an even load depends
on the traffic distribution across source IP addresses. It only works
fine with thousands of clients.

otherwise, roundrobin gives a perfectly balanced distribution across
all your servers. If you see that one server is more loaded than others
with roundrobin, either you see that it gets more cumulated connections,
which may happen if other servers regularly fall down and get up, or you
see that it gets more concurrent connections, which indicates it shows
higher response times, probably due to its sizing or sometimes a local
trouble, such as poor network connectivity.

In the last case, using "leastconn" will get rid of this, but this server
will then receive a lot less cumulated connections than others, because
it takes more time to complete each of them.

I suggest that you re-enable roundrobin and check the stats page to
identify the reason for the difference.

Regards,
Willy




balancing the load evenly

2009-08-06 Thread Magnus Hansen @ mingoville

Hello...

I am very happy with the haproxy, but the result of my loadbalancing  
confuses me...


I believe my configuration is fine, but one of my servers are getting  
hit much more than the others
I have tried with leastconn, roundrobin, and source. All are producing  
more or less the same result which is that the same one of my servers  
is chosen above the others...


My main newbee question is of course Am i missing something?

The one usually getting hit is jettysmall1 and even lowering the  
weight seems to help The lowest weight i have tried is half as  
much as the others



Many thanks

Magnus

global
log 127.0.0.1   local0
log 127.0.0.1   local1 notice
#log loghostlocal0 info
maxconn 600
user root
group root

defaults
log global
modehttp
option  httplog
option  dontlognull
retries 5
option  redispatch
contimeout  15000
clitimeout  19
srvtimeout  19
option  httpclose
option  forwardfor

listen webfarm 10.244.186.18:80
modehttp


acl url_jetty  path_beg /info /um /ws /amf /sm /fm /product /game
acl url_php path_end php
acl url_unilogin path /um/login/unilogin.php

stats   enable
stats   hide-version
stats   uri /admin?stats
stats   realm   Haproxy\ Statistics
stats   authadmin1:passwd

use_backend jetty if url_jetty !url_php or url_unilogin 
default_backend static

backend jetty

balance source # or leastconn or rounrobin
cookie HAP_SERVERID insert nocache indirect

	server jettysmall2 10.244.126.97:8080 cookie omega maxconn 150 weight  
10 maxqueue 30 check fall 10 inter 4000
	server jettysmall3 10.244.125.175:8080 cookie delta maxconn 150  
weight 10 maxqueue 30 check fall 10 inter 4000
	server jettysmall4 10.244.150.245:8080 cookie epsilon maxconn 150  
weight 10 maxqueue 30 check fall 10 inter 4000
	server jettysmall1 10.244.146.51:8080 cookie gamma maxconn 150 weight  
7 maxqueue 30 check fall 10 inter 4000



backend static
balance source  # or whatever
server apache1  10.244.186.18:81