Skip to content

Commit

Permalink
fix: optimize puma configs
Browse files Browse the repository at this point in the history
  • Loading branch information
exKAZUu committed Apr 18, 2024
1 parent f1318d6 commit e449c43
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions config/puma.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 10)
workers Integer(ENV['WEB_CONCURRENCY'] || 4)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
environment ENV['RACK_ENV'] || 'production'

on_worker_boot do
# Worker specific setup for Rails 4.1+
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
ActiveRecord::Base.establish_connection
end

before_fork do
ActiveRecord::Base.connection_pool.disconnect!
end

0 comments on commit e449c43

Please sign in to comment.