puma 5.3.2 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.md +284 -11
- data/LICENSE +0 -0
- data/README.md +61 -16
- data/bin/puma-wild +1 -1
- data/docs/architecture.md +49 -16
- data/docs/compile_options.md +38 -2
- data/docs/deployment.md +53 -67
- data/docs/fork_worker.md +1 -3
- data/docs/images/puma-connection-flow-no-reactor.png +0 -0
- data/docs/images/puma-connection-flow.png +0 -0
- data/docs/images/puma-general-arch.png +0 -0
- data/docs/jungle/README.md +0 -0
- data/docs/jungle/rc.d/README.md +0 -0
- data/docs/jungle/rc.d/puma.conf +0 -0
- data/docs/kubernetes.md +0 -0
- data/docs/nginx.md +0 -0
- data/docs/plugins.md +15 -15
- data/docs/rails_dev_mode.md +2 -3
- data/docs/restart.md +6 -6
- data/docs/signals.md +11 -10
- data/docs/stats.md +8 -8
- data/docs/systemd.md +64 -67
- data/docs/testing_benchmarks_local_files.md +150 -0
- data/docs/testing_test_rackup_ci_files.md +36 -0
- data/ext/puma_http11/PumaHttp11Service.java +0 -0
- data/ext/puma_http11/ext_help.h +0 -0
- data/ext/puma_http11/extconf.rb +44 -13
- data/ext/puma_http11/http11_parser.c +24 -11
- data/ext/puma_http11/http11_parser.h +1 -1
- data/ext/puma_http11/http11_parser.java.rl +2 -2
- data/ext/puma_http11/http11_parser.rl +2 -2
- data/ext/puma_http11/http11_parser_common.rl +3 -3
- data/ext/puma_http11/mini_ssl.c +122 -23
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -0
- data/ext/puma_http11/org/jruby/puma/Http11.java +3 -3
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +50 -48
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +188 -102
- data/ext/puma_http11/puma_http11.c +18 -10
- data/lib/puma/app/status.rb +9 -6
- data/lib/puma/binder.rb +81 -42
- data/lib/puma/cli.rb +23 -19
- data/lib/puma/client.rb +124 -30
- data/lib/puma/cluster/worker.rb +21 -29
- data/lib/puma/cluster/worker_handle.rb +8 -1
- data/lib/puma/cluster.rb +57 -48
- data/lib/puma/commonlogger.rb +0 -0
- data/lib/puma/configuration.rb +74 -55
- data/lib/puma/const.rb +21 -24
- data/lib/puma/control_cli.rb +22 -19
- data/lib/puma/detect.rb +10 -2
- data/lib/puma/dsl.rb +196 -57
- data/lib/puma/error_logger.rb +17 -9
- data/lib/puma/events.rb +6 -126
- data/lib/puma/io_buffer.rb +29 -4
- data/lib/puma/jruby_restart.rb +2 -1
- data/lib/puma/{json.rb → json_serialization.rb} +1 -1
- data/lib/puma/launcher/bundle_pruner.rb +104 -0
- data/lib/puma/launcher.rb +108 -154
- data/lib/puma/log_writer.rb +137 -0
- data/lib/puma/minissl/context_builder.rb +29 -16
- data/lib/puma/minissl.rb +115 -38
- data/lib/puma/null_io.rb +5 -0
- data/lib/puma/plugin/tmp_restart.rb +1 -1
- data/lib/puma/plugin.rb +2 -2
- data/lib/puma/rack/builder.rb +5 -5
- data/lib/puma/rack/urlmap.rb +0 -0
- data/lib/puma/rack_default.rb +1 -1
- data/lib/puma/reactor.rb +3 -3
- data/lib/puma/request.rb +293 -153
- data/lib/puma/runner.rb +63 -28
- data/lib/puma/server.rb +83 -88
- data/lib/puma/single.rb +10 -10
- data/lib/puma/state_file.rb +39 -7
- data/lib/puma/systemd.rb +3 -2
- data/lib/puma/thread_pool.rb +22 -17
- data/lib/puma/util.rb +20 -15
- data/lib/puma.rb +12 -9
- data/lib/rack/handler/puma.rb +9 -9
- data/tools/Dockerfile +1 -1
- data/tools/trickletest.rb +0 -0
- metadata +13 -9
- data/lib/puma/queue_close.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8a1a6014d9e1130e8ba06d5f74d472216448df3dbce4c15c4c24c91fbfe5e30
|
4
|
+
data.tar.gz: f1be3485e37cd230f6c35854aeb959ffeab1dac0162bf482799a4755222bc498
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbdd201a97e5dffccbbb8d8f336693746b87763313422a94ac21f73641ca712b9d2461051cc0bd02771b51af606ce595c2dd09bff0c716146cf9ac56e7ae51f4
|
7
|
+
data.tar.gz: e378848b22d1139559edd6736a9164a5cd98064c6232f0b2cc108122f79c93429ec33b156baa17e6ff82e9b3c77dbddbd22b2a0525a16f749129cf6f70c006da
|
data/History.md
CHANGED
@@ -1,14 +1,156 @@
|
|
1
|
+
## 6.0.0 / 2022-10-XX
|
2
|
+
|
3
|
+
* Breaking Changes
|
4
|
+
* Dropping Ruby 2.2 and 2.3 support (now 2.4+) ([#2919])
|
5
|
+
* Remote_addr functionality has changed ([#2652], [#2653])
|
6
|
+
* No longer supporting Java 1.7 or below (JRuby 9.1 was the last release to support this) ([#2849])
|
7
|
+
* Remove nakayoshi GC ([#2933], [#2925])
|
8
|
+
* wait_for_less_busy_worker is now default on ([#2940])
|
9
|
+
* Prefix all environment variables with `PUMA_` ([#2924], [#2853])
|
10
|
+
* Removed some constants ([#2957], [#2958], [#2959], [#2960])
|
11
|
+
* The following classes are now part of Puma's private API: `Client`, `Cluster::Worker`, `Cluster::Worker`, `HandleRequest`. ([#2988])
|
12
|
+
|
13
|
+
* Features
|
14
|
+
* Increase throughput on large (100kb+) response bodies by 3-10x ([#2896], [#2892])
|
15
|
+
* Increase throughput on file responses ([#2923])
|
16
|
+
* Add support for streaming bodies in Rack. ([#2740])
|
17
|
+
* Allow OpenSSL session reuse via a 'reuse' ssl_bind method or bind string query parameter ([#2845])
|
18
|
+
* Allow `run_hooks` to pass a hash to blocks for use later ([#2917], [#2915])
|
19
|
+
* Allow using `preload_app!` with `fork_worker` ([#2907])
|
20
|
+
* Support request_body_wait metric with higher precision ([#2953])
|
21
|
+
* Allow header values to be arrays (Rack 3) ([#2936], [#2931])
|
22
|
+
* Export Puma/Ruby versions in /stats ([#2875])
|
23
|
+
* Allow configuring request uri max length & request path max length ([#2840])
|
24
|
+
* Add a couple of public accessors ([#2774])
|
25
|
+
* Log entire backtrace when worker start fails ([#2891])
|
26
|
+
* [jruby] Enable TLSv1.3 support ([#2886])
|
27
|
+
* [jruby] support setting TLS protocols + rename ssl_cipher_list ([#2899])
|
28
|
+
* [jruby] Support a truststore option ([#2849], [#2904], [#2884])
|
29
|
+
|
30
|
+
* Bugfixes
|
31
|
+
* Load the configuration before passing it to the binder ([#2897])
|
32
|
+
* Do not raise error raised on HTTP methods we don't recognize or support, like CONNECT ([#2932], [#1441])
|
33
|
+
* Fixed a memory leak when creating a new SSL listener ([#2956])
|
34
|
+
|
35
|
+
* Refactor
|
36
|
+
* log_writer.rb - add internal_write method ([#2888])
|
37
|
+
* [WIP] Refactor: Split out LogWriter from Events (no logic change) ([#2798])
|
38
|
+
* Extract prune_bundler code into it's own class. ([#2797])
|
39
|
+
* Refactor Launcher#run to increase readability (no logic change) ([#2795])
|
40
|
+
* Ruby 3.2 will have native IO#wait_* methods, don't require io/wait ([#2903])
|
41
|
+
* Various internal API refactorings ([#2942], [#2921], [#2922], [#2955])
|
42
|
+
|
43
|
+
## 5.6.5 / 2022-08-23
|
44
|
+
|
45
|
+
* Feature
|
46
|
+
* Puma::ControlCLI - allow refork command to be sent as a request ([#2868], [#2866])
|
47
|
+
|
48
|
+
* Bugfixes
|
49
|
+
* NullIO#closed should return false ([#2883])
|
50
|
+
* [jruby] Fix TLS verification hang ([#2890], [#2729])
|
51
|
+
* extconf.rb - don't use pkg_config('openssl') if '--with-openssl-dir' is used ([#2885], [#2839])
|
52
|
+
* MiniSSL - detect SSL_CTX_set_dh_auto ([#2864], [#2863])
|
53
|
+
* Fix rack.after_reply exceptions breaking connections ([#2861], [#2856])
|
54
|
+
* Escape SSL cert and filenames ([#2855])
|
55
|
+
* Fail hard if SSL certs or keys are invalid ([#2848])
|
56
|
+
* Fail hard if SSL certs or keys cannot be read by user ([#2847])
|
57
|
+
* Fix build with Opaque DH in LibreSSL 3.5. ([#2838])
|
58
|
+
* Pre-existing socket file removed when TERM is issued after USR2 (if puma is running in cluster mode) ([#2817])
|
59
|
+
* Fix Puma::StateFile#load incompatibility ([#2810])
|
60
|
+
|
61
|
+
## 5.6.4 / 2022-03-30
|
62
|
+
|
63
|
+
* Security
|
64
|
+
* Close several HTTP Request Smuggling exploits (CVE-2022-24790)
|
65
|
+
|
66
|
+
## 5.6.2 / 2022-02-11
|
67
|
+
|
68
|
+
* Bugfix/Security
|
69
|
+
* Response body will always be `close`d. (GHSA-rmj8-8hhh-gv5h, related to [#2809])
|
70
|
+
|
71
|
+
## 5.6.1 / 2022-01-26
|
72
|
+
|
73
|
+
* Bugfixes
|
74
|
+
* Reverted a commit which appeared to be causing occasional blank header values ([#2809])
|
75
|
+
|
76
|
+
## 5.6.0 / 2022-01-25
|
77
|
+
|
78
|
+
* Features
|
79
|
+
* Support `localhost` integration in `ssl_bind` ([#2764], [#2708])
|
80
|
+
* Allow backlog parameter to be set with ssl_bind DSL ([#2780])
|
81
|
+
* Remove yaml (psych) requirement in StateFile ([#2784])
|
82
|
+
* Allow culling of oldest workers, previously was only youngest ([#2773], [#2794])
|
83
|
+
* Add worker_check_interval configuration option ([#2759])
|
84
|
+
* Always send lowlevel_error response to client ([#2731], [#2341])
|
85
|
+
* Support for cert_pem and key_pem with ssl_bind DSL ([#2728])
|
86
|
+
|
87
|
+
* Bugfixes
|
88
|
+
* Keep thread names under 15 characters, prevents breakage on some OSes ([#2733])
|
89
|
+
* Fix two 'old-style-definition' compile warning ([#2807], [#2806])
|
90
|
+
* Log environment correctly using option value ([#2799])
|
91
|
+
* Fix warning from Ruby master (will be 3.2.0) ([#2785])
|
92
|
+
* extconf.rb - fix openssl with old Windows builds ([#2757])
|
93
|
+
* server.rb - rescue handling (`Errno::EBADF`) for `@notify.close` ([#2745])
|
94
|
+
|
95
|
+
* Refactor
|
96
|
+
* server.rb - refactor code using @options[:remote_address] ([#2742])
|
97
|
+
* [jruby] a couple refactorings - avoid copy-ing bytes ([#2730])
|
98
|
+
|
99
|
+
## 5.5.2 / 2021-10-12
|
100
|
+
|
101
|
+
* Bugfixes
|
102
|
+
* Allow UTF-8 in HTTP header values
|
103
|
+
|
104
|
+
## 5.5.1 / 2021-10-12
|
105
|
+
|
106
|
+
* Feature (added as mistake - we don't normally do this on bugfix releases, sorry!)
|
107
|
+
* Allow setting APP_ENV in preference to RACK_ENV or RAILS_ENV ([#2702])
|
108
|
+
|
109
|
+
* Security
|
110
|
+
* Do not allow LF as a line ending in a header (CVE-2021-41136)
|
111
|
+
|
112
|
+
## 5.5.0 / 2021-09-19
|
113
|
+
|
114
|
+
* Features
|
115
|
+
* Automatic SSL certificate provisioning for localhost, via localhost gem ([#2610], [#2257])
|
116
|
+
* add support for the PROXY protocol (v1 only) ([#2654], [#2651])
|
117
|
+
* Add a semantic CLI option for no config file ([#2689])
|
118
|
+
|
119
|
+
* Bugfixes
|
120
|
+
* More elaborate exception handling - lets some dead pumas die. ([#2700], [#2699])
|
121
|
+
* allow multiple after_worker_fork hooks ([#2690])
|
122
|
+
* Preserve BUNDLE_APP_CONFIG on worker fork ([#2688], [#2687])
|
123
|
+
|
124
|
+
* Performance
|
125
|
+
* Fix performance of server-side SSL connection close. ([#2675])
|
126
|
+
|
127
|
+
## 5.4.0 / 2021-07-28
|
128
|
+
|
129
|
+
* Features
|
130
|
+
* Better/expanded names for threadpool threads ([#2657])
|
131
|
+
* Allow pkg_config for OpenSSL ([#2648], [#1412])
|
132
|
+
* Add `rack_url_scheme` to Puma::DSL, allows setting of `rack.url_scheme` header ([#2586], [#2569])
|
133
|
+
|
134
|
+
* Bugfixes
|
135
|
+
* `Binder#parse` - allow for symlinked unix path, add create_activated_fds debug ENV ([#2643], [#2638])
|
136
|
+
* Fix deprecation warning: minissl.c - Use Random.bytes if available ([#2642])
|
137
|
+
* Client certificates: set session id context while creating SSLContext ([#2633])
|
138
|
+
* Fix deadlock issue in thread pool ([#2656])
|
139
|
+
|
140
|
+
* Refactor
|
141
|
+
* Replace `IO.select` with `IO#wait_*` when checking a single IO ([#2666])
|
142
|
+
|
1
143
|
## 5.3.2 / 2021-05-21
|
2
144
|
|
3
145
|
* Bugfixes
|
4
|
-
* Gracefully handle Rack not accepting CLI options (#2630, #2626)
|
5
|
-
* Fix sigterm misbehavior (#2629)
|
6
|
-
* Improvements to keepalive-connection shedding (#2628)
|
146
|
+
* Gracefully handle Rack not accepting CLI options ([#2630], [#2626])
|
147
|
+
* Fix sigterm misbehavior ([#2629])
|
148
|
+
* Improvements to keepalive-connection shedding ([#2628])
|
7
149
|
|
8
150
|
## 5.3.1 / 2021-05-11
|
9
151
|
|
10
152
|
* Security
|
11
|
-
* Close keepalive connections after the maximum number of fast inlined requests (#2625)
|
153
|
+
* Close keepalive connections after the maximum number of fast inlined requests (CVE-2021-29509) ([#2625])
|
12
154
|
|
13
155
|
## 5.3.0 / 2021-05-07
|
14
156
|
|
@@ -220,10 +362,30 @@
|
|
220
362
|
* Support parallel tests in verbose progress reporting ([#2223])
|
221
363
|
* Refactor error handling in server accept loop ([#2239])
|
222
364
|
|
365
|
+
## 4.3.12 / 2022-03-30
|
366
|
+
|
367
|
+
* Security
|
368
|
+
* Close several HTTP Request Smuggling exploits (CVE-2022-24790)
|
369
|
+
|
370
|
+
## 4.3.11 / 2022-02-11
|
371
|
+
|
372
|
+
* Security
|
373
|
+
* Always close the response body (GHSA-rmj8-8hhh-gv5h)
|
374
|
+
|
375
|
+
## 4.3.10 / 2021-10-12
|
376
|
+
|
377
|
+
* Bugfixes
|
378
|
+
* Allow UTF-8 in HTTP header values
|
379
|
+
|
380
|
+
## 4.3.9 / 2021-10-12
|
381
|
+
|
382
|
+
* Security
|
383
|
+
* Do not allow LF as a line ending in a header (CVE-2021-41136)
|
384
|
+
|
223
385
|
## 4.3.8 / 2021-05-11
|
224
386
|
|
225
387
|
* Security
|
226
|
-
* Close keepalive connections after the maximum number of fast inlined requests (#2625)
|
388
|
+
* Close keepalive connections after the maximum number of fast inlined requests (CVE-2021-29509) ([#2625])
|
227
389
|
|
228
390
|
## 4.3.7 / 2020-11-30
|
229
391
|
|
@@ -1753,6 +1915,117 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
1753
1915
|
* Bugfixes
|
1754
1916
|
* Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
|
1755
1917
|
|
1918
|
+
[#2919]:https://github.com/puma/puma/pull/2919 "PR by @MSP-Greg, merged 2022-08-30"
|
1919
|
+
[#2652]:https://github.com/puma/puma/issues/2652 "Issue by @Roguelazer, closed 2022-09-04"
|
1920
|
+
[#2653]:https://github.com/puma/puma/pull/2653 "PR by @Roguelazer, closed 2022-03-07"
|
1921
|
+
[#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
|
1922
|
+
[#2933]:https://github.com/puma/puma/pull/2933 "PR by @cafedomancer, merged 2022-09-09"
|
1923
|
+
[#2925]:https://github.com/puma/puma/issues/2925 "Issue by @nateberkopec, closed 2022-09-09"
|
1924
|
+
[#2940]:https://github.com/puma/puma/pull/2940 "PR by @cafedomancer, merged 2022-09-10"
|
1925
|
+
[#2924]:https://github.com/puma/puma/pull/2924 "PR by @cafedomancer, merged 2022-09-07"
|
1926
|
+
[#2853]:https://github.com/puma/puma/issues/2853 "Issue by @nateberkopec, closed 2022-09-07"
|
1927
|
+
[#2957]:https://github.com/puma/puma/pull/2957 "PR by @JuanitoFatas, merged 2022-09-16"
|
1928
|
+
[#2958]:https://github.com/puma/puma/pull/2958 "PR by @JuanitoFatas, merged 2022-09-16"
|
1929
|
+
[#2959]:https://github.com/puma/puma/pull/2959 "PR by @JuanitoFatas, merged 2022-09-16"
|
1930
|
+
[#2960]:https://github.com/puma/puma/pull/2960 "PR by @JuanitoFatas, merged 2022-09-16"
|
1931
|
+
[#2988]:https://github.com/puma/puma/issues/2988 "Issue by @MSP-Greg, merged 2022-10-12"
|
1932
|
+
[#2896]:https://github.com/puma/puma/pull/2896 "PR by @MSP-Greg, merged 2022-09-13"
|
1933
|
+
[#2892]:https://github.com/puma/puma/pull/2892 "PR by @guilleiguaran, closed 2022-09-13"
|
1934
|
+
[#2923]:https://github.com/puma/puma/pull/2923 "PR by @nateberkopec, merged 2022-09-09"
|
1935
|
+
[#2740]:https://github.com/puma/puma/pull/2740 "PR by @ioquatix, merged 2022-01-29"
|
1936
|
+
[#2845]:https://github.com/puma/puma/issues/2845 "Issue by @donv, closed 2022-03-22"
|
1937
|
+
[#2917]:https://github.com/puma/puma/pull/2917 "PR by @MSP-Greg, merged 2022-09-19"
|
1938
|
+
[#2915]:https://github.com/puma/puma/issues/2915 "Issue by @mperham, closed 2022-09-19"
|
1939
|
+
[#2907]:https://github.com/puma/puma/pull/2907 "PR by @casperisfine, merged 2022-09-15"
|
1940
|
+
[#2953]:https://github.com/puma/puma/pull/2953 "PR by @JuanitoFatas, merged 2022-09-14"
|
1941
|
+
[#2936]:https://github.com/puma/puma/pull/2936 "PR by @MSP-Greg, merged 2022-09-09"
|
1942
|
+
[#2931]:https://github.com/puma/puma/issues/2931 "Issue by @dentarg, closed 2022-09-09"
|
1943
|
+
[#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
|
1944
|
+
[#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
|
1945
|
+
[#2774]:https://github.com/puma/puma/pull/2774 "PR by @ob-stripe, merged 2022-01-31"
|
1946
|
+
[#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
|
1947
|
+
[#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
|
1948
|
+
[#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
|
1949
|
+
[#2904]:https://github.com/puma/puma/pull/2904 "PR by @kares, merged 2022-08-27"
|
1950
|
+
[#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
|
1951
|
+
[#2897]:https://github.com/puma/puma/pull/2897 "PR by @Edouard-chin, merged 2022-08-27"
|
1952
|
+
[#2932]:https://github.com/puma/puma/pull/2932 "PR by @mrzasa, merged 2022-09-12"
|
1953
|
+
[#1441]:https://github.com/puma/puma/issues/1441 "Issue by @nirvdrum, closed 2022-09-12"
|
1954
|
+
[#2956]:https://github.com/puma/puma/pull/2956 "PR by @MSP-Greg, merged 2022-09-15"
|
1955
|
+
[#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
|
1956
|
+
[#2798]:https://github.com/puma/puma/pull/2798 "PR by @johnnyshields, merged 2022-02-05"
|
1957
|
+
[#2797]:https://github.com/puma/puma/pull/2797 "PR by @johnnyshields, merged 2022-02-01"
|
1958
|
+
[#2795]:https://github.com/puma/puma/pull/2795 "PR by @johnnyshields, merged 2022-01-31"
|
1959
|
+
[#2903]:https://github.com/puma/puma/pull/2903 "PR by @MSP-Greg, merged 2022-08-27"
|
1960
|
+
[#2942]:https://github.com/puma/puma/pull/2942 "PR by @nateberkopec, merged 2022-09-15"
|
1961
|
+
[#2921]:https://github.com/puma/puma/issues/2921 "Issue by @MSP-Greg, closed 2022-09-15"
|
1962
|
+
[#2922]:https://github.com/puma/puma/issues/2922 "Issue by @MSP-Greg, closed 2022-09-10"
|
1963
|
+
[#2955]:https://github.com/puma/puma/pull/2955 "PR by @cafedomancer, merged 2022-09-15"
|
1964
|
+
[#2868]:https://github.com/puma/puma/pull/2868 "PR by @MSP-Greg, merged 2022-06-02"
|
1965
|
+
[#2866]:https://github.com/puma/puma/issues/2866 "Issue by @slondr, closed 2022-06-02"
|
1966
|
+
[#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
|
1967
|
+
[#2890]:https://github.com/puma/puma/pull/2890 "PR by @kares, merged 2022-06-01"
|
1968
|
+
[#2729]:https://github.com/puma/puma/issues/2729 "Issue by @kares, closed 2022-06-01"
|
1969
|
+
[#2885]:https://github.com/puma/puma/pull/2885 "PR by @MSP-Greg, merged 2022-05-30"
|
1970
|
+
[#2839]:https://github.com/puma/puma/issues/2839 "Issue by @wlipa, closed 2022-05-30"
|
1971
|
+
[#2864]:https://github.com/puma/puma/pull/2864 "PR by @MSP-Greg, merged 2022-04-26"
|
1972
|
+
[#2863]:https://github.com/puma/puma/issues/2863 "Issue by @eradman, closed 2022-04-26"
|
1973
|
+
[#2861]:https://github.com/puma/puma/pull/2861 "PR by @BlakeWilliams, merged 2022-04-17"
|
1974
|
+
[#2856]:https://github.com/puma/puma/issues/2856 "Issue by @nateberkopec, closed 2022-04-17"
|
1975
|
+
[#2855]:https://github.com/puma/puma/pull/2855 "PR by @stanhu, merged 2022-04-09"
|
1976
|
+
[#2848]:https://github.com/puma/puma/pull/2848 "PR by @stanhu, merged 2022-04-02"
|
1977
|
+
[#2847]:https://github.com/puma/puma/pull/2847 "PR by @stanhu, merged 2022-04-02"
|
1978
|
+
[#2838]:https://github.com/puma/puma/pull/2838 "PR by @epsilon-0, merged 2022-03-03"
|
1979
|
+
[#2817]:https://github.com/puma/puma/pull/2817 "PR by @khustochka, merged 2022-02-20"
|
1980
|
+
[#2810]:https://github.com/puma/puma/pull/2810 "PR by @kzkn, merged 2022-01-27"
|
1981
|
+
[#2809]:https://github.com/puma/puma/pull/2809 "PR by @dentarg, merged 2022-01-26"
|
1982
|
+
[#2764]:https://github.com/puma/puma/pull/2764 "PR by @dentarg, merged 2022-01-18"
|
1983
|
+
[#2708]:https://github.com/puma/puma/issues/2708 "Issue by @erikaxel, closed 2022-01-18"
|
1984
|
+
[#2780]:https://github.com/puma/puma/pull/2780 "PR by @dalibor, merged 2022-01-01"
|
1985
|
+
[#2784]:https://github.com/puma/puma/pull/2784 "PR by @MSP-Greg, merged 2022-01-01"
|
1986
|
+
[#2773]:https://github.com/puma/puma/pull/2773 "PR by @ob-stripe, merged 2022-01-01"
|
1987
|
+
[#2794]:https://github.com/puma/puma/pull/2794 "PR by @johnnyshields, merged 2022-01-10"
|
1988
|
+
[#2759]:https://github.com/puma/puma/pull/2759 "PR by @ob-stripe, merged 2021-12-11"
|
1989
|
+
[#2731]:https://github.com/puma/puma/pull/2731 "PR by @baelter, merged 2021-11-02"
|
1990
|
+
[#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2021-11-02"
|
1991
|
+
[#2728]:https://github.com/puma/puma/pull/2728 "PR by @dalibor, merged 2021-10-31"
|
1992
|
+
[#2733]:https://github.com/puma/puma/pull/2733 "PR by @ob-stripe, merged 2021-12-12"
|
1993
|
+
[#2807]:https://github.com/puma/puma/pull/2807 "PR by @MSP-Greg, merged 2022-01-25"
|
1994
|
+
[#2806]:https://github.com/puma/puma/issues/2806 "Issue by @olleolleolle, closed 2022-01-25"
|
1995
|
+
[#2799]:https://github.com/puma/puma/pull/2799 "PR by @ags, merged 2022-01-22"
|
1996
|
+
[#2785]:https://github.com/puma/puma/pull/2785 "PR by @MSP-Greg, merged 2022-01-02"
|
1997
|
+
[#2757]:https://github.com/puma/puma/pull/2757 "PR by @MSP-Greg, merged 2021-11-24"
|
1998
|
+
[#2745]:https://github.com/puma/puma/pull/2745 "PR by @MSP-Greg, merged 2021-11-03"
|
1999
|
+
[#2742]:https://github.com/puma/puma/pull/2742 "PR by @MSP-Greg, merged 2021-12-12"
|
2000
|
+
[#2730]:https://github.com/puma/puma/pull/2730 "PR by @kares, merged 2021-11-01"
|
2001
|
+
[#2702]:https://github.com/puma/puma/pull/2702 "PR by @jacobherrington, merged 2021-09-21"
|
2002
|
+
[#2610]:https://github.com/puma/puma/pull/2610 "PR by @ye-lin-aung, merged 2021-08-18"
|
2003
|
+
[#2257]:https://github.com/puma/puma/issues/2257 "Issue by @nateberkopec, closed 2021-08-18"
|
2004
|
+
[#2654]:https://github.com/puma/puma/pull/2654 "PR by @Roguelazer, merged 2021-09-07"
|
2005
|
+
[#2651]:https://github.com/puma/puma/issues/2651 "Issue by @Roguelazer, closed 2021-09-07"
|
2006
|
+
[#2689]:https://github.com/puma/puma/pull/2689 "PR by @jacobherrington, merged 2021-09-05"
|
2007
|
+
[#2700]:https://github.com/puma/puma/pull/2700 "PR by @ioquatix, merged 2021-09-16"
|
2008
|
+
[#2699]:https://github.com/puma/puma/issues/2699 "Issue by @ioquatix, closed 2021-09-16"
|
2009
|
+
[#2690]:https://github.com/puma/puma/pull/2690 "PR by @doits, merged 2021-09-06"
|
2010
|
+
[#2688]:https://github.com/puma/puma/pull/2688 "PR by @jdelStrother, merged 2021-09-03"
|
2011
|
+
[#2687]:https://github.com/puma/puma/issues/2687 "Issue by @jdelStrother, closed 2021-09-03"
|
2012
|
+
[#2675]:https://github.com/puma/puma/pull/2675 "PR by @devwout, merged 2021-09-08"
|
2013
|
+
[#2657]:https://github.com/puma/puma/pull/2657 "PR by @olivierbellone, merged 2021-07-13"
|
2014
|
+
[#2648]:https://github.com/puma/puma/pull/2648 "PR by @MSP-Greg, merged 2021-06-27"
|
2015
|
+
[#1412]:https://github.com/puma/puma/issues/1412 "Issue by @x-yuri, closed 2021-06-27"
|
2016
|
+
[#2586]:https://github.com/puma/puma/pull/2586 "PR by @MSP-Greg, merged 2021-05-26"
|
2017
|
+
[#2569]:https://github.com/puma/puma/issues/2569 "Issue by @tarragon, closed 2021-05-26"
|
2018
|
+
[#2643]:https://github.com/puma/puma/pull/2643 "PR by @MSP-Greg, merged 2021-06-27"
|
2019
|
+
[#2638]:https://github.com/puma/puma/issues/2638 "Issue by @gingerlime, closed 2021-06-27"
|
2020
|
+
[#2642]:https://github.com/puma/puma/pull/2642 "PR by @MSP-Greg, merged 2021-06-16"
|
2021
|
+
[#2633]:https://github.com/puma/puma/pull/2633 "PR by @onlined, merged 2021-06-04"
|
2022
|
+
[#2656]:https://github.com/puma/puma/pull/2656 "PR by @olivierbellone, merged 2021-07-07"
|
2023
|
+
[#2666]:https://github.com/puma/puma/pull/2666 "PR by @MSP-Greg, merged 2021-07-25"
|
2024
|
+
[#2630]:https://github.com/puma/puma/pull/2630 "PR by @seangoedecke, merged 2021-05-20"
|
2025
|
+
[#2626]:https://github.com/puma/puma/issues/2626 "Issue by @rorymckinley, closed 2021-05-20"
|
2026
|
+
[#2629]:https://github.com/puma/puma/pull/2629 "PR by @ye-lin-aung, merged 2021-05-20"
|
2027
|
+
[#2628]:https://github.com/puma/puma/pull/2628 "PR by @wjordan, merged 2021-05-20"
|
2028
|
+
[#2625]:https://github.com/puma/puma/issues/2625 "Issue by @jarthod, closed 2021-05-11"
|
1756
2029
|
[#2564]:https://github.com/puma/puma/pull/2564 "PR by @MSP-Greg, merged 2021-04-24"
|
1757
2030
|
[#2526]:https://github.com/puma/puma/issues/2526 "Issue by @nerdrew, closed 2021-04-24"
|
1758
2031
|
[#2559]:https://github.com/puma/puma/pull/2559 "PR by @ylecuyer, merged 2021-03-11"
|
@@ -1767,11 +2040,11 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
1767
2040
|
[#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
|
1768
2041
|
[#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
|
1769
2042
|
[#2607]:https://github.com/puma/puma/pull/2607 "PR by @calvinxiao, merged 2021-04-23"
|
1770
|
-
[#2552]:https://github.com/puma/puma/issues/2552 "Issue by @feliperaul,
|
2043
|
+
[#2552]:https://github.com/puma/puma/issues/2552 "Issue by @feliperaul, closed 2021-05-24"
|
1771
2044
|
[#2606]:https://github.com/puma/puma/pull/2606 "PR by @wjordan, merged 2021-04-20"
|
1772
2045
|
[#2574]:https://github.com/puma/puma/issues/2574 "Issue by @darkhelmet, closed 2021-04-20"
|
1773
|
-
[#2567]:https://github.com/puma/puma/pull/2567 "PR by @
|
1774
|
-
[#2566]:https://github.com/puma/puma/issues/2566 "Issue by @
|
2046
|
+
[#2567]:https://github.com/puma/puma/pull/2567 "PR by @kddnewton, merged 2021-04-19"
|
2047
|
+
[#2566]:https://github.com/puma/puma/issues/2566 "Issue by @kddnewton, closed 2021-04-19"
|
1775
2048
|
[#2596]:https://github.com/puma/puma/pull/2596 "PR by @MSP-Greg, merged 2021-04-18"
|
1776
2049
|
[#2588]:https://github.com/puma/puma/pull/2588 "PR by @dentarg, merged 2021-04-02"
|
1777
2050
|
[#2556]:https://github.com/puma/puma/issues/2556 "Issue by @gamecreature, closed 2021-04-02"
|
@@ -1790,7 +2063,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
1790
2063
|
[#2519]:https://github.com/puma/puma/pull/2519 "PR by @MSP-Greg, merged 2021-01-26"
|
1791
2064
|
[#2522]:https://github.com/puma/puma/pull/2522 "PR by @jcmfernandes, merged 2021-01-12"
|
1792
2065
|
[#2490]:https://github.com/puma/puma/pull/2490 "PR by @Bonias, merged 2020-12-07"
|
1793
|
-
[#2486]:https://github.com/puma/puma/pull/2486 "PR by @
|
2066
|
+
[#2486]:https://github.com/puma/puma/pull/2486 "PR by @karloscodes, merged 2020-12-02"
|
1794
2067
|
[#2535]:https://github.com/puma/puma/pull/2535 "PR by @MSP-Greg, merged 2021-01-27"
|
1795
2068
|
[#2529]:https://github.com/puma/puma/pull/2529 "PR by @MSP-Greg, merged 2021-01-24"
|
1796
2069
|
[#2533]:https://github.com/puma/puma/pull/2533 "PR by @MSP-Greg, merged 2021-01-24"
|
@@ -1800,7 +2073,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
1800
2073
|
[#2521]:https://github.com/puma/puma/pull/2521 "PR by @ojab, merged 2021-01-04"
|
1801
2074
|
[#2531]:https://github.com/puma/puma/pull/2531 "PR by @wjordan, merged 2021-01-19"
|
1802
2075
|
[#2510]:https://github.com/puma/puma/pull/2510 "PR by @micke, merged 2020-12-10"
|
1803
|
-
[#2472]:https://github.com/puma/puma/pull/2472 "PR by @
|
2076
|
+
[#2472]:https://github.com/puma/puma/pull/2472 "PR by @karloscodes, merged 2020-11-02"
|
1804
2077
|
[#2438]:https://github.com/puma/puma/pull/2438 "PR by @ekohl, merged 2020-10-26"
|
1805
2078
|
[#2406]:https://github.com/puma/puma/pull/2406 "PR by @fdel15, merged 2020-10-19"
|
1806
2079
|
[#2449]:https://github.com/puma/puma/pull/2449 "PR by @MSP-Greg, merged 2020-10-28"
|
@@ -2227,7 +2500,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
2227
2500
|
[#709]:https://github.com/puma/puma/pull/709 "PR by @lian, merged 2015-06-10"
|
2228
2501
|
[#711]:https://github.com/puma/puma/pull/711 "PR by @julik, merged 2015-06-10"
|
2229
2502
|
[#712]:https://github.com/puma/puma/pull/712 "PR by @chewi, merged 2015-07-14"
|
2230
|
-
[#715]:https://github.com/puma/puma/pull/715 "PR by @
|
2503
|
+
[#715]:https://github.com/puma/puma/pull/715 "PR by @raymondmars, merged 2015-07-14"
|
2231
2504
|
[#725]:https://github.com/puma/puma/pull/725 "PR by @rwz, merged 2015-07-14"
|
2232
2505
|
[#726]:https://github.com/puma/puma/pull/726 "PR by @jshafton, merged 2015-07-14"
|
2233
2506
|
[#729]:https://github.com/puma/puma/pull/729 "PR by @allaire, merged 2015-07-14"
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -2,19 +2,17 @@
|
|
2
2
|
<img src="https://puma.io/images/logos/puma-logo-large.png">
|
3
3
|
</p>
|
4
4
|
|
5
|
-
# Puma: A Ruby Web Server Built For
|
5
|
+
# Puma: A Ruby Web Server Built For Parallelism
|
6
6
|
|
7
|
-
[![Actions
|
8
|
-
[![Actions non MRI](https://github.com/puma/puma/workflows/non_MRI/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3Anon_MRI)
|
7
|
+
[![Actions](https://github.com/puma/puma/workflows/Tests/badge.svg?branch=master)](https://github.com/puma/puma/actions?query=workflow%3ATests)
|
9
8
|
[![Code Climate](https://codeclimate.com/github/puma/puma.svg)](https://codeclimate.com/github/puma/puma)
|
10
|
-
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=puma&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=puma&package-manager=bundler&version-scheme=semver)
|
11
9
|
[![StackOverflow](https://img.shields.io/badge/stackoverflow-Puma-blue.svg)]( https://stackoverflow.com/questions/tagged/puma )
|
12
10
|
|
13
|
-
Puma is a **simple, fast, multi-threaded, and highly
|
11
|
+
Puma is a **simple, fast, multi-threaded, and highly parallel HTTP 1.1 server for Ruby/Rack applications**.
|
14
12
|
|
15
|
-
## Built For Speed &
|
13
|
+
## Built For Speed & Parallelism
|
16
14
|
|
17
|
-
Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request using a thread pool. Each request is served in a separate thread, so truly
|
15
|
+
Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request using a thread pool. Each request is served in a separate thread, so truly parallel Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
|
18
16
|
|
19
17
|
Originally designed as a server for [Rubinius](https://github.com/rubinius/rubinius), Puma also works well with Ruby (MRI) and JRuby.
|
20
18
|
|
@@ -108,15 +106,23 @@ Puma also offers "clustered mode". Clustered mode `fork`s workers from a master
|
|
108
106
|
$ puma -t 8:32 -w 3
|
109
107
|
```
|
110
108
|
|
109
|
+
Or with the `WEB_CONCURRENCY` environment variable:
|
110
|
+
|
111
|
+
```
|
112
|
+
$ WEB_CONCURRENCY=3 puma -t 8:32
|
113
|
+
```
|
114
|
+
|
111
115
|
Note that threads are still used in clustered mode, and the `-t` thread flag setting is per worker, so `-w 2 -t 16:16` will spawn 32 threads in total, with 16 in each worker process.
|
112
116
|
|
113
|
-
In clustered mode, Puma can "preload" your application. This loads all the application code *prior* to forking. Preloading reduces total memory usage of your application via an operating system feature called [copy-on-write](https://en.wikipedia.org/wiki/Copy-on-write)
|
117
|
+
In clustered mode, Puma can "preload" your application. This loads all the application code *prior* to forking. Preloading reduces total memory usage of your application via an operating system feature called [copy-on-write](https://en.wikipedia.org/wiki/Copy-on-write).
|
118
|
+
|
119
|
+
If the `WEB_CONCURRENCY` environment variable is set to a value > 1 (and `--prune-bundler` has not been specified), preloading will be enabled by default. Otherwise, you can use the `--preload` flag from the command line:
|
114
120
|
|
115
121
|
```
|
116
122
|
$ puma -w 3 --preload
|
117
123
|
```
|
118
124
|
|
119
|
-
|
125
|
+
Or, if you're using a configuration file, you can use the `preload_app!` method:
|
120
126
|
|
121
127
|
```ruby
|
122
128
|
# config/puma.rb
|
@@ -124,7 +130,9 @@ workers 3
|
|
124
130
|
preload_app!
|
125
131
|
```
|
126
132
|
|
127
|
-
|
133
|
+
Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preloading copies the code of master into the workers.
|
134
|
+
|
135
|
+
When using clustered mode, you can specify a block in your configuration file that will be run on boot of each worker:
|
128
136
|
|
129
137
|
```ruby
|
130
138
|
# config/puma.rb
|
@@ -137,7 +145,10 @@ This code can be used to setup the process before booting the application, allow
|
|
137
145
|
you to do some Puma-specific things that you don't want to embed in your application.
|
138
146
|
For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
|
139
147
|
|
140
|
-
|
148
|
+
Constants loaded by your application (such as `Rails`) will not be available in `on_worker_boot`
|
149
|
+
unless preloading is enabled.
|
150
|
+
|
151
|
+
You can also specify a block to be run before workers are forked, using `before_fork`:
|
141
152
|
|
142
153
|
```ruby
|
143
154
|
# config/puma.rb
|
@@ -146,8 +157,6 @@ before_fork do
|
|
146
157
|
end
|
147
158
|
```
|
148
159
|
|
149
|
-
Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and `preload_app!` copies the code of master into the workers.
|
150
|
-
|
151
160
|
### Error handling
|
152
161
|
|
153
162
|
If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple
|
@@ -187,6 +196,38 @@ Need a bit of security? Use SSL sockets:
|
|
187
196
|
```
|
188
197
|
$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
|
189
198
|
```
|
199
|
+
#### Self-signed SSL certificates (via the [`localhost`] gem, for development use):
|
200
|
+
|
201
|
+
Puma supports the [`localhost`] gem for self-signed certificates. This is particularly useful if you want to use Puma with SSL locally, and self-signed certificates will work for your use-case. Currently, the integration can only be used in MRI.
|
202
|
+
|
203
|
+
Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
# Add the gem to your Gemfile
|
207
|
+
group(:development) do
|
208
|
+
gem 'localhost'
|
209
|
+
end
|
210
|
+
|
211
|
+
# And require it implicitly using bundler
|
212
|
+
require "bundler"
|
213
|
+
Bundler.require(:default, ENV["RACK_ENV"].to_sym)
|
214
|
+
|
215
|
+
# Alternatively, you can require the gem in config.ru:
|
216
|
+
require './app'
|
217
|
+
require 'localhost'
|
218
|
+
run Sinatra::Application
|
219
|
+
```
|
220
|
+
|
221
|
+
Additionally, Puma must be listening to an SSL socket:
|
222
|
+
|
223
|
+
```shell
|
224
|
+
$ puma -b 'ssl://localhost:9292' config.ru
|
225
|
+
|
226
|
+
# The following options allow you to reach Puma over HTTP as well:
|
227
|
+
$ puma -b ssl://localhost:9292 -b tcp://localhost:9393 config.ru
|
228
|
+
```
|
229
|
+
|
230
|
+
[`localhost`]: https://github.com/socketry/localhost
|
190
231
|
|
191
232
|
#### Controlling SSL Cipher Suites
|
192
233
|
|
@@ -255,11 +296,15 @@ You can also provide a configuration file with the `-C` (or `--config`) flag:
|
|
255
296
|
$ puma -C /path/to/config
|
256
297
|
```
|
257
298
|
|
258
|
-
If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified
|
299
|
+
If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified (via the `--environment` flag or through the `APP_ENV`, `RACK_ENV`, or `RAILS_ENV` environment variables) Puma looks for a configuration file at `config/puma/<environment_name>.rb` and then falls back to `config/puma.rb`.
|
259
300
|
|
260
|
-
If you want to prevent Puma from looking for a configuration file in those locations,
|
301
|
+
If you want to prevent Puma from looking for a configuration file in those locations, include the `--no-config` flag:
|
261
302
|
|
262
303
|
```
|
304
|
+
$ puma --no-config
|
305
|
+
|
306
|
+
# or
|
307
|
+
|
263
308
|
$ puma -C "-"
|
264
309
|
```
|
265
310
|
|
@@ -309,7 +354,7 @@ reliability in production environments:
|
|
309
354
|
* [rc.d](docs/jungle/rc.d/README.md)
|
310
355
|
* [systemd](docs/systemd.md)
|
311
356
|
|
312
|
-
Community guides:
|
357
|
+
Community guides:
|
313
358
|
|
314
359
|
* [Deploying Puma on OpenBSD using relayd and httpd](https://gist.github.com/anon987654321/4532cf8d6c59c1f43ec8973faa031103)
|
315
360
|
|
data/bin/puma-wild
CHANGED
data/docs/architecture.md
CHANGED
@@ -4,38 +4,71 @@
|
|
4
4
|
|
5
5
|
![https://bit.ly/2iJuFky](images/puma-general-arch.png)
|
6
6
|
|
7
|
-
Puma is a threaded Ruby HTTP application server
|
7
|
+
Puma is a threaded Ruby HTTP application server processing requests across a TCP
|
8
|
+
and/or UNIX socket.
|
8
9
|
|
9
10
|
|
10
|
-
Puma processes (there can be one or many) accept connections from the socket via
|
11
|
+
Puma processes (there can be one or many) accept connections from the socket via
|
12
|
+
a thread (in the [`Reactor`](../lib/puma/reactor.rb) class). The connection,
|
13
|
+
once fully buffered and read, moves into the `todo` list, where an available
|
14
|
+
thread will pick it up (in the [`ThreadPool`](../lib/puma/thread_pool.rb)
|
15
|
+
class).
|
11
16
|
|
12
|
-
Puma works in two main modes: cluster and single. In single mode, only one Puma
|
17
|
+
Puma works in two main modes: cluster and single. In single mode, only one Puma
|
18
|
+
process boots. In cluster mode, a `master` process is booted, which prepares
|
19
|
+
(and may boot) the application and then uses the `fork()` system call to create
|
20
|
+
one or more `child` processes. These `child` processes all listen to the same
|
21
|
+
socket. The `master` process does not listen to the socket or process requests -
|
22
|
+
its purpose is primarily to manage and listen for UNIX signals and possibly kill
|
23
|
+
or boot `child` processes.
|
13
24
|
|
14
|
-
We sometimes call `child` processes (or Puma processes in `single` mode)
|
25
|
+
We sometimes call `child` processes (or Puma processes in `single` mode)
|
26
|
+
_workers_, and we sometimes call the threads created by Puma's
|
27
|
+
[`ThreadPool`](../lib/puma/thread_pool.rb) _worker threads_.
|
15
28
|
|
16
29
|
## How Requests Work
|
17
30
|
|
18
31
|
![https://bit.ly/2zwzhEK](images/puma-connection-flow.png)
|
19
32
|
|
20
33
|
* Upon startup, Puma listens on a TCP or UNIX socket.
|
21
|
-
* The backlog of this socket is configured
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
* The backlog of this socket is configured with a default of 1024, but the
|
35
|
+
actual backlog value is capped by the `net.core.somaxconn` sysctl value.
|
36
|
+
The backlog determines the size of the queue for unaccepted connections. If
|
37
|
+
the backlog is full, the operating system is not accepting new connections.
|
38
|
+
* This socket backlog is distinct from the `backlog` of work as reported by
|
39
|
+
`Puma.stats` or the control server. The backlog that `Puma.stats` refers to
|
40
|
+
represents the number of connections in the process' `todo` set waiting for
|
41
|
+
a thread from the [`ThreadPool`](../lib/puma/thread_pool.rb).
|
42
|
+
* By default, a single, separate thread (created by the
|
43
|
+
[`Reactor`](../lib/puma/reactor.rb) class) reads and buffers requests from the
|
44
|
+
socket.
|
45
|
+
* When at least one worker thread is available for work, the reactor thread
|
46
|
+
listens to the socket and accepts a request (if one is waiting).
|
25
47
|
* The reactor thread waits for the entire HTTP request to be received.
|
26
|
-
*
|
27
|
-
|
48
|
+
* Puma exposes the time spent waiting for the HTTP request body to be
|
49
|
+
received to the Rack app as `env['puma.request_body_wait']`
|
50
|
+
(milliseconds).
|
51
|
+
* Once fully buffered and received, the connection is pushed into the "todo"
|
52
|
+
set.
|
28
53
|
* Worker threads pop work off the "todo" set for processing.
|
29
|
-
* The worker thread processes the request via `call`ing the configured Rack
|
30
|
-
|
31
|
-
*
|
54
|
+
* The worker thread processes the request via `call`ing the configured Rack
|
55
|
+
application. The Rack application generates the HTTP response.
|
56
|
+
* The worker thread writes the response to the connection. While Puma buffers
|
57
|
+
requests via a separate thread, it does not use a separate thread for
|
58
|
+
responses.
|
59
|
+
* Once done, the thread becomes available to process another connection in the
|
60
|
+
"todo" set.
|
32
61
|
|
33
62
|
### `queue_requests`
|
34
63
|
|
35
64
|
![https://bit.ly/2zxCJ1Z](images/puma-connection-flow-no-reactor.png)
|
36
65
|
|
37
|
-
The `queue_requests` option is `true` by default, enabling the separate reactor
|
66
|
+
The `queue_requests` option is `true` by default, enabling the separate reactor
|
67
|
+
thread used to buffer requests as described above.
|
38
68
|
|
39
|
-
If set to `false`, this buffer will not be used for connections while waiting
|
69
|
+
If set to `false`, this buffer will not be used for connections while waiting
|
70
|
+
for the request to arrive.
|
40
71
|
|
41
|
-
In this mode, when a connection is accepted, it is added to the "todo" queue
|
72
|
+
In this mode, when a connection is accepted, it is added to the "todo" queue
|
73
|
+
immediately, and a worker will synchronously do any waiting necessary to read
|
74
|
+
the HTTP request from the socket.
|