Skip to content

Commit

Permalink
chore(puma): Tweak puma configuration (#2037)
Browse files Browse the repository at this point in the history
- Tweak puma configuration to improve performances
  • Loading branch information
jdenquin authored May 20, 2024
1 parent cd8fc7c commit ba1a328
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
min_threads_count = ENV.fetch('RAILS_MIN_THREADS', 0)
threads min_threads_count, max_threads_count

# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
worker_timeout 12 if ENV.fetch('RAILS_ENV', 'production') == 'production'

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
Expand All @@ -39,7 +40,7 @@
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!
preload_app! if ENV['WEB_CONCURRENCY'].present?

# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart

0 comments on commit ba1a328

Please sign in to comment.