rakyll / hey

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

hey -n 5 -c 2 sends 870 requests? #235

Closed bsolomon1124 closed 3 years ago

bsolomon1124 commented 3 years ago

I'm using hey installed via homebrew.

Using -n 5 -c 2 sends 870 requests.

$ hey -n 5 -c 2 -z 30s -t 9 http://127.0.0.1:8000/

Summary:
  Total:    30.0324 secs

...

Status code distribution:
  [200] 870 responses

My naive assumption after seeing the help string and Work.N ("N is the total number of requests to make") is that this hey invocation would send a total of 5 requests.

Clearly I am misunderstanding -n. If it's not the number of requests, what is it?


Brew info:

$ brew info hey
Warning: Treating hey as a formula. For the cask, use homebrew/cask/hey
hey: stable 0.1.4 (bottled)
HTTP load generator, ApacheBench (ab) replacement
https://github.com/rakyll/hey
/usr/local/Cellar/hey/0.1.4 (5 files, 9.6MB) *
  Poured from bottle on 2020-12-21 at 22:26:22
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/hey.rb
License: Apache-2.0
==> Dependencies
Build: go ✘
==> Analytics
install: 723 (30 days), 2,359 (90 days), 9,503 (365 days)
install-on-request: 725 (30 days), 2,360 (90 days), 9,496 (365 days)
build-error: 0 (30 days)
namidairo777 commented 3 years ago

In readme it explained,

  -z  Duration of application to send requests. When duration is reached,
      application stops and exits. If duration is specified, n is ignored.

So your requests will be ignored due to given specified duration parameter. Similar to issue: https://github.com/rakyll/hey/issues/197 What if you remove -z 30s and execute it again?

bsolomon1124 commented 3 years ago

Yep, that's what I was missing. Thanks @namidairo777 !

$ hey -n 5 -c 1 -t 9 http://127.0.0.1:8000/

...

  [200] 5 responses