jun-puma 1.0.1-java → 1.0.2-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.
- checksums.yaml +4 -4
- data/lib/puma/puma_http11.jar +0 -0
- metadata +3 -81
- data/bin/puma-wild +0 -25
- data/docs/architecture.md +0 -74
- data/docs/compile_options.md +0 -55
- data/docs/deployment.md +0 -102
- data/docs/fork_worker.md +0 -31
- 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 -9
- data/docs/jungle/rc.d/README.md +0 -74
- data/docs/jungle/rc.d/puma +0 -61
- data/docs/jungle/rc.d/puma.conf +0 -10
- data/docs/kubernetes.md +0 -78
- data/docs/nginx.md +0 -80
- data/docs/plugins.md +0 -38
- data/docs/rails_dev_mode.md +0 -28
- data/docs/restart.md +0 -64
- data/docs/signals.md +0 -98
- data/docs/stats.md +0 -142
- data/docs/systemd.md +0 -244
- data/docs/testing_benchmarks_local_files.md +0 -150
- data/docs/testing_test_rackup_ci_files.md +0 -36
- data/ext/puma_http11/PumaHttp11Service.java +0 -17
- data/ext/puma_http11/ext_help.h +0 -15
- data/ext/puma_http11/http11_parser.c +0 -1057
- data/ext/puma_http11/http11_parser.h +0 -65
- data/ext/puma_http11/http11_parser.java.rl +0 -145
- data/ext/puma_http11/http11_parser.rl +0 -149
- data/ext/puma_http11/http11_parser_common.rl +0 -54
- data/ext/puma_http11/mini_ssl.c +0 -832
- data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -15
- data/ext/puma_http11/org/jruby/puma/Http11.java +0 -226
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -455
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +0 -508
- data/ext/puma_http11/puma_http11.c +0 -492
- data/lib/puma/app/status.rb +0 -96
- data/lib/puma/binder.rb +0 -501
- data/lib/puma/cli.rb +0 -243
- data/lib/puma/client.rb +0 -632
- data/lib/puma/cluster/worker.rb +0 -182
- data/lib/puma/cluster/worker_handle.rb +0 -97
- data/lib/puma/cluster.rb +0 -562
- data/lib/puma/commonlogger.rb +0 -115
- data/lib/puma/configuration.rb +0 -391
- data/lib/puma/const.rb +0 -289
- data/lib/puma/control_cli.rb +0 -316
- data/lib/puma/detect.rb +0 -45
- data/lib/puma/dsl.rb +0 -1204
- data/lib/puma/error_logger.rb +0 -113
- data/lib/puma/events.rb +0 -57
- data/lib/puma/io_buffer.rb +0 -46
- data/lib/puma/jruby_restart.rb +0 -27
- data/lib/puma/json_serialization.rb +0 -96
- data/lib/puma/launcher/bundle_pruner.rb +0 -104
- data/lib/puma/launcher.rb +0 -484
- data/lib/puma/log_writer.rb +0 -147
- data/lib/puma/minissl/context_builder.rb +0 -95
- data/lib/puma/minissl.rb +0 -458
- data/lib/puma/null_io.rb +0 -61
- data/lib/puma/plugin/systemd.rb +0 -90
- data/lib/puma/plugin/tmp_restart.rb +0 -36
- data/lib/puma/plugin.rb +0 -111
- data/lib/puma/rack/builder.rb +0 -297
- data/lib/puma/rack/urlmap.rb +0 -93
- data/lib/puma/rack_default.rb +0 -24
- data/lib/puma/reactor.rb +0 -125
- data/lib/puma/request.rb +0 -671
- data/lib/puma/runner.rb +0 -213
- data/lib/puma/sd_notify.rb +0 -149
- data/lib/puma/server.rb +0 -664
- data/lib/puma/single.rb +0 -69
- data/lib/puma/state_file.rb +0 -68
- data/lib/puma/thread_pool.rb +0 -434
- data/lib/puma/util.rb +0 -141
- data/lib/puma.rb +0 -78
- data/lib/rack/handler/puma.rb +0 -141
- data/tools/Dockerfile +0 -16
- data/tools/trickletest.rb +0 -44
    
        data/docs/systemd.md
    DELETED
    
    | @@ -1,244 +0,0 @@ | |
| 1 | 
            -
            # systemd
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            [systemd](https://www.freedesktop.org/wiki/Software/systemd/) is a commonly
         | 
| 4 | 
            -
            available init system (PID 1) on many Linux distributions. It offers process
         | 
| 5 | 
            -
            monitoring (including automatic restarts) and other useful features for running
         | 
| 6 | 
            -
            Puma in production.
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            ## Service Configuration
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            Below is a sample puma.service configuration file for systemd, which can be
         | 
| 11 | 
            -
            copied or symlinked to `/etc/systemd/system/puma.service`, or if desired, using
         | 
| 12 | 
            -
            an application or instance-specific name.
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            Note that this uses the systemd preferred "simple" type where the start command
         | 
| 15 | 
            -
            remains running in the foreground (does not fork and exit).
         | 
| 16 | 
            -
             | 
| 17 | 
            -
            ~~~~ ini
         | 
| 18 | 
            -
            [Unit]
         | 
| 19 | 
            -
            Description=Puma HTTP Server
         | 
| 20 | 
            -
            After=network.target
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            # Uncomment for socket activation (see below)
         | 
| 23 | 
            -
            # Requires=puma.socket
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            [Service]
         | 
| 26 | 
            -
            # Puma supports systemd's `Type=notify` and watchdog service
         | 
| 27 | 
            -
            # monitoring, as of Puma 5.1 or later.
         | 
| 28 | 
            -
            # On earlier versions of Puma or JRuby, change this to `Type=simple` and remove
         | 
| 29 | 
            -
            # the `WatchdogSec` line.
         | 
| 30 | 
            -
            Type=notify
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            # If your Puma process locks up, systemd's watchdog will restart it within seconds.
         | 
| 33 | 
            -
            WatchdogSec=10
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            # Preferably configure a non-privileged user
         | 
| 36 | 
            -
            # User=
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            # The path to your application code root directory.
         | 
| 39 | 
            -
            # Also replace the "<YOUR_APP_PATH>" placeholders below with this path.
         | 
| 40 | 
            -
            # Example /home/username/myapp
         | 
| 41 | 
            -
            WorkingDirectory=<YOUR_APP_PATH>
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            # Helpful for debugging socket activation, etc.
         | 
| 44 | 
            -
            # Environment=PUMA_DEBUG=1
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            # SystemD will not run puma even if it is in your path. You must specify
         | 
| 47 | 
            -
            # an absolute URL to puma. For example /usr/local/bin/puma
         | 
| 48 | 
            -
            # Alternatively, create a binstub with `bundle binstubs puma --path ./sbin` in the WorkingDirectory
         | 
| 49 | 
            -
            ExecStart=/<FULLPATH>/bin/puma -C <YOUR_APP_PATH>/puma.rb
         | 
| 50 | 
            -
             | 
| 51 | 
            -
            # Variant: Rails start.
         | 
| 52 | 
            -
            # ExecStart=/<FULLPATH>/bin/puma -C <YOUR_APP_PATH>/config/puma.rb ../config.ru
         | 
| 53 | 
            -
             | 
| 54 | 
            -
            # Variant: Use `bundle exec puma` instead of binstub
         | 
| 55 | 
            -
            # Variant: Specify directives inline.
         | 
| 56 | 
            -
            # ExecStart=/<FULLPATH>/puma -b tcp://0.0.0.0:9292 -b ssl://0.0.0.0:9293?key=key.pem&cert=cert.pem
         | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
            Restart=always
         | 
| 60 | 
            -
             | 
| 61 | 
            -
            [Install]
         | 
| 62 | 
            -
            WantedBy=multi-user.target
         | 
| 63 | 
            -
            ~~~~
         | 
| 64 | 
            -
             | 
| 65 | 
            -
            See
         | 
| 66 | 
            -
            [systemd.exec](https://www.freedesktop.org/software/systemd/man/systemd.exec.html)
         | 
| 67 | 
            -
            for additional details.
         | 
| 68 | 
            -
             | 
| 69 | 
            -
            ## Socket Activation
         | 
| 70 | 
            -
             | 
| 71 | 
            -
            systemd and Puma also support socket activation, where systemd opens the
         | 
| 72 | 
            -
            listening socket(s) in advance and provides them to the Puma master process on
         | 
| 73 | 
            -
            startup. Among other advantages, this keeps listening sockets open across puma
         | 
| 74 | 
            -
            restarts and achieves graceful restarts, including when upgraded Puma, and is
         | 
| 75 | 
            -
            compatible with both clustered mode and application preload.
         | 
| 76 | 
            -
             | 
| 77 | 
            -
            **Note:** Any wrapper scripts which `exec`, or other indirections in `ExecStart`
         | 
| 78 | 
            -
            may result in activated socket file descriptors being closed before reaching the
         | 
| 79 | 
            -
            puma master process.
         | 
| 80 | 
            -
             | 
| 81 | 
            -
            **Note:** Socket activation doesn't currently work on JRuby. This is tracked in
         | 
| 82 | 
            -
            [#1367].
         | 
| 83 | 
            -
             | 
| 84 | 
            -
            Configure one or more `ListenStream` sockets in a companion `*.socket` unit file
         | 
| 85 | 
            -
            to use socket activation. Also, uncomment the associated `Requires` directive
         | 
| 86 | 
            -
            for the socket unit in the service file (see above.) Here is a sample
         | 
| 87 | 
            -
            puma.socket, matching the ports used in the above puma.service:
         | 
| 88 | 
            -
             | 
| 89 | 
            -
            ~~~~ ini
         | 
| 90 | 
            -
            [Unit]
         | 
| 91 | 
            -
            Description=Puma HTTP Server Accept Sockets
         | 
| 92 | 
            -
             | 
| 93 | 
            -
            [Socket]
         | 
| 94 | 
            -
            ListenStream=0.0.0.0:9292
         | 
| 95 | 
            -
            ListenStream=0.0.0.0:9293
         | 
| 96 | 
            -
             | 
| 97 | 
            -
            # AF_UNIX domain socket
         | 
| 98 | 
            -
            # SocketUser, SocketGroup, etc. may be needed for Unix domain sockets
         | 
| 99 | 
            -
            # ListenStream=/run/puma.sock
         | 
| 100 | 
            -
             | 
| 101 | 
            -
            # Socket options matching Puma defaults
         | 
| 102 | 
            -
            NoDelay=true
         | 
| 103 | 
            -
            ReusePort=true
         | 
| 104 | 
            -
            Backlog=1024
         | 
| 105 | 
            -
             | 
| 106 | 
            -
            [Install]
         | 
| 107 | 
            -
            WantedBy=sockets.target
         | 
| 108 | 
            -
            ~~~~
         | 
| 109 | 
            -
             | 
| 110 | 
            -
            See
         | 
| 111 | 
            -
            [systemd.socket](https://www.freedesktop.org/software/systemd/man/systemd.socket.html)
         | 
| 112 | 
            -
            for additional configuration details.
         | 
| 113 | 
            -
             | 
| 114 | 
            -
            Note that the above configurations will work with Puma in either single process
         | 
| 115 | 
            -
            or cluster mode.
         | 
| 116 | 
            -
             | 
| 117 | 
            -
            ### Sockets and symlinks
         | 
| 118 | 
            -
             | 
| 119 | 
            -
            When using releases folders, you should set the socket path using the shared
         | 
| 120 | 
            -
            folder path (ex. `/srv/projet/shared/tmp/puma.sock`), not the release folder
         | 
| 121 | 
            -
            path (`/srv/projet/releases/1234/tmp/puma.sock`).
         | 
| 122 | 
            -
             | 
| 123 | 
            -
            Puma will detect the release path socket as different than the one provided by
         | 
| 124 | 
            -
            systemd and attempt to bind it again, resulting in the exception `There is
         | 
| 125 | 
            -
            already a server bound to:`.
         | 
| 126 | 
            -
             | 
| 127 | 
            -
            ### Binding
         | 
| 128 | 
            -
             | 
| 129 | 
            -
            By default, you need to configure Puma to have binds matching with all
         | 
| 130 | 
            -
            ListenStream statements. Any mismatched systemd ListenStreams will be closed by
         | 
| 131 | 
            -
            Puma.
         | 
| 132 | 
            -
             | 
| 133 | 
            -
            To automatically bind to all activated sockets, the option
         | 
| 134 | 
            -
            `--bind-to-activated-sockets` can be used. This matches the config DSL
         | 
| 135 | 
            -
            `bind_to_activated_sockets` statement. This will cause Puma to create a bind
         | 
| 136 | 
            -
            automatically for any activated socket. When systemd socket activation is not
         | 
| 137 | 
            -
            enabled, this option does nothing.
         | 
| 138 | 
            -
             | 
| 139 | 
            -
            This also accepts an optional argument `only` (DSL: `'only'`) to discard any
         | 
| 140 | 
            -
            binds that's not socket activated.
         | 
| 141 | 
            -
             | 
| 142 | 
            -
            ## Usage
         | 
| 143 | 
            -
             | 
| 144 | 
            -
            Without socket activation, use `systemctl` as root (i.e., via `sudo`) as with
         | 
| 145 | 
            -
            other system services:
         | 
| 146 | 
            -
             | 
| 147 | 
            -
            ~~~~ sh
         | 
| 148 | 
            -
            # After installing or making changes to puma.service
         | 
| 149 | 
            -
            systemctl daemon-reload
         | 
| 150 | 
            -
             | 
| 151 | 
            -
            # Enable so it starts on boot
         | 
| 152 | 
            -
            systemctl enable puma.service
         | 
| 153 | 
            -
             | 
| 154 | 
            -
            # Initial startup.
         | 
| 155 | 
            -
            systemctl start puma.service
         | 
| 156 | 
            -
             | 
| 157 | 
            -
            # Check status
         | 
| 158 | 
            -
            systemctl status puma.service
         | 
| 159 | 
            -
             | 
| 160 | 
            -
            # A normal restart. Warning: listener's sockets will be closed
         | 
| 161 | 
            -
            # while a new puma process initializes.
         | 
| 162 | 
            -
            systemctl restart puma.service
         | 
| 163 | 
            -
            ~~~~
         | 
| 164 | 
            -
             | 
| 165 | 
            -
            With socket activation, several but not all of these commands should be run for
         | 
| 166 | 
            -
            both socket and service:
         | 
| 167 | 
            -
             | 
| 168 | 
            -
            ~~~~ sh
         | 
| 169 | 
            -
            # After installing or making changes to either puma.socket or
         | 
| 170 | 
            -
            # puma.service.
         | 
| 171 | 
            -
            systemctl daemon-reload
         | 
| 172 | 
            -
             | 
| 173 | 
            -
            # Enable both socket and service, so they start on boot.  Alternatively
         | 
| 174 | 
            -
            # you could leave puma.service disabled, and systemd will start it on
         | 
| 175 | 
            -
            # the first use (with startup lag on the first request)
         | 
| 176 | 
            -
            systemctl enable puma.socket puma.service
         | 
| 177 | 
            -
             | 
| 178 | 
            -
            # Initial startup. The Requires directive (see above) ensures the
         | 
| 179 | 
            -
            # socket is started before the service.
         | 
| 180 | 
            -
            systemctl start puma.socket puma.service
         | 
| 181 | 
            -
             | 
| 182 | 
            -
            # Check the status of both socket and service.
         | 
| 183 | 
            -
            systemctl status puma.socket puma.service
         | 
| 184 | 
            -
             | 
| 185 | 
            -
            # A "hot" restart, with systemd keeping puma.socket listening and
         | 
| 186 | 
            -
            # providing to the new puma (master) instance.
         | 
| 187 | 
            -
            systemctl restart puma.service
         | 
| 188 | 
            -
             | 
| 189 | 
            -
            # A normal restart, needed to handle changes to
         | 
| 190 | 
            -
            # puma.socket, such as changing the ListenStream ports. Note
         | 
| 191 | 
            -
            # daemon-reload (above) should be run first.
         | 
| 192 | 
            -
            systemctl restart puma.socket puma.service
         | 
| 193 | 
            -
            ~~~~
         | 
| 194 | 
            -
             | 
| 195 | 
            -
            Here is sample output from `systemctl status` with both service and socket
         | 
| 196 | 
            -
            running:
         | 
| 197 | 
            -
             | 
| 198 | 
            -
            ~~~~
         | 
| 199 | 
            -
            ● puma.socket - Puma HTTP Server Accept Sockets
         | 
| 200 | 
            -
               Loaded: loaded (/etc/systemd/system/puma.socket; enabled; vendor preset: enabled)
         | 
| 201 | 
            -
               Active: active (running) since Thu 2016-04-07 08:40:19 PDT; 1h 2min ago
         | 
| 202 | 
            -
               Listen: 0.0.0.0:9233 (Stream)
         | 
| 203 | 
            -
                       0.0.0.0:9234 (Stream)
         | 
| 204 | 
            -
             | 
| 205 | 
            -
            Apr 07 08:40:19 hx systemd[874]: Listening on Puma HTTP Server Accept Sockets.
         | 
| 206 | 
            -
             | 
| 207 | 
            -
            ● puma.service - Puma HTTP Server
         | 
| 208 | 
            -
               Loaded: loaded (/etc/systemd/system/puma.service; enabled; vendor preset: enabled)
         | 
| 209 | 
            -
               Active: active (running) since Thu 2016-04-07 08:40:19 PDT; 1h 2min ago
         | 
| 210 | 
            -
             Main PID: 28320 (ruby)
         | 
| 211 | 
            -
               CGroup: /system.slice/puma.service
         | 
| 212 | 
            -
                       ├─28320 puma 3.3.0 (tcp://0.0.0.0:9233,ssl://0.0.0.0:9234?key=key.pem&cert=cert.pem) [app]
         | 
| 213 | 
            -
                       ├─28323 puma: cluster worker 0: 28320 [app]
         | 
| 214 | 
            -
                       └─28327 puma: cluster worker 1: 28320 [app]
         | 
| 215 | 
            -
             | 
| 216 | 
            -
            Apr 07 08:40:19 hx puma[28320]: Puma starting in cluster mode...
         | 
| 217 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Version 3.3.0 (ruby 2.2.4-p230), codename: Jovial Platypus
         | 
| 218 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Min threads: 0, max threads: 16
         | 
| 219 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Environment: production
         | 
| 220 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Process workers: 2
         | 
| 221 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Phased restart available
         | 
| 222 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Activated tcp://0.0.0.0:9233
         | 
| 223 | 
            -
            Apr 07 08:40:19 hx puma[28320]: * Activated ssl://0.0.0.0:9234?key=key.pem&cert=cert.pem
         | 
| 224 | 
            -
            Apr 07 08:40:19 hx puma[28320]: Use Ctrl-C to stop
         | 
| 225 | 
            -
            ~~~~
         | 
| 226 | 
            -
             | 
| 227 | 
            -
            ### capistrano3-puma
         | 
| 228 | 
            -
             | 
| 229 | 
            -
            By default, [capistrano3-puma](https://github.com/seuros/capistrano-puma) uses
         | 
| 230 | 
            -
            `pumactl` for deployment restarts outside of systemd. To learn the exact
         | 
| 231 | 
            -
            commands that this tool would use for `ExecStart` and `ExecStop`, use the
         | 
| 232 | 
            -
            following `cap` commands in dry-run mode, and update from the above forking
         | 
| 233 | 
            -
            service configuration accordingly. Note also that the configured `User` should
         | 
| 234 | 
            -
            likely be the same as the capistrano3-puma `:puma_user` option.
         | 
| 235 | 
            -
             | 
| 236 | 
            -
            ~~~~ sh
         | 
| 237 | 
            -
            stage=production # or different stage, as needed
         | 
| 238 | 
            -
            cap $stage puma:start --dry-run
         | 
| 239 | 
            -
            cap $stage puma:stop  --dry-run
         | 
| 240 | 
            -
            ~~~~
         | 
| 241 | 
            -
             | 
| 242 | 
            -
            [Restart]: https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=
         | 
| 243 | 
            -
            [#1367]: https://github.com/puma/puma/issues/1367
         | 
| 244 | 
            -
            [#1499]: https://github.com/puma/puma/issues/1499
         | 
| @@ -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 setup 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 it's 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 rhe `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 | 
            -
            }
         | 
    
        data/ext/puma_http11/ext_help.h
    DELETED
    
    | @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            #ifndef ext_help_h
         | 
| 2 | 
            -
            #define ext_help_h
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            #define RAISE_NOT_NULL(T) if(T == NULL) rb_raise(rb_eArgError, "%s", "NULL found for " # T " when shouldn't be.");
         | 
| 5 | 
            -
            #define DATA_GET(from,type,data_type,name) TypedData_Get_Struct(from,type,data_type,name); RAISE_NOT_NULL(name);
         | 
| 6 | 
            -
            #define REQUIRE_TYPE(V, T) if(TYPE(V) != T) rb_raise(rb_eTypeError, "%s", "Wrong argument type for " # V " required " # T);
         | 
| 7 | 
            -
            #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            #ifdef DEBUG
         | 
| 10 | 
            -
            #define TRACE()  fprintf(stderr, "> %s:%d:%s\n", __FILE__, __LINE__, __FUNCTION__)
         | 
| 11 | 
            -
            #else
         | 
| 12 | 
            -
            #define TRACE() 
         | 
| 13 | 
            -
            #endif
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            #endif
         |