Re: Balancing bytes in/out

2009-08-14 Thread Willy Tarreau
On Sat, Aug 15, 2009 at 10:32:40AM +0800, Nelson Serafica wrote:
> Its only http and https. The site is not a forum but a site with a lots of 
> transaction such as accounting, etc.
> 
> When I tried to use leastconn, it affects some transaction such as 
> authentication. backend says he was successfully disconnected while the web 
> interface says he was still logon so I revert to round-robin and everything 
> back to normal except not balance bytes or traffic.


The load-balancing algorithm cannot have such an impact on the functional
behaviour of the site. Either all algos fail (with varying failure rates)
or all work. Your description makes me think that your site may require
persistence, and that using a different algo most often hides a pending
issue. You'd better double check before you're hit by a bigger problem !

Regards,
Willy




Re: Balancing bytes in/out

2009-08-14 Thread Nelson Serafica

Its only http and https. The site is not a forum but a site with a lots of 
transaction such as accounting, etc.

When I tried to use leastconn, it affects some transaction such as authentication. backend says he was successfully 
disconnected while the web interface says he was still logon so I revert to round-robin and everything back to normal 
except not balance bytes or traffic.



It will depend on the type of traffic and application in fact. A site such
as a forum or similar where people never go away can indeed stick users for
a long time to a server. But after all, that's the precise reason you're
using cookies in the first place.






Re: Balancing bytes in/out

2009-08-13 Thread Willy Tarreau
On Thu, Aug 13, 2009 at 05:21:28AM -0400, John Lauro wrote:
> The biggest issue probably is that you are using cookies that will tie a
> client to a server.  For me, I noticed it often takes over 3 days to get the
> first 80% of the traffic off if I mark a server as soft down as people never
> reboot or close the browser.  If you have more random traffic and less
> regular visitors it might not take so long.

It will depend on the type of traffic and application in fact. A site such
as a forum or similar where people never go away can indeed stick users for
a long time to a server. But after all, that's the precise reason you're
using cookies in the first place.

A site where people consult some information (eg: online sales) will not
have this behaviour because people don't stay that long.

> Leastconn is more accurate for how the servers look at that moment in time.

Leastconn is only accurate for long sessions. In fact, it's still accurate
enough for short sessions because it does roundrobin between servers at an
equal number of sessions, but it should really be avoided for short sessions
such as HTTP. It's fine for SQL, LDAP, TSE, ... though.

> However, it does not take into account all clients that closed the session
> but have a cookie for a server, and it's only used for clients that don't
> already have a cookie.  Round robin or one of the other methods might work
> better, but it can take close to a week for you to know if it's any better
> or not as a large number of your users are already tied to a specific server
> with a cookie.  I used to use roundrobin and I think it worked better with
> cookies, but currently I don't have any traffic requiring cookies and so
> leastconnn has been working better.

Anyway, given the differences between the two counters, I don't even think
the LB algo is the cause. We don't have the other columns, but I'd suspect
that one of the servers is regularly offline due to failed health-checks
while the other one is not.

Regards,
Willy




Re: Balancing bytes in/out

2009-08-13 Thread Hank A. Paulson
FYI, I think the default unit for times in haproxy is ms not seconds, so these 
are not correct, AFAIK.


 clitimeout  6 # 16.6 Hrs. 60 seconds
 srvtimeout  3 # 8.33 Hrs. 30 seconds
 contimeout  4000  # 1.11 Hrs.  4 seconds

On 8/12/09 10:22 PM, Nelson Serafica wrote:

clitimeout  6 # 16.6 Hrs.
  srvtimeout  3 # 8.33 Hrs.
  contimeout  4000  # 1.11 Hrs.




RE: Balancing bytes in/out

2009-08-13 Thread John Lauro
 
> Is there something I need to change in my config. I set it as leastconn
> to balance traffic but it isn't. Can haproxy knows to transfer request
> to other back end when it knows it has a much more traffic compare to
> other server?
> 
It can not transfer to a different server when you tie the client down to a
server with a cookie. If you can narrow down which traffic has to be tied
down to a specific server, I think you could ignore the cookie for the other
traffic and have better balance.




RE: Balancing bytes in/out

2009-08-13 Thread John Lauro
The biggest issue probably is that you are using cookies that will tie a
client to a server.  For me, I noticed it often takes over 3 days to get the
first 80% of the traffic off if I mark a server as soft down as people never
reboot or close the browser.  If you have more random traffic and less
regular visitors it might not take so long.

Leastconn is more accurate for how the servers look at that moment in time.
However, it does not take into account all clients that closed the session
but have a cookie for a server, and it's only used for clients that don't
already have a cookie.  Round robin or one of the other methods might work
better, but it can take close to a week for you to know if it's any better
or not as a large number of your users are already tied to a specific server
with a cookie.  I used to use roundrobin and I think it worked better with
cookies, but currently I don't have any traffic requiring cookies and so
leastconnn has been working better.

> -Original Message-
> From: Nelson Serafica [mailto:ntseraf...@gmail.com]
> Sent: Thursday, August 13, 2009 1:23 AM
> To: HAproxy Mailing Lists
> Subject: Balancing bytes in/out
> 
> I just install and run haproxy for almost 3 months now and found no
> problem with it. Its just that I just notice that in my MRTG, the
> traffic is not the same. HAPROXY has SERVER A and SERVER B as backend
> web server. In the mrtg, SERVER B has a lot traffic compare to SERVER
> A. I have enable stats and I notice that Bytes IN/OUT is not almost
> equal (see attachment). Here is the config of my haproxy:
> 
> listen  WEB_SERVERS 1.2.3.4:80
>   mode http
>   clitimeout  6 # 16.6 Hrs.
>   srvtimeout  3 # 8.33 Hrs.
>   contimeout  4000  # 1.11 Hrs.
>   balance leastconn
>   option forwardfor
>   option  httpclose
>   cookie igx insert nocache indirect
>   server WEBA 2.3.4.5:80 cookie igx1 maxconn 2500 inter 1000
> fastinter 200 fall 2 check
>   server WEBB 2.3.4.6:80 cookie igx2 maxconn 2500 inter 1000
> fastinter 200 fall 2 check
>   stats uri   /my_stats
>   stats realm Global\ statistics
>   stats auth  stats:password
> global
>   maxconn 1 # Total Max Connections.
>   log 127.0.0.1   local0
>   log 127.0.0.1   local1 notice
>   daemon
>   nbproc  1 # Number of processes
>   userhaproxy
>   group   haproxy
>   chroot  /var/chroot/haproxy
> defaults
>   log global
>   option  httplog
>   modetcp
>   clitimeout  6 # 16.6 Hrs.
>   srvtimeout  3 # 8.33 Hrs.
>   contimeout  4000  # 1.11 Hrs.
>   retries 3
>   option  redispatch
>   option  httpclose
> 
> Is there something I need to change in my config. I set it as leastconn
> to balance traffic but it isn't. Can haproxy knows to transfer request
> to other back end when it knows it has a much more traffic compare to
> other server?
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.392 / Virus Database: 270.13.47/2289 - Release Date:
> 08/12/09 18:12:00