Hi Bar,

On Sun, Apr 29, 2012 at 02:09:42PM +0300, Bar Ziony wrote:
> Hi,
> 
> I have 2 questions about a haproxy setup I configured.
> 
> This is the setup:
> LB server (haproxy 1.4.20, debian squeeze 64-bit) in http mode, forwarding
> requests to a single nginx web server, that resides on a different machine.
> I'll paste the haproxy config at the end of this message.
> 
> 1. Benchmarking:
> When doing some benchmarking with 'ab' or 'siege', for a small (2 bytes,
> single char) file:
> 
>     ab -n 10000 -c 40 http://lb/test.html
>     VS
>     ab -n 10000 -c 40 http://web-01/test.html
> 
> web-01 directly gets 6000-6500 requests/sec. haproxy->nginx gets 3000
> requests/sec.

This is extremely low, it's approximately what I achieve on a sub-1watt
500 MHz Geode LX, and I guess you're running on much larger hardware
since you're saying it's 64-bit.

> When using ab -k to enable keepalives, nginx is getting >12,000
> requests/sec, and haproxy gets around 6000-7000 requests/sec.

Even this is very low. Note that the 6-7k here relates to what nginx
support above without keep-alive so it might make sense, but all these
numbers seem very low in general.

> I wanted to ask if the x2 difference is normal? I tried to remove the ACL
> for checking if the path ends with PHP, the results were not different.

Is "ab" running on the same machine as haproxy ? Do you have nf_conntrack
loaded on any of the systems ? Do you observe any process reaching 100%
CPU somewhere ? Aren't you injecting on a 100 Mbps NIC ?

> 2. As you can see, I separate the dynamic (PHP) requests from other
> (static) requests.
>     a. Is this the way to do it (path_end .php) ?

It looks fine. Other people like to store all their statics in a small
set of directories and use path_beg with these prefixes instead. But it
depends on how you classify your URLs in fact.

>     b. I limit the number of connections to the dynamic backend server(s).
> I just set it according to the number of FastCGI PHP processes available on
> that machine. How do I check/benchmark what is the limit for the static
> backend? Or is it not needed?

Nginx performs quite well in general and specially as a static file server.
You may well set a high maxconn or none at all on the static backend, you
won't harm it.

Otherwise I found nothing suspect in your config.

Regards,
Willy


Reply via email to