About 2) TCP testing, you are right. When I was doing the basic functional 
testing, I used a 100Mbps hub. That is why.

About 1), when the client browses to http://192.168.5.3, it got a "page cannot 
be displayed" error. When the client browses to http://192.168.5.3:80, it got 
the correct Apache default index.html page. I think that the reason is in the 
HAProxy (with ip 192.168.5.3) configuration file, it listens to 192.168.5.3:80, 
this specific port.

Suppose that the client does not know what port HAProxy is listening to. Client 
usually only connects to the ip address, not the ip+port, similar to client 
browsing to http://192.168.5.3. In this case, how should I configure the 
listening part (only listening to ip address?) at HAProxy?

Chih-fan Hsin
-----Original Message-----
From: Willy Tarreau [mailto:[email protected]] 
Sent: Monday, January 19, 2009 8:26 PM
To: Hsin, Chih-fan
Cc: [email protected]
Subject: Re: HAProxy: listening port set up and performance

Hi,

On Mon, Jan 19, 2009 at 06:11:13PM -0800, Hsin, Chih-fan wrote:
> Hi, I am new to HAProxy and have questions about the configuration and 
> performance.
>
>     I downloaded HAProxy 1.3.15.7 from 
> http://haproxy.1wt.eu/<blocked::http://haproxy.1wt.eu/> to /home/user/Tool
>     Unpacked it by "tar xopf name.tar.gz.tar"
>     Run "make TARGET=linux26"
>
>     1) Apache HTTP testing
>     Servers webA (192.168.5.4) and webB (192.168.5.5) have Apache server 
> started.
>     Client (192.168.5.1) sends http requests to webA (192.168.5.4:80) and 
> webB (192.168.5.5:80), and can get valide http response (default Apache 
> response).
>      [client] -> [webA],[webB]
>
>     Now, the HAProxy does not have Apache server and has IP address 
> 192.168.5.3.
>     At HAProxy, run "./haproxy -f ./haproxy1.cfg".  The haproxy1.cfg is below
>     [client] -> [HAProxy] -> [webA],[webB].
>     Client sends http request to HAProxy via IE web browing to 
> http://192.168.5.3. However, the client cannot get web response.


By this, do you mean that no response ever comes back, or that you get
an error ?

>     Client sends http request to HAProxy via multiple IE web browsing to 
> http://192.168.5.3:80. Then it works.

Are you sure that your apache machines don't block access from haproxy ?
Also, do you have any form of virtual hosting on those machines, which
would refuse requests with a "Host:" field with a wrong IP address in it ?

>     haproxy1.cfg file
>            listen webfarm 192.168.5.3:80    <- How do I decide the correct 
> port number to make http://192.168.5.3 work?

This is the correct form.


>                mode http
>                balance roundrobin
>                cookie SERVERID insert indirect
>                stats enable
>                server webA 192.168.5.4:80 cookie A check
>                server webB 192.168.5.5:80 cookie B check

I see that you have not configured timeouts. This is bad (though it
should not cause you the problem you're seeing). Please add the
following lines to the section above :

        timeout client 30s
        timeout server 30s
        timeout connect 5s

Also, you should log, you would see in the logs what is wrong.
For this, please add the following line :

        log 127.0.0.1 local0

Then ensure that your syslogd listens to the UDP socket (syslogd -r),
and check the log files (you will see one line added when you start
haproxy, then one line per request).

>     2) TCP testing (using Iperf)
>     Servers webA (192.168.5.4) and webB (192,168.5.5) run Iperf TCP sink to 
> listen to port 5001
>     Client runs 2 Iperf TCP connections and send traffic to 192.168.5.3:80
>     At HAProxy, run "./haproxy -f ./haproxy2.cfg"
>     haproxy2.cfg
>         listen webfarm 192.168.5.3:80
>                mode tcp
>                balance roundrobin
>                stats enable
>                server webA 192.168.5.4:5001
>                server webB 192.168.5.5:5001
>     I can achieve 36Mbps each under the following scenario.
>         [client]   -> 36Mbps -> [webA]
>                 |----->36Mbps -> [webB]

36 Mbps ??? You definitely have something wrong in your setup !
This is the bandwidth you could expect from a saturated 100 Mbps
HUB at maximal collision rate !!! Please check that all your
connections are made to a switch and not a hub, and that all
your hosts have negociated full duplex (with ethtool).

>     However, when I use HAProxy, I can only achieve 18Mbps each.  The 
> utilization of HAProxy machine is low.
>         [client]  -> [HAProxy] ->  18Mbps -> [webA]
>                                     |-------->  18Mbps -> [webB]
>     Is this normal? Is there any way to improve it?

No it's not normal, but expected from the bad numbers above.
If you are using a hub which is saturated, then making the
traffic pass twice over it will half the per-host bandwidth.

Right now, it does not make sense to use a hub for network
testing, not even a 100 Mbps switch. Gigabit switches are
very cheap, you can find a 5-port gig switch for less than
$50, it could save you a lot of time spent troubleshooting
connectivity issues.

Regards,
Willy


Reply via email to