ApacheBench and timeout

Hello,

I’m using ApacheBench Version 2.3 to run some small tests against haproxy 1.7.9 and 1.8.8 but I’m getting timeouts after ~300 requests, example:

Using

defaults
    mode http
    monitor-uri /health_check
    log global
    option dontlognull
    option httplog
    option nolinger
    option forwardfor
    option http-keep-alive
    timeout http-request 60s
    timeout connect 60s
    timeout client 60s
    timeout server 60s

I always get

$ ab  -n500 -c 10 https://edmonton1/health_check
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking edmonton1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
apr_pollset_poll: The timeout specified has expired (70007)
Total of 344 requests completed

Note: This not happens with varnish or nginx, running in the same machine.

And 500 requests is just too fast. Running against some varnish machine, for example:

Document Path:          /varnish_health_check
Concurrency Level:      10
Time taken for tests:   1.126 seconds
Complete requests:      500
Failed requests:        0
Non-2xx responses:      500
Total transferred:      99500 bytes

So, I guess that I’m doing something wrong in haproxy configuration…

Thanks!

Looks like this option did the trick:

https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#4.2-option%20nolinger

Working good now!

Properly configuring maxconn and considering how the benchmark does or doesn’t use keep-alive would probably be required.

Enabling nolinger is bad idea for reasons explained in the configuration.

1 Like