Sergey Zhukov
Sergey Zhukov

Reputation: 1372

How to ignore timeouts in ab (apache bench)?

I run benchmarks with apache bench on a web service. I know that 1-2 requests from the test will be timeouted during measurement (it's a web framework issue). And when timeout occurs ab quits with the message apr_pollset_poll: The timeout specified has expired (70007) and does not show results. I want to get measurement results ignoring these timeouted tests (or count them too, but just use timeout value as response time). Is it possible with ab?

EDIT: The command I use is

ab -n 1000 -c 10 http://localhost:80

I looked into ab source and from what I saw it's impossible to ignore these errors. Maybe there is a fork which implements such feature?

Upvotes: 9

Views: 7181

Answers (2)

Tim Perry
Tim Perry

Reputation: 13216

The -r option says "Don't exit on socket receive errors" (see docs here).

This disables the 'exit on first failure' behaviour that ab uses by default, so that network errors (including timeouts, connection resets, TLS/SSL errors etc) are logged but testing continues regardless.

Upvotes: 0

earldouglas
earldouglas

Reputation: 13473

The default timeout is 30 seconds. You can change this with -s:

ab -s 9999 -n 1000 -c 10 http://localhost:80

Upvotes: 6

Related Questions