annotate config/puma.rb @ 254:89f6c0016bab default tip

Update to latest rails
author nanaya <me@nanaya.net>
date Tue, 03 Sep 2024 19:21:25 +0900
parents d5a0d66ee457
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
1 # This configuration file will be evaluated by Puma. The top-level methods that
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
2 # are invoked here are part of Puma's configuration DSL. For more information
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
3 # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
4
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
5 # Puma starts a configurable number of processes (workers) and each process
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
6 # serves each request in a thread from an internal thread pool.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
7 #
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
8 # The ideal number of threads per worker depends both on how much time the
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
9 # application spends waiting for IO operations and on how much you wish to
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
10 # to prioritize throughput over latency.
89
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
11 #
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
12 # As a rule of thumb, increasing the number of threads will increase how much
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
13 # traffic a given process can handle (throughput), but due to CRuby's
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
14 # Global VM Lock (GVL) it has diminishing returns and will degrade the
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
15 # response time (latency) of the application.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
16 #
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
17 # The default is set to 3 threads as it's deemed a decent compromise between
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
18 # throughput and latency for the average Rails application.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
19 #
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
20 # Any libraries that use a connection pool or another resource pool should
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
21 # be configured to provide at least as many connections as the number of
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
22 # threads. This includes Active Record's `pool` parameter in `database.yml`.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
23 threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
89
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
24 threads threads_count, threads_count
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
25
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
26 # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
27 port ENV.fetch("PORT", 3000)
89
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
28
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
29 # Allow puma to be restarted by `bin/rails restart` command.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
30 plugin :tmp_restart
89
d5a0d66ee457 Finish updating to rails 5
nanaya <me@myconan.net>
parents:
diff changeset
31
254
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
32 # Specify the PID file. Defaults to tmp/pids/server.pid in development.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
33 # In other environments, only set the PID file if requested.
89f6c0016bab Update to latest rails
nanaya <me@nanaya.net>
parents: 89
diff changeset
34 pidfile ENV["PIDFILE"] if ENV["PIDFILE"]