Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks - add ResponseTimeWrk files #2895

Merged
merged 2 commits into from Sep 11, 2022
Merged

Conversation

MSP-Greg
Copy link
Member

Description

Puma handles four types of response bodies:

  • Single element Array
  • Multi-element Array
  • Enum
  • File/IO

This PR provides a shell script and additional files to start a Puma server, then collect and summarize data from one or more 'wrk' runs, varying the body type and size. Arguments for the shell script allow one to specify one or more body types/sizes. Default creates 28 wrk runs, using all four above body types and sizes ranging from 1kB to 2,048 kB.

This PR only add files to a new 'benchmarks/local' directory and adds rackup files to 'test/rackup'

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added (or updated) appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop.

@MSP-Greg
Copy link
Member Author

All the Ruby files in this PR are namespaced in TestPuma. Two md files are also added to the docs folder. See:

Testing - benchmark/local files

Testing - test/rackup/ci-*.ru files

Also, see TestPuma and the other modules/classes in its namespace.

Sample Summary output:

Type   req/sec    50%     75%     90%     99%    100%  Resp Size
─────────────────────────────────────────────────────────────────    1kB
array   13710    0.74    2.52    5.23    7.76   37.45      1024
chunk   13502    0.76    2.55    5.28    7.84   11.23      1042
string  13794    0.74    2.51    5.20    7.75   14.07      1024
io       9615    1.16    3.45    7.13   10.57   15.75      1024
─────────────────────────────────────────────────────────────────   10kB
array   13458    0.76    2.57    5.31    7.93   13.94     10239
chunk   13066    0.78    2.64    5.46    8.18   38.48     10320
string  13500    0.76    2.55    5.29    7.88   11.42     10240
io       9293    1.18    3.59    7.39   10.94   16.99     10240
─────────────────────────────────────────────────────────────────  100kB
array   11315    0.96    3.06    6.33    9.49   17.69    102424
chunk    9916    1.10    3.48    7.20   10.73   15.14    103075
string  10948    1.00    3.17    6.57    9.83   17.88    102378
io       8901    1.21    3.72    7.48   11.27   59.98    102407
─────────────────────────────────────────────────────────────────  256kB
array    9217    1.15    3.82    7.88   11.74   17.12    262212
chunk    7339    1.45    4.76    9.81   14.63   22.70    264007
string   8574    1.19    3.81    7.73   11.21   15.80    262147
io       8911    1.19    3.80    7.55   15.25   60.01    262183
─────────────────────────────────────────────────────────────────  512kB
array    6951    1.49    5.03   10.28   15.90   25.08    524378
chunk    5234    2.03    6.56   13.57   20.46   32.15    527862
string   6438    1.55    5.04   10.12   16.28   72.87    524275
io       8533    1.15    4.62    8.79   48.15   70.51    524327
───────────────────────────────────────────────────────────────── 1024kB
array    4122    1.80   15.59   41.87   67.79  121.00   1048565
chunk    3158    2.82   15.22   31.00   71.39   99.90   1055654
string   4710    2.24    6.66   13.65   20.38   70.44   1048575
io       8355    1.23    3.95    7.94   14.08   68.54   1048498
───────────────────────────────────────────────────────────────── 2048kB
array    2454    4.12   14.02   27.70   43.48   88.89   2097415
chunk    1743    6.26   17.65   36.98   55.78   92.10   2111358
string   2479    4.38   12.52   25.65   38.44   95.62   2097502
io       8264    1.25    3.83    7.76   11.73   65.69   2097090

Body    ────────── req/sec ──────────   ─────── req 50% times ───────
 KB     array   chunk  string      io   array   chunk  string      io
1       13710   13502   13794    9615   0.745   0.757   0.741   1.160
10      13458   13066   13500    9293   0.760   0.784   0.759   1.180
100     11315    9916   10948    8901   0.960   1.100   1.000   1.210
256      9217    7339    8574    8911   1.150   1.450   1.190   1.190
512      6951    5234    6438    8533   1.490   2.030   1.550   1.150
1024     4122    3158    4710    8355   1.800   2.820   2.240   1.230
2048     2454    1743    2479    8264   4.120   6.260   4.380   1.250
─────────────────────────────────────────────────────────────────────
wrk -t8 -c16 -d10s
benchmarks/local/response_time_wrk.sh -w2 -t5:5 -s tcp6 -Y
Server cluster mode -w2 -t5:5, bind: tcp6
Puma repo branch 00-response-refactor
ruby 3.2.0dev (2022-06-14T01:21:55Z master 048f14221c) +YJIT [x86_64-linux]

[2136] - Gracefully shutting down workers...
[2136] === puma shutdown: 2022-06-13 21:16:13 -0500 ===
[2136] - Goodbye!

 5:15 Total Time

Note the above was run with an update to Puma. Current master does not perform as well. PR for that shortly...

@MSP-Greg
Copy link
Member Author

MSP-Greg commented Sep 9, 2022

The above shows quite a few tests, one can also filter with the -b argument. For instance, the following is the output from just running File/IO bodies. The command line is listed along with other info at the bottom, and the Puma cmd line is listed at the top, so one can copy it and run a server as in the tests...

I keep pulling these commits from branch to branch for local testing, so I'm thinking of committing it.

Anyone tried it? Doc's may need some work, not sure.

bundle exec bin/puma -q -b tcp://[::1]:40001 -S tmp/bench_test_puma.state -w4 -t5:5 --control-url=tcp://127.0.0.1:40010 --control-token=test test/rackup/ci_select.ru

# < clipped - Puma startup log>

warm-up
wrk -t2 -c4 -d1s --latency -H 'Body-Conf: i10'   http://[::1]:40001 |  19457 requests in  1.10s, 222.91MB read

wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i1'    http://[::1]:40001 | 213927 requests in 10.10s, 570.43MB read
wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i10'   http://[::1]:40001 | 210721 requests in 10.10s,   2.36GB read
wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i100'  http://[::1]:40001 | 189968 requests in 10.10s,  18.43GB read
wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i256'  http://[::1]:40001 | 174073 requests in 10.10s,  42.79GB read
wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i512'  http://[::1]:40001 | 166182 requests in 10.10s,  81.42GB read
wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i1024' http://[::1]:40001 | 174347 requests in 10.10s, 170.55GB read
wrk -t8 -c16 -d10s --latency -H 'Body-Conf: i2048' http://[::1]:40001 | 154965 requests in 10.10s, 302.92GB read

Size   req/sec    50%     75%     90%     99%    100%  Resp Size
───────────────────────────────────────────────────────────────── io
1       21179   0.599   1.230   2.000   3.000   9.030      1022
10      20862   0.588   1.190   1.890   2.750   7.830     10238
100     18808   0.563   1.240   1.660   2.030  11.420    102370
256     17233   0.825   1.190   1.610   2.520   7.050    262188
512     16452   0.880   1.230   1.590   2.610  49.920    524295
1024    17261   0.827   1.280   1.760   2.700  15.830   1048553
2048    15341   0.960   1.260   1.600   2.430   6.410   2097151

wrk -t8 -c16 -d10s
benchmarks/local/response_time_wrk.sh -w4 -t5:5 -s tcp6 -Y -b i -T8 -c2
Server cluster mode -w4 -t5:5, bind: tcp6
Puma repo branch 00-master-bench
ruby 3.2.0dev (2022-09-09T10:38:52Z master b350053ae4) +YJIT [x86_64-linux]

@MSP-Greg MSP-Greg merged commit f02cdcd into puma:master Sep 11, 2022
@MSP-Greg MSP-Greg deleted the 00-bench branch September 11, 2022 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant