Skip to content

Commit

Permalink
6.0.0 (#2918)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateberkopec committed Oct 14, 2022
1 parent 8159aa4 commit 32d9997
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 12 deletions.
51 changes: 51 additions & 0 deletions 6.0-Upgrade.md
@@ -0,0 +1,51 @@
# Welcome to Puma 6: Sunflower.

![Image by Todd Trapani, Unsplash](https://user-images.githubusercontent.com/845662/192706685-774d3d0d-f4a9-4b93-b27b-5a3b7f44ff31.jpg)

Puma 6 brings performance improvements for most applications, experimental Rack 3 support, support for Sidekiq 7 Capsules, and more.

Here's what you should do:

1. Review the Upgrade section below to look for breaking changes that could affect you.
2. Upgrade to version 6.0 in your Gemfile and deploy.
3. Open up a new bug issue if you find any problems.
4. Join us in building Puma! We welcome first-timers. See [CONTRIBUTING.md](./CONTRIBUTING.md).

For a complete list of changes, see [History.md](./History.md).

## What's New

Puma 6 is mostly about a few nice-to-have performance changes, and then a few breaking API changes we've been putting off for a while.

### Improved Performance

We've improved throughput and latency in Puma 6 in a few areas.

1. **Large chunked response body throughput 3-10x higher** Chunked response bodies >100kb should be 3 to 10 times faster than in Puma 5. String response bodies should be ~10% faster.
2. **File response throughput is 3x higher.** File responses (e.g. assets) should be about 3x faster.
3. **wait_for_less_busy_worker is now default, meaning lower latencies for high-utilization servers** `wait_for_less_busy_worker` was an experimental feature in Puma 5 and it's now the default in Puma 6. This feature makes each Puma child worker in cluster mode wait before listening on the socket, and that wait time is proportional to N * `number_of_threads_responding_to_requests`. This means that it's more likely that a request is picked up by the least-loaded Puma child worker listening on the socket. Many users reported back that this option was stable and decreased average latency, particularly in environments with high load and utilization.

### Experimental Rack 3 Support

[Rack 3 is now out](https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md) and we've started on Rack 3 support. Please open a bug if you find any incompatibilites.

### Sidekiq 7 Capsules

Sidekiq 7 (releasing soon) introduces Capsules, which allows you to run a Sidekiq server inside your Puma server (or any other Ruby process for that matter). We've added support by allowing you to pass data into `run_hooks`, see [issue #2915](https://github.com/puma/puma/issues/2915).

## Upgrade

Check the following list to see if you're depending on any of these behaviors:

1. We have changed the names of the following environment variables: `DISABLE_SSL` is now `PUMA_DISABLE_SSL`, `MAKE_WARNINGS_INTO_ERRORS` is now `PUMA_MAKE_WARNINGS_INTO_ERRORS`, and `WAIT_FOR_LESS_BUSY_WORKERS` is now `PUMA_WAIT_FOR_LESS_BUSY_WORKERS`.
1. Nakayoshi GC (`nakayoshi_fork` option in config) has been removed without replacement.
1. `wait_for_less_busy_worker` is now on by default. If you don't want to use this feature, you must add `wait_for_less_busy_worker false` in your config.
1. We've removed the following public methods on Puma::Server: `Puma::Server#min_threads`, `Puma::Server#max_threads`. Instead, you can pass in configuration as an option to Puma::Server#new. This might make certain gems break (`capybara` for example).
1. We've removed the following constants: `Puma::StateFile::FIELDS`, `Puma::CLI::KEYS_NOT_TO_PERSIST_IN_STATE` and `Puma::Launcher::KEYS_NOT_TO_PERSIST_IN_STATE`, and `Puma::ControlCLI::COMMANDS`.
1. We no longer support Ruby 2.2, 2.3, or JRuby on Java 1.7 or below.
1. The behavior of `remote_addr` has changed. When using the set_remote_address header: "header_name" functionality, if the header is not passed, REMOTE_ADDR is now set to the physical peeraddr instead of always being set to 127.0.0.1. When an error occurs preventing the physical peeraddr from being fetched, REMOTE_ADDR is now set to the unspecified source address ('0.0.0.0') instead of to '127.0.0.1'
1. If you are creating your own Puma::Server objects, it's initialize signature has changed. In 5.x and below, it was `def initialize(app, events=Events.stdio, options={})`. Now it is `def initialize(app, log_writer=LogWriter.stdio, events=Events.new, options = {})`.

Then, update your Gemfile:

`gem 'puma', '< 7'`
99 changes: 89 additions & 10 deletions History.md
@@ -1,3 +1,45 @@
## 6.0.0 / 2022-10-XX

* Breaking Changes
* Dropping Ruby 2.2 and 2.3 support (now 2.4+) ([#2919])
* Remote_addr functionality has changed ([#2652], [#2653])
* No longer supporting Java 1.7 or below (JRuby 9.1 was the last release to support this) ([#2849])
* Remove nakayoshi GC ([#2933], [#2925])
* wait_for_less_busy_worker is now default on ([#2940])
* Prefix all environment variables with `PUMA_` ([#2924], [#2853])
* Removed some constants ([#2957], [#2958], [#2959], [#2960])
* The following classes are now part of Puma's private API: `Client`, `Cluster::Worker`, `Cluster::Worker`, `HandleRequest`. ([#2988])

* Features
* Increase throughput on large (100kb+) response bodies by 3-10x ([#2896], [#2892])
* Increase throughput on file responses ([#2923])
* Add support for streaming bodies in Rack. ([#2740])
* Allow OpenSSL session reuse via a 'reuse' ssl_bind method or bind string query parameter ([#2845])
* Allow `run_hooks` to pass a hash to blocks for use later ([#2917], [#2915])
* Allow using `preload_app!` with `fork_worker` ([#2907])
* Support request_body_wait metric with higher precision ([#2953])
* Allow header values to be arrays (Rack 3) ([#2936], [#2931])
* Export Puma/Ruby versions in /stats ([#2875])
* Allow configuring request uri max length & request path max length ([#2840])
* Add a couple of public accessors ([#2774])
* Log entire backtrace when worker start fails ([#2891])
* [jruby] Enable TLSv1.3 support ([#2886])
* [jruby] support setting TLS protocols + rename ssl_cipher_list ([#2899])
* [jruby] Support a truststore option ([#2849], [#2904], [#2884])

* Bugfixes
* Load the configuration before passing it to the binder ([#2897])
* Do not raise error raised on HTTP methods we don't recognize or support, like CONNECT ([#2932], [#1441])
* Fixed a memory leak when creating a new SSL listener ([#2956])

* Refactor
* log_writer.rb - add internal_write method ([#2888])
* [WIP] Refactor: Split out LogWriter from Events (no logic change) ([#2798])
* Extract prune_bundler code into it's own class. ([#2797])
* Refactor Launcher#run to increase readability (no logic change) ([#2795])
* Ruby 3.2 will have native IO#wait_* methods, don't require io/wait ([#2903])
* Various internal API refactorings ([#2942], [#2921], [#2922], [#2955])

## 5.6.5 / 2022-08-23

* Feature
Expand Down Expand Up @@ -1873,15 +1915,59 @@ be added back in a future date when a java Puma::MiniSSL is added.
* Bugfixes
* Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)

[#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
[#2919]:https://github.com/puma/puma/pull/2919 "PR by @MSP-Greg, merged 2022-08-30"
[#2652]:https://github.com/puma/puma/issues/2652 "Issue by @Roguelazer, closed 2022-09-04"
[#2653]:https://github.com/puma/puma/pull/2653 "PR by @Roguelazer, closed 2022-03-07"
[#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
[#2933]:https://github.com/puma/puma/pull/2933 "PR by @cafedomancer, merged 2022-09-09"
[#2925]:https://github.com/puma/puma/issues/2925 "Issue by @nateberkopec, closed 2022-09-09"
[#2940]:https://github.com/puma/puma/pull/2940 "PR by @cafedomancer, merged 2022-09-10"
[#2924]:https://github.com/puma/puma/pull/2924 "PR by @cafedomancer, merged 2022-09-07"
[#2853]:https://github.com/puma/puma/issues/2853 "Issue by @nateberkopec, closed 2022-09-07"
[#2957]:https://github.com/puma/puma/pull/2957 "PR by @JuanitoFatas, merged 2022-09-16"
[#2958]:https://github.com/puma/puma/pull/2958 "PR by @JuanitoFatas, merged 2022-09-16"
[#2959]:https://github.com/puma/puma/pull/2959 "PR by @JuanitoFatas, merged 2022-09-16"
[#2960]:https://github.com/puma/puma/pull/2960 "PR by @JuanitoFatas, merged 2022-09-16"
[#2988]:https://github.com/puma/puma/issues/2988 "Issue by @MSP-Greg, merged 2022-10-12"
[#2896]:https://github.com/puma/puma/pull/2896 "PR by @MSP-Greg, merged 2022-09-13"
[#2892]:https://github.com/puma/puma/pull/2892 "PR by @guilleiguaran, closed 2022-09-13"
[#2923]:https://github.com/puma/puma/pull/2923 "PR by @nateberkopec, merged 2022-09-09"
[#2740]:https://github.com/puma/puma/pull/2740 "PR by @ioquatix, merged 2022-01-29"
[#2845]:https://github.com/puma/puma/issues/2845 "Issue by @donv, closed 2022-03-22"
[#2917]:https://github.com/puma/puma/pull/2917 "PR by @MSP-Greg, merged 2022-09-19"
[#2915]:https://github.com/puma/puma/issues/2915 "Issue by @mperham, closed 2022-09-19"
[#2907]:https://github.com/puma/puma/pull/2907 "PR by @casperisfine, merged 2022-09-15"
[#2953]:https://github.com/puma/puma/pull/2953 "PR by @JuanitoFatas, merged 2022-09-14"
[#2936]:https://github.com/puma/puma/pull/2936 "PR by @MSP-Greg, merged 2022-09-09"
[#2931]:https://github.com/puma/puma/issues/2931 "Issue by @dentarg, closed 2022-09-09"
[#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
[#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
[#2774]:https://github.com/puma/puma/pull/2774 "PR by @ob-stripe, merged 2022-01-31"
[#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
[#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
[#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
[#2904]:https://github.com/puma/puma/pull/2904 "PR by @kares, merged 2022-08-27"
[#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
[#2897]:https://github.com/puma/puma/pull/2897 "PR by @Edouard-chin, merged 2022-08-27"
[#2932]:https://github.com/puma/puma/pull/2932 "PR by @mrzasa, merged 2022-09-12"
[#1441]:https://github.com/puma/puma/issues/1441 "Issue by @nirvdrum, closed 2022-09-12"
[#2956]:https://github.com/puma/puma/pull/2956 "PR by @MSP-Greg, merged 2022-09-15"
[#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
[#2798]:https://github.com/puma/puma/pull/2798 "PR by @johnnyshields, merged 2022-02-05"
[#2797]:https://github.com/puma/puma/pull/2797 "PR by @johnnyshields, merged 2022-02-01"
[#2795]:https://github.com/puma/puma/pull/2795 "PR by @johnnyshields, merged 2022-01-31"
[#2903]:https://github.com/puma/puma/pull/2903 "PR by @MSP-Greg, merged 2022-08-27"
[#2942]:https://github.com/puma/puma/pull/2942 "PR by @nateberkopec, merged 2022-09-15"
[#2921]:https://github.com/puma/puma/issues/2921 "Issue by @MSP-Greg, closed 2022-09-15"
[#2922]:https://github.com/puma/puma/issues/2922 "Issue by @MSP-Greg, closed 2022-09-10"
[#2955]:https://github.com/puma/puma/pull/2955 "PR by @cafedomancer, merged 2022-09-15"
[#2868]:https://github.com/puma/puma/pull/2868 "PR by @MSP-Greg, merged 2022-06-02"
[#2866]:https://github.com/puma/puma/issues/2866 "Issue by @slondr, closed 2022-06-02"
[#2888]:https://github.com/puma/puma/pull/2888 "PR by @MSP-Greg, merged 2022-06-01"
[#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
[#2890]:https://github.com/puma/puma/pull/2890 "PR by @kares, merged 2022-06-01"
[#2729]:https://github.com/puma/puma/issues/2729 "Issue by @kares, closed 2022-06-01"
[#2885]:https://github.com/puma/puma/pull/2885 "PR by @MSP-Greg, merged 2022-05-30"
[#2839]:https://github.com/puma/puma/issues/2839 "Issue by @wlipa, closed 2022-05-30"
[#2882]:https://github.com/puma/puma/pull/2882 "PR by @MSP-Greg, merged 2022-05-19"
[#2864]:https://github.com/puma/puma/pull/2864 "PR by @MSP-Greg, merged 2022-04-26"
[#2863]:https://github.com/puma/puma/issues/2863 "Issue by @eradman, closed 2022-04-26"
[#2861]:https://github.com/puma/puma/pull/2861 "PR by @BlakeWilliams, merged 2022-04-17"
Expand All @@ -1892,13 +1978,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
[#2838]:https://github.com/puma/puma/pull/2838 "PR by @epsilon-0, merged 2022-03-03"
[#2817]:https://github.com/puma/puma/pull/2817 "PR by @khustochka, merged 2022-02-20"
[#2810]:https://github.com/puma/puma/pull/2810 "PR by @kzkn, merged 2022-01-27"
[#2899]:https://github.com/puma/puma/pull/2899 "PR by @kares, merged 2022-07-04"
[#2891]:https://github.com/puma/puma/pull/2891 "PR by @gingerlime, merged 2022-06-02"
[#2886]:https://github.com/puma/puma/pull/2886 "PR by @kares, merged 2022-05-30"
[#2884]:https://github.com/puma/puma/pull/2884 "PR by @kares, merged 2022-05-30"
[#2875]:https://github.com/puma/puma/pull/2875 "PR by @ylecuyer, merged 2022-05-19"
[#2840]:https://github.com/puma/puma/pull/2840 "PR by @LukaszMaslej, merged 2022-04-13"
[#2849]:https://github.com/puma/puma/pull/2849 "PR by @kares, merged 2022-04-09"
[#2809]:https://github.com/puma/puma/pull/2809 "PR by @dentarg, merged 2022-01-26"
[#2764]:https://github.com/puma/puma/pull/2764 "PR by @dentarg, merged 2022-01-18"
[#2708]:https://github.com/puma/puma/issues/2708 "Issue by @erikaxel, closed 2022-01-18"
Expand Down
4 changes: 2 additions & 2 deletions lib/puma/const.rb
Expand Up @@ -100,8 +100,8 @@ class UnsupportedOption < RuntimeError
# too taxing on performance.
module Const

PUMA_VERSION = VERSION = "5.6.5".freeze
CODE_NAME = "Birdie's Version".freeze
PUMA_VERSION = VERSION = "6.0.0".freeze
CODE_NAME = "Sunflower".freeze

PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze

Expand Down

0 comments on commit 32d9997

Please sign in to comment.