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