hatoo / oha

Ohayou(おはよう), HTTP load generator, inspired by rakyll/hey with tui animation.
MIT License
6.35k stars 161 forks source link

`-q` or `--burst-rate` and `--burst-delay` do not send correct number of requests? #577

Open pvardanis opened 2 months ago

pvardanis commented 2 months ago

I'm doing a load testing with oha and want to achieve 5 qps. I've tried both using:

oha -z 1m --burst-delay 1s --burst-rate 5 --latency-correction --disable-keepalive --wait-ongoing-requests-after-deadline

and

oha -z 1m -q 5 --latency-correction --disable-keepalive --wait-ongoing-requests-after-deadline

and only get around ~55 responses, all with 200. I'm I doing something wrong? Tried to increase -c as well and the number of requests did increase (without achieving what I want) but seems if I push too high my Mac crashes. FWIW a response might take anywhere from 20-180s.

hatoo commented 2 months ago

I want to see a latency histogram. Could you add a full example of a run of -q version? (command and full output)

hatoo commented 2 months ago

--wait-ongoing-requests-after-deadline doesn't ensure it will do Qps * seconds requests. It waits for requests that are started but not ended when the deadline is reached. So it is normal that oha has done less than 60 * 5 requests when the target server is slow.

pvardanis commented 2 months ago

Sure, here's the command using -q:

oha -z 1m -q 1 --latency-correction --disable-keepalive --wait-ongoing-requests-after-deadline -m POST -H "Content-Type: application/json; format=pandas-records" \
-H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJza25IaEpqZEU2WHk1SjdBc0FKUmdUelVTQXJpSGY3RWRiNXk4d2d5a05zIn0.eyJleHAiOjE3MjYxNTg5MjksImlhdCI6MTcyNjE1NTMyOSwianRpIjoiNzgwOGM4YTUtMTcwYy00Y2I5LWE4NWMtOTc1ZDMwMTBiNGY0IiwiaXNzIjoiaHR0cHM6Ly9jdXJseS1wbHVtLTM4Njgud2FsbGFyb28uZGV2L2F1dGgvcmVhbG1zL21hc3RlciIsImF1ZCI6WyJtYXN0ZXItcmVhbG0iLCJhY2NvdW50Il0sInN1YiI6IjdmZWVlOTNhLWFiODgtNGQ1MC1iZGQ3LTQ2ZjA1YWNjNTk4NCIsInR5cCI6IkJlYXJlciIsIm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.SQ6eWH3rqn_5AeZWXMZU9x-JFr7nFwSxQxYebZkPx9pjfqKFHp2Thz2qRIv-J1KQSIJemg8iAH2NfszYT_WpP_En2GHST38JSOyl5QqA1r0GIH6YmA88anP79tGye4tQlbrCnllwef3NxGlkrq-jM_LVfFxFiOuyDwSkLMtiwz7Aon8Y3jBFrPGq2s07cP7aJri9DXg-31CEUjFUUHHoueChjTrZ1mDyNcZENHuMgKp0q7EELJ_PxAmEOx4dEnUbOZrC3XwxywYll4EfSaeBtDUX0pROZQlx-DTorGEPv2gbBnzhysc2PK685U3ZfsUfEwaWmycS0R-9b_dSeFgRyw" -d '<some-data>' <some-url>

and the output:

Summary:
  Success rate: 100.00%
  Total:    265.5045 secs
  Slowest:  213.5019 secs
  Fastest:  10.6163 secs
  Average:  119.1283 secs
  Requests/sec: 0.1996

  Total data:   470.35 KiB
  Size/request: 8.87 KiB
  Size/sec: 1.77 KiB

Response time histogram:
   10.616 [1]  |■■
   30.905 [1]  |■■
   51.193 [0]  |
   71.482 [8]  |■■■■■■■■■■■■■■■■■■
   91.771 [5]  |■■■■■■■■■■■
  112.059 [8]  |■■■■■■■■■■■■■■■■■■
  132.348 [8]  |■■■■■■■■■■■■■■■■■■
  152.636 [5]  |■■■■■■■■■■■
  172.925 [14] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  193.213 [2]  |■■■■
  213.502 [1]  |■■

Response time distribution:
  10.00% in 61.2655 secs
  25.00% in 81.2649 secs
  50.00% in 116.4977 secs
  75.00% in 159.9910 secs
  90.00% in 168.9835 secs
  95.00% in 173.2801 secs
  99.00% in 213.5019 secs
  99.90% in 213.5019 secs
  99.99% in 213.5019 secs

Details (average, fastest, slowest):
  DNS+dialup:   0.4218 secs, 0.3972 secs, 0.4479 secs
  DNS-lookup:   0.0006 secs, 0.0000 secs, 0.0235 secs

Status code distribution:
  [200] 53 responses

by deadline you mean -z? Can I configure it somehow to wait for unfinished requests after the deadline? Setting -n to 60*5 maybe and not configuring -z?

hatoo commented 2 months ago

Thank you, it looks that oha has done only 53 requests because the server isn't fast enough.

by deadline you mean -z? Can I configure it somehow to wait for unfinished requests after the deadline? Setting -n to 60*5 maybe and not configuring -z?

Yes, you can make 300 requests by -n 300 and not setting -z

pvardanis commented 2 months ago

Ok, just to clarify, will the -q 5 still apply?

hatoo commented 2 months ago

Yes