rakyll / hey

HTTP load generator, ApacheBench (ab) replacement
Apache License 2.0
18k stars 1.19k forks source link

Cancel pending requests after timeout #173

Open Tronic opened 5 years ago

Tronic commented 5 years ago

Hey keeps waiting for server to respond on any open connections long after the test duration specified with -z has passed. I'd expect for pending connections to be terminated instantly, or at least after a very short additional delay.

How exactly to report such terminated connections is admittedly a hard question, as they could have been 200 responses if Hey hadn't disconnected early, but there could also be server problems which should be reported. Allowing for a short graceful termination period (say, one second after test duration) would at least in my setup be enough for all normal requests to finish.

Somewhat related, a short "warm up" duration in the beginning might be a good idea for more stable latency results. When starting cold, the CPU might be running at minimum frequency and the server has nothing to do, and then suddenly the server is flooded by connection requests and CPU frequency ramps up to maximum. A startup-period where requests are ramped up smoothly until the maximum number of connections is reached would solve connection problems (when server doesn't use ridiculously high backlog on the listening socket) and would allow for more accurate latency statistics of maximum load state.