annotate config/puma.rb @ 496:eadd0a3b9921

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