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