Hi Willy,
thank you very much for your detailed response. I will try out your
suggestions and get back to the mailing list if I got any problems.
Regards.
Daniel
Am 28.04.17 um 19:08 schrieb Willy Tarreau:
Hi Daniel,
On Fri, Apr 28, 2017 at 06:58:38PM +0200, Daniel Heitepriem wrote:
Hi Lukas,
by "blockwise" I mean that when we do a continously updated list of
established connections on the Apache and the HAProxy zones, we get 200
established connections on the HAProxy zone and on the Apache zone there
were only 50 connections, a second later only 12, 1, 22 then 83 and so on.
But apparently all requests which were generated by ab were successful.
When we connect ab directly to the Apache zone we get 200 connections
instantly which of course decrease when finished. I expected a similar
result when connections via HAProxy. The CPU utilization on both zones is
quite low (5 to 14%).
What you're observing is expected and a result of haproxy's optimization
of the backend connections for very fast release to reduce the concurrency
to the strictest minimum when you're using http-server-close. The variations
solely depend on the connections durations, which are in fact directly
dependent on Apache's response time. If you request small objects, it
will be very fast.
You need to keep in mind that you're limiting the client to 200 conns,
so there's no way you'll ever get 200 concurrent conns on the server if
the service time is lower than the time between two connections, because
while one is establishing, another one is already being released. For
example, if it takes 100 microseconds for the client (ab) to establish
a connection to haproxy and it takes 100 other microseconds for haproxy
to connect to the server (apache), the total connection time is 200
microseconds as seen from the client side, but only 100 as seen on the
server side, causing these connections to only exist for 100 microseconds
out of 200, hence 50% of the time.
If you try with larger objects you'll notice that your connections last
longer and are more often visible in parallel (which results in more work
for Apache).
As Lukas mentionned, you can try with keep-alive if you want, you'll see
much longer-lived connections. You may even enable "http-reuse safe" to
use a smaller connection pool to join Apache and further improve the
performance.
Hoping this helps,
Willy