codesenberg / bombardier

Fast cross-platform HTTP benchmarking tool written in Go
MIT License
6.06k stars 317 forks source link

Speedup for completion barrier (less locking) #77

Closed maurice2k closed 1 year ago

maurice2k commented 3 years ago

Removed selecting on channels in hot paths

codesenberg commented 1 year ago

Thanks for your contribution @maurice2k.

I was curious how much of an improvement this change will cause and ran a few tests against cmd/utils/simplebenchserver. Here are the results on my machine (16 Cores x 3.2-4.7 GHz):

This PR:

$ bombardier.exe -d1m http://localhost:8080
Bombarding http://localhost:8080 for 1m0s using 125 connection(s)
[================================================] 1m0s 
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec    328486.98   11889.12  464843.00
  Latency      378.98us   616.24us   347.31ms
  HTTP codes:
    1xx - 0, 2xx - 19712897, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:   383.20MB/s

$ bombardier.exe -d5m http://localhost:8080
Bombarding http://localhost:8080 for 5m0s using 125 connection(s)
[================================================] 5m0s 
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec    269286.56   96185.05  450674.79
  Latency      462.73us   221.00us   319.48ms
  HTTP codes:
    1xx - 0, 2xx - 80788820, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:   314.09MB/s

Current HEAD (e09641f):

$ bombardier.exe -d1m http://localhost:8080
Bombarding http://localhost:8080 for 1m0s using 125 connection(s)
[================================================] 1m0s 
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec    327690.04   11113.67  391882.81
  Latency      379.89us   493.28us   322.97ms
  HTTP codes:
    1xx - 0, 2xx - 19660925, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:   382.19MB/s

$ bombardier.exe -d5m http://localhost:8080
Bombarding http://localhost:8080 for 5m0s using 125 connection(s)
[================================================] 5m0s 
Done!
Statistics        Avg      Stdev        Max
  Reqs/sec    264233.34   96375.27  589428.17
  Latency      471.47us   246.54us   324.91ms
  HTTP codes:
    1xx - 0, 2xx - 79261476, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:   308.15MB/s

It would seem that locking and those particular channels do not slow down the program a whole lot.