puma 8.1.0-java → 8.1.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +10 -0
  3. data/README.md +16 -381
  4. data/docs/binding.md +135 -0
  5. data/docs/cluster_mode.md +241 -0
  6. data/docs/configuration.md +78 -0
  7. data/docs/{stats.md → control_server.md} +23 -3
  8. data/docs/{deployment.md → deployment/README.md} +20 -4
  9. data/docs/{kubernetes.md → deployment/kubernetes.md} +1 -1
  10. data/docs/plugins.md +61 -2
  11. data/docs/puma_support.md +15 -1
  12. data/docs/restart.md +5 -1
  13. data/docs/signals.md +2 -0
  14. data/docs/{5.0-Upgrade.md → upgrading/5.0-Upgrade.md} +3 -3
  15. data/docs/{6.0-Upgrade.md → upgrading/6.0-Upgrade.md} +2 -2
  16. data/docs/{7.0-Upgrade.md → upgrading/7.0-Upgrade.md} +2 -2
  17. data/docs/{8.0-Upgrade.md → upgrading/8.0-Upgrade.md} +2 -2
  18. data/lib/puma/cluster.rb +0 -1
  19. data/lib/puma/const.rb +1 -1
  20. data/lib/puma/minissl.rb +1 -4
  21. data/lib/puma/puma_http11.jar +0 -0
  22. metadata +17 -35
  23. data/docs/fork_worker.md +0 -71
  24. data/docs/grpc.md +0 -62
  25. data/docs/jungle/README.md +0 -9
  26. data/docs/testing_benchmarks_local_files.md +0 -150
  27. data/docs/testing_test_rackup_ci_files.md +0 -36
  28. data/ext/puma_http11/PumaHttp11Service.java +0 -17
  29. data/ext/puma_http11/extconf.rb +0 -67
  30. data/ext/puma_http11/http11_parser.c +0 -1061
  31. data/ext/puma_http11/http11_parser.h +0 -65
  32. data/ext/puma_http11/http11_parser.java.rl +0 -131
  33. data/ext/puma_http11/http11_parser.rl +0 -149
  34. data/ext/puma_http11/http11_parser_common.rl +0 -57
  35. data/ext/puma_http11/mini_ssl.c +0 -863
  36. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -15
  37. data/ext/puma_http11/org/jruby/puma/EnvKey.java +0 -241
  38. data/ext/puma_http11/org/jruby/puma/Http11.java +0 -321
  39. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -441
  40. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +0 -519
  41. data/ext/puma_http11/puma_http11.c +0 -524
  42. data/tools/Dockerfile +0 -26
  43. data/tools/trickletest.rb +0 -44
  44. /data/docs/{nginx.md → deployment/nginx.md} +0 -0
  45. /data/docs/{jungle → deployment}/rc.d/README.md +0 -0
  46. /data/docs/{jungle → deployment}/rc.d/puma +0 -0
  47. /data/docs/{jungle → deployment}/rc.d/puma.conf +0 -0
  48. /data/docs/{systemd.md → deployment/systemd.md} +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.0
4
+ version: 8.1.1
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
@@ -42,15 +42,19 @@ files:
42
42
  - bin/puma
43
43
  - bin/puma-wild
44
44
  - bin/pumactl
45
- - docs/5.0-Upgrade.md
46
- - docs/6.0-Upgrade.md
47
- - docs/7.0-Upgrade.md
48
- - docs/8.0-Upgrade.md
49
45
  - docs/architecture.md
46
+ - docs/binding.md
47
+ - docs/cluster_mode.md
50
48
  - docs/compile_options.md
51
- - docs/deployment.md
52
- - docs/fork_worker.md
53
- - docs/grpc.md
49
+ - docs/configuration.md
50
+ - docs/control_server.md
51
+ - docs/deployment/README.md
52
+ - docs/deployment/kubernetes.md
53
+ - docs/deployment/nginx.md
54
+ - docs/deployment/rc.d/README.md
55
+ - docs/deployment/rc.d/puma
56
+ - docs/deployment/rc.d/puma.conf
57
+ - docs/deployment/systemd.md
54
58
  - docs/images/favicon.svg
55
59
  - docs/images/puma-connection-flow-no-reactor.png
56
60
  - docs/images/puma-connection-flow.png
@@ -58,35 +62,15 @@ files:
58
62
  - docs/images/running-puma.svg
59
63
  - docs/images/standard-logo.svg
60
64
  - docs/java_options.md
61
- - docs/jungle/README.md
62
- - docs/jungle/rc.d/README.md
63
- - docs/jungle/rc.d/puma
64
- - docs/jungle/rc.d/puma.conf
65
- - docs/kubernetes.md
66
- - docs/nginx.md
67
65
  - docs/plugins.md
68
66
  - docs/puma_support.md
69
67
  - docs/rails_dev_mode.md
70
68
  - docs/restart.md
71
69
  - docs/signals.md
72
- - docs/stats.md
73
- - docs/systemd.md
74
- - docs/testing_benchmarks_local_files.md
75
- - docs/testing_test_rackup_ci_files.md
76
- - ext/puma_http11/PumaHttp11Service.java
77
- - ext/puma_http11/extconf.rb
78
- - ext/puma_http11/http11_parser.c
79
- - ext/puma_http11/http11_parser.h
80
- - ext/puma_http11/http11_parser.java.rl
81
- - ext/puma_http11/http11_parser.rl
82
- - ext/puma_http11/http11_parser_common.rl
83
- - ext/puma_http11/mini_ssl.c
84
- - ext/puma_http11/no_ssl/PumaHttp11Service.java
85
- - ext/puma_http11/org/jruby/puma/EnvKey.java
86
- - ext/puma_http11/org/jruby/puma/Http11.java
87
- - ext/puma_http11/org/jruby/puma/Http11Parser.java
88
- - ext/puma_http11/org/jruby/puma/MiniSSL.java
89
- - ext/puma_http11/puma_http11.c
70
+ - docs/upgrading/5.0-Upgrade.md
71
+ - docs/upgrading/6.0-Upgrade.md
72
+ - docs/upgrading/7.0-Upgrade.md
73
+ - docs/upgrading/8.0-Upgrade.md
90
74
  - lib/puma.rb
91
75
  - lib/puma/app/status.rb
92
76
  - lib/puma/binder.rb
@@ -132,8 +116,6 @@ files:
132
116
  - lib/puma/thread_pool.rb
133
117
  - lib/puma/util.rb
134
118
  - lib/rack/handler/puma.rb
135
- - tools/Dockerfile
136
- - tools/trickletest.rb
137
119
  homepage: https://puma.io
138
120
  licenses:
139
121
  - BSD-3-Clause
@@ -158,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
140
  - !ruby/object:Gem::Version
159
141
  version: '0'
160
142
  requirements: []
161
- rubygems_version: 4.0.21
143
+ rubygems_version: 4.0.23
162
144
  specification_version: 4
163
145
  summary: A Ruby/Rack web server built for parallelism.
164
146
  test_files: []
data/docs/fork_worker.md DELETED
@@ -1,71 +0,0 @@
1
- # Fork-Worker Cluster Mode [Experimental]
2
-
3
- `fork_worker` (`--fork-worker` from the CLI) is an experimental cluster-mode configuration option. This mode causes Puma to fork additional workers from worker 0, instead of directly from the master process.
4
-
5
- ```
6
- 10000 \_ puma 8.0.2 (tcp://0.0.0.0:9292) [puma]
7
- 10001 \_ puma: cluster worker 0: 10000 [puma]
8
- 10002 \_ puma: cluster worker 1: 10000 [puma]
9
- 10003 \_ puma: cluster worker 2: 10000 [puma]
10
- 10004 \_ puma: cluster worker 3: 10000 [puma]
11
- ```
12
-
13
- The `fork_worker` option allows your application to be initialized only once for copy-on-write memory savings, and it has two additional advantages:
14
-
15
- 1. **Compatible with phased restart.** With `preload_app!` disabled, the master process doesn't load the application, so this mode works with phased restart (`SIGUSR1` or `pumactl phased-restart`). When worker 0 reloads as part of a phased restart, it initializes a new copy of your application first, then the other workers reload by forking from this new worker already containing the new preloaded application.
16
-
17
- This allows a phased restart to complete as quickly as a hot restart (`SIGUSR2` or `pumactl restart`), while still minimizing downtime by staggering the restart across cluster workers.
18
-
19
- 2. **'Refork' for additional copy-on-write improvements in running applications.** Fork-worker mode introduces a new `refork` command that re-loads all nonzero workers by re-forking them from worker 0.
20
-
21
- This command can potentially improve memory utilization in large or complex applications that don't fully pre-initialize on startup, because the re-forked workers can share copy-on-write memory with a worker that has been running for a while and serving requests.
22
-
23
- You can trigger a refork by sending the cluster the `SIGURG` signal or running the `pumactl refork` command at any time. A refork will also automatically trigger once, after a certain number of requests have been processed by worker 0 (default 1000). To configure the number of requests before the auto-refork, pass a positive integer argument to `fork_worker` (e.g., `fork_worker 1000`), or `0` to disable.
24
-
25
- ### Usage Considerations
26
-
27
- - `fork_worker` introduces new `before_refork` and `after_refork` configuration hooks. Note the following:
28
- - When initially forking the parent process to the worker 0 child, `before_fork` will trigger on the parent process and `before_worker_boot` will trigger on the worker 0 child as normal.
29
- - When forking the worker 0 child to grandchild workers, `before_refork` and `after_refork` will trigger on the worker 0 child, and `before_worker_boot` will trigger on each grandchild worker.
30
- - For clarity, `before_fork` does not trigger on worker 0, and `after_refork` does not trigger on the grandchild.
31
- - As a general migration guide:
32
- - Copy any logic within your existing `before_fork` hook to the `before_refork` hook.
33
- - Consider copying logic from your `before_worker_boot` hook to the `after_refork` hook, if it is needed to reset the state of worker 0 after it forks.
34
-
35
- ### Limitations
36
-
37
- - This mode is still very experimental so there may be bugs or edge-cases, particularly around expected behavior of existing hooks. Please open a [bug report](https://github.com/puma/puma/issues/new?template=bug_report.md) if you encounter any issues.
38
-
39
- - In order to fork new workers cleanly, worker 0 shuts down its server and stops serving requests so there are no open file descriptors or other kinds of shared global state between processes, and to maximize copy-on-write efficiency across the newly-forked workers. This may temporarily reduce total capacity of the cluster during a phased restart / refork.
40
-
41
- - In a cluster with `n` workers, a normal phased restart stops and restarts workers one by one while the application is loaded in each process, so `n-1` workers are available serving requests during the restart. In a phased restart in fork-worker mode, the application is first loaded in worker 0 while `n-1` workers are available, then worker 0 remains stopped while the rest of the workers are reloaded one by one, leaving only `n-2` workers to be available for a brief period of time. Reloading the rest of the workers should be quick because the application is preloaded at that point, but there may be situations where it can take longer (slow clients, long-running application code, slow worker-fork hooks, etc).
42
-
43
- # Mold-Worker Cluster Mode [Experimental]
44
-
45
- `mold_worker` (`--mold-worker` from the CLI) is an alternative to `fork_worker`. Instead of forking from a worker that also serves requests, Puma promotes a worker to a "mold", which stops serving requests and only forks new workers. Because the mold never serves traffic, a slow request, timeout or memory limit can't take it down mid-refork.
46
-
47
- ```
48
- 10000 \_ puma 8.0.2 (tcp://0.0.0.0:9292) [puma]
49
- 10005 \_ puma: mold 2: 10000 [puma]
50
- 10011 \_ puma: cluster worker 0: 10000 [puma]
51
- 10012 \_ puma: cluster worker 1: 10000 [puma]
52
- 10013 \_ puma: cluster worker 2: 10000 [puma]
53
- ```
54
-
55
- Workers are forked from the master at boot. Each request threshold (default `1000`) promotes the busiest worker to a new mold, retires the previous one, and reforks every worker from the new mold.
56
-
57
- ```ruby
58
- mold_worker 1000, 2000, 4000
59
- ```
60
-
61
- ### Usage Considerations
62
-
63
- - Thresholds are per worker, counted from when that worker booted. Workers forked from a mold start again at zero, so with the config above a worker is promoted after 1000 requests, and a worker from that generation is promoted after another 2000.
64
- - After the last threshold, molds are only replaced by `SIGURG` or `pumactl refork`, which promote the busiest worker at any time.
65
- - A phased restart (`SIGUSR1` or `pumactl phased-restart`) retires the mold and forks workers from the master, so new code is loaded, then starts the thresholds again. As with any phased restart, this requires `preload_app!` to be disabled.
66
- - `mold_worker` cannot be combined with `fork_worker`.
67
- - On Linux 3.4+, workers are reparented to the master rather than orphaned if their mold exits.
68
- - `mold_worker` introduces new `after_mold_promotion` and `before_mold_shutdown` configuration hooks.
69
- - `after_mold_promotion` runs in the mold after it stops serving requests, before it forks any workers. Use it for what you would do in `before_refork`, such as closing connections or running garbage collection.
70
- - `before_mold_shutdown` runs in the mold before it exits.
71
- - `before_worker_boot` runs in each forked worker, as usual. Use it for what you would do in `after_refork`.
data/docs/grpc.md DELETED
@@ -1,62 +0,0 @@
1
- # Using gRPC with Puma in Clustered Mode
2
-
3
- This guide shows how to set up gRPC with Puma in a clustered environment using Puma's hooks to manage gRPC's lifecycle methods during forking.
4
-
5
- ## The Problem
6
-
7
- In a clustered Puma setup, you might encounter the following error when using gRPC:
8
-
9
- ```
10
- grpc cannot be used between calls to GRPC.prefork and GRPC.postfork_child or GRPC.postfork_parent
11
- ```
12
-
13
- To work correctly, gRPC needs these methods called at specific points in the process lifecycle:
14
- - `GRPC.prefork`: Called before forking.
15
- - `GRPC.postfork_child`: Called in the child process after forking.
16
- - `GRPC.postfork_parent`: Called in the parent process after forking.
17
-
18
- Puma provides hooks such as `before_worker_fork`, `after_worker_fork`, and `before_worker_boot` to execute code during these lifecycle events. Understanding the behavior of these hooks is key to ensuring gRPC operates correctly in a clustered setup.
19
-
20
- ## The Solution
21
-
22
- ### Example Configuration
23
-
24
- This configuration integrates gRPC's lifecycle methods in a clustered Puma setup and works whether preloading is enabled or not.
25
-
26
- ```ruby
27
- # config/puma.rb
28
-
29
- is_mac = RUBY_PLATFORM.include?("darwin")
30
-
31
- before_worker_fork do |index|
32
- GRPC.prefork unless is_mac
33
- end
34
-
35
- after_worker_fork do |index|
36
- GRPC.postfork_parent unless is_mac
37
- end
38
-
39
- before_worker_boot do
40
- GRPC.postfork_child unless is_mac
41
- end
42
- ```
43
-
44
- ### Understanding the Lifecycle and Hooks
45
-
46
- Puma's hooks determine when to call gRPC's lifecycle methods. Each hook plays a specific role in managing the lifecycle during forking:
47
-
48
- - **`before_worker_fork`**:
49
- - This hook runs before forking workers and is where you call `GRPC.prefork`.
50
- - In preloading setups (default in Puma v7), it runs in the **master process** before workers are forked, as the application is preloaded in the master process.
51
- - Without preloading, it still runs in the **master process** before forking workers, but the application is not preloaded.
52
- - `GRPC.prefork` is called here to prepare GRPC for the forking process.
53
-
54
- - **`after_worker_fork`**:
55
- - This hook always runs in the **master process** after a worker is forked, regardless of whether preloading is enabled.
56
- - Call `GRPC.postfork_parent` here to finalize the master process's state after forking.
57
-
58
- - **`before_worker_boot`**:
59
- - This hook always runs in the **worker process** after it is forked, regardless of whether preloading is enabled.
60
- - Call `GRPC.postfork_child` here to finalize the worker's state.
61
-
62
- **Note**: On macOS, these methods are skipped because gRPC does not require them due to differences in how forking works.
@@ -1,9 +0,0 @@
1
- # Puma as a service
2
-
3
- ## Systemd
4
-
5
- See [/docs/systemd](https://github.com/puma/puma/blob/main/docs/systemd.md).
6
-
7
- ## rc.d
8
-
9
- See `/docs/jungle/rc.d` for FreeBSD's rc.d scripts
@@ -1,150 +0,0 @@
1
- # Testing - benchmark/local files
2
-
3
- These files generate data that shows request-per-second (RPS), etc. Typically, files are in
4
- pairs, a shell script and a Ruby script. The shell script starts the server, then runs the
5
- Ruby file, which starts client request stream(s), then collects and logs metrics.
6
-
7
- ## response_time_wrk.sh
8
-
9
- This uses [wrk] for generating data. One or more wrk runs are performed. Summarizes RPS and
10
- wrk latency times. The default for the `-b` argument runs 28 different client request streams,
11
- and takes a bit over 5 minutes. See 'Request Stream Configuration' below for `-b` argument
12
- description.
13
-
14
- <details>
15
- <summary>Summary output for<br/><code>benchmarks/local/response_time_wrk.sh -w2 -t5:5 -s tcp6</code>:</summary>
16
-
17
- ```
18
- Type req/sec 50% 75% 90% 99% 100% Resp Size
19
- ───────────────────────────────────────────────────────────────── 1kB
20
- array 13710 0.74 2.52 5.23 7.76 37.45 1024
21
- chunk 13502 0.76 2.55 5.28 7.84 11.23 1042
22
- string 13794 0.74 2.51 5.20 7.75 14.07 1024
23
- io 9615 1.16 3.45 7.13 10.57 15.75 1024
24
- ───────────────────────────────────────────────────────────────── 10kB
25
- array 13458 0.76 2.57 5.31 7.93 13.94 10239
26
- chunk 13066 0.78 2.64 5.46 8.18 38.48 10320
27
- string 13500 0.76 2.55 5.29 7.88 11.42 10240
28
- io 9293 1.18 3.59 7.39 10.94 16.99 10240
29
- ───────────────────────────────────────────────────────────────── 100kB
30
- array 11315 0.96 3.06 6.33 9.49 17.69 102424
31
- chunk 9916 1.10 3.48 7.20 10.73 15.14 103075
32
- string 10948 1.00 3.17 6.57 9.83 17.88 102378
33
- io 8901 1.21 3.72 7.48 11.27 59.98 102407
34
- ───────────────────────────────────────────────────────────────── 256kB
35
- array 9217 1.15 3.82 7.88 11.74 17.12 262212
36
- chunk 7339 1.45 4.76 9.81 14.63 22.70 264007
37
- string 8574 1.19 3.81 7.73 11.21 15.80 262147
38
- io 8911 1.19 3.80 7.55 15.25 60.01 262183
39
- ───────────────────────────────────────────────────────────────── 512kB
40
- array 6951 1.49 5.03 10.28 15.90 25.08 524378
41
- chunk 5234 2.03 6.56 13.57 20.46 32.15 527862
42
- string 6438 1.55 5.04 10.12 16.28 72.87 524275
43
- io 8533 1.15 4.62 8.79 48.15 70.51 524327
44
- ───────────────────────────────────────────────────────────────── 1024kB
45
- array 4122 1.80 15.59 41.87 67.79 121.00 1048565
46
- chunk 3158 2.82 15.22 31.00 71.39 99.90 1055654
47
- string 4710 2.24 6.66 13.65 20.38 70.44 1048575
48
- io 8355 1.23 3.95 7.94 14.08 68.54 1048498
49
- ───────────────────────────────────────────────────────────────── 2048kB
50
- array 2454 4.12 14.02 27.70 43.48 88.89 2097415
51
- chunk 1743 6.26 17.65 36.98 55.78 92.10 2111358
52
- string 2479 4.38 12.52 25.65 38.44 95.62 2097502
53
- io 8264 1.25 3.83 7.76 11.73 65.69 2097090
54
-
55
- Body ────────── req/sec ────────── ─────── req 50% times ───────
56
- KB array chunk string io array chunk string io
57
- 1 13710 13502 13794 9615 0.745 0.757 0.741 1.160
58
- 10 13458 13066 13500 9293 0.760 0.784 0.759 1.180
59
- 100 11315 9916 10948 8901 0.960 1.100 1.000 1.210
60
- 256 9217 7339 8574 8911 1.150 1.450 1.190 1.190
61
- 512 6951 5234 6438 8533 1.490 2.030 1.550 1.150
62
- 1024 4122 3158 4710 8355 1.800 2.820 2.240 1.230
63
- 2048 2454 1743 2479 8264 4.120 6.260 4.380 1.250
64
- ─────────────────────────────────────────────────────────────────────
65
- wrk -t8 -c16 -d10s
66
- benchmarks/local/response_time_wrk.sh -w2 -t5:5 -s tcp6 -Y
67
- Server cluster mode -w2 -t5:5, bind: tcp6
68
- Puma repo branch 00-response-refactor
69
- ruby 3.2.0dev (2022-06-14T01:21:55Z master 048f14221c) +YJIT [x86_64-linux]
70
-
71
- [2136] - Gracefully shutting down workers...
72
- [2136] === puma shutdown: 2022-06-13 21:16:13 -0500 ===
73
- [2136] - Goodbye!
74
-
75
- 5:15 Total Time
76
- ```
77
- </details><br/>
78
-
79
- ## bench_base.sh, bench_base.rb
80
-
81
- These two files set up parameters for the Puma server, which is normally started in a shell
82
- script. It then starts a Ruby file (a subclass of BenchBase), passing arguments to it. The
83
- Ruby file is normally used to generate a client request stream(s).
84
-
85
- ### Puma Configuration
86
-
87
- The following arguments are used for the Puma server:
88
-
89
- * **`-C`** - configuration file
90
- * **`-d`** - app delay
91
- * **`-r`** - rackup file, often defaults to test/rackup/ci_select.ru
92
- * **`-s`** - bind socket type, default is tcp/tcp4, also tcp6, ssl/ssl4, ssl6, unix, or aunix
93
- (unix & abstract unix are not available with wrk).
94
- * **`-t`** - threads, expressed as '5:5', same as Puma --thread
95
- * **`-w`** - workers, same as Puma --worker
96
- * **`-Y`** - enable Ruby YJIT
97
-
98
- ### Request Stream Configuration
99
-
100
- The following arguments are used for request streams:
101
-
102
- * **`-b`** - response body configuration. Body type options are a array, c chunked, s string,
103
- and i for File/IO. None or any combination can be specified, they should start the option.
104
- Then, any combination of comma separated integers can be used for the response body size
105
- in kB. The string 'ac50,100' would create four runs, 50kb array, 50kB chunked, 100kB array,
106
- and 100kB chunked. See 'Testing - test/rackup/ci-*.ru files' for more info.
107
- * **`-c`** - connections per client request stream thread, defaults to 2 for wrk.
108
- * **`-D`** - duration of client request stream in seconds.
109
- * **`-T`** - number of threads in the client request stream. For wrk, this defaults to
110
- 80% of Puma workers * max_threads.
111
-
112
- ### Notes - Configuration
113
-
114
- The above lists script arguments.
115
-
116
- `bench_base.sh` contains most server defaults. Many can be set via ENV variables.
117
-
118
- `bench_base.rb` contains the client request stream defaults. The default value for
119
- `-b` is `acsi1,10,100,256,512,1024,2048`, which is a 4 x 7 matrix, and hence, runs
120
- 28 jobs. Also, the i body type (File/IO) generates files, they are placed in the
121
- `"#{Dir.tmpdir}/.puma_response_body_io"` directory, which is created.
122
-
123
- ### Notes - wrk
124
-
125
- The shell scripts use `-T` for wrk's thread count, since `-t` is used for Puma
126
- server threads. Regarding the `-c` argument, wrk has an interesting behavior.
127
- The total number of connections is set by `(connections/threads).to_i`. The scripts
128
- here use `-c` as connections per thread. Hence, using `-T4 -c2` will yield a total
129
- of eight wrk connections, two per thread. The equivalent wrk arguments would be `-t4 -c8`.
130
-
131
- Puma can only process so many requests, and requests will queue in the backlog
132
- until Puma can respond to them. With wrk, if the number of total connections is
133
- too high, one will see the upper latency times increase, pushing into the lower
134
- latency times as the connections are increased. The default values for wrk's
135
- threads and connections were chosen to minimize requests' time in the backlog.
136
-
137
- An example with four wrk runs using `-b s10`. Notice that `req/sec` varies by
138
- less than 1%, but the `75%` times increase by an order of magnitude:
139
- ```
140
- req/sec 50% 75% 90% 99% 100% Resp Size wrk cmd line
141
- ─────────────────────────────────────────────────────────────────────────────
142
- 13597 0.755 2.550 5.260 7.800 13.310 12040 wrk -t8 -c16 -d10
143
- 13549 0.793 4.430 8.140 11.220 16.600 12002 wrk -t10 -c20 -d10
144
- 13570 1.040 25.790 40.010 49.070 58.300 11982 wrk -t8 -c64 -d10
145
- 13684 1.050 25.820 40.080 49.160 66.190 12033 wrk -t16 -c64 -d10
146
- ```
147
- Finally, wrk's output may cause rounding errors, so the response body size calculation is
148
- imprecise.
149
-
150
- [wrk]: <https://github.com/ioquatix/wrk>
@@ -1,36 +0,0 @@
1
- # Testing - test/rackup/ci-*.ru files
2
-
3
- ## Overview
4
-
5
- Puma should efficiently handle a variety of response bodies, varying both by size
6
- and by the type of object used for the body.
7
-
8
- Five rackup files are located in 'test/rackup' that can be used. All have their
9
- request body size (in kB) set via `Body-Conf` header or with `ENV['CI_BODY_CONF']`.
10
- Additionally, the ci_select.ru file can have its body type set via a starting
11
- character.
12
-
13
- * **ci_array.ru** - body is an `Array` of 1kB strings. `Content-Length` is not set.
14
- * **ci_chunked.ru** - body is an `Enumerator` of 1kB strings. `Content-Length` is not set.
15
- * **ci_io.ru** - body is a File/IO object. `Content-Length` is set.
16
- * **ci_string.ru** - body is a single string. `Content-Length` is set.
17
- * **ci_select.ru** - can be any of the above.
18
-
19
- All responses have 25 headers, total length approx 1kB. ci_array.ru and ci_chunked.ru
20
- contain 1kB items.
21
-
22
- All can be delayed by a float value (seconds) specified by the `Dly` header
23
-
24
- Note that the `Body-Conf` header takes precedence, and `ENV['CI_BODY_CONF']` is
25
- only read on load.
26
-
27
- ## ci_select.ru
28
-
29
- The ci_select.ru file allows a starting character to specify the body type in the
30
- `Body-Conf` header or with `ENV['CI_BODY_CONF']`.
31
- * **a** - array of strings
32
- * **c** - chunked (enum)
33
- * **s** - single string
34
- * **i** - File/IO
35
-
36
- A value of `a100` would return a body as an array of 100 1kB strings.
@@ -1,17 +0,0 @@
1
- package puma;
2
-
3
- import java.io.IOException;
4
-
5
- import org.jruby.Ruby;
6
- import org.jruby.runtime.load.BasicLibraryService;
7
-
8
- import org.jruby.puma.Http11;
9
- import org.jruby.puma.MiniSSL;
10
-
11
- public class PumaHttp11Service implements BasicLibraryService {
12
- public boolean basicLoad(final Ruby runtime) throws IOException {
13
- Http11.createHttp11(runtime);
14
- MiniSSL.createMiniSSL(runtime);
15
- return true;
16
- }
17
- }
@@ -1,67 +0,0 @@
1
- require 'mkmf'
2
-
3
- dir_config("puma_http11")
4
-
5
- if $mingw
6
- append_cflags '-fstack-protector-strong -D_FORTIFY_SOURCE=2'
7
- append_ldflags '-fstack-protector-strong -l:libssp.a'
8
- have_library 'ssp'
9
- end
10
-
11
- have_func "prctl(PR_SET_CHILD_SUBREAPER, 1)", "sys/prctl.h"
12
-
13
- unless ENV["PUMA_DISABLE_SSL"]
14
- # don't use pkg_config('openssl') if '--with-openssl-dir' is used
15
- has_openssl_dir = dir_config('openssl').any? ||
16
- RbConfig::CONFIG['configure_args']&.include?('openssl')
17
-
18
- found_pkg_config = !has_openssl_dir && pkg_config('openssl')
19
-
20
- found_ssl = if !$mingw && found_pkg_config
21
- puts '──── Using OpenSSL pkgconfig (openssl.pc) ────'
22
- true
23
- elsif have_library('libcrypto', 'BIO_read') && have_library('libssl', 'SSL_CTX_new')
24
- true
25
- elsif %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')} &&
26
- %w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')}
27
- true
28
- else
29
- puts '** Puma will be compiled without SSL support'
30
- false
31
- end
32
-
33
- if found_ssl
34
- have_header "openssl/bio.h"
35
-
36
- ssl_h = "openssl/ssl.h".freeze
37
-
38
- puts "\n──── Below are yes for 1.0.2 & later ────"
39
- have_func "DTLS_method" , ssl_h
40
- have_func "SSL_CTX_set_session_cache_mode(NULL, 0)", ssl_h
41
-
42
- puts "\n──── Below are yes for 1.1.0 & later ────"
43
- have_func "TLS_server_method" , ssl_h
44
- have_func "SSL_CTX_set_min_proto_version(NULL, 0)" , ssl_h
45
-
46
- puts "\n──── Below is yes for 1.1.0 and later, but isn't documented until 3.0.0 ────"
47
- # https://github.com/openssl/openssl/blob/OpenSSL_1_1_0/include/openssl/ssl.h#L1159
48
- have_func "SSL_CTX_set_dh_auto(NULL, 0)" , ssl_h
49
-
50
- puts "\n──── Below is yes for 1.1.1 & later ────"
51
- have_func "SSL_CTX_set_ciphersuites(NULL, \"\")" , ssl_h
52
-
53
- puts "\n──── Below is yes for 3.0.0 & later ────"
54
- have_func "SSL_get1_peer_certificate" , ssl_h
55
-
56
- puts ''
57
- end
58
- end
59
-
60
- if ENV["PUMA_MAKE_WARNINGS_INTO_ERRORS"]
61
- # Make all warnings into errors
62
- # Except `implicit-fallthrough` since most failures comes from ragel state machine generated code
63
- append_cflags(config_string('WERRORFLAG') || '-Werror')
64
- append_cflags '-Wno-implicit-fallthrough'
65
- end
66
-
67
- create_makefile("puma/puma_http11")