Skip to content

Commit e449c43

Browse files
committed
fix: optimize puma configs
1 parent f1318d6 commit e449c43

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

config/puma.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
2-
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 10)
1+
workers Integer(ENV['WEB_CONCURRENCY'] || 4)
2+
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
33
threads threads_count, threads_count
44

55
preload_app!
66

77
rackup DefaultRackup
88
port ENV['PORT'] || 3000
9-
environment ENV['RACK_ENV'] || 'development'
9+
environment ENV['RACK_ENV'] || 'production'
1010

1111
on_worker_boot do
12-
# Worker specific setup for Rails 4.1+
13-
# See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
1412
ActiveRecord::Base.establish_connection
1513
end
14+
15+
before_fork do
16+
ActiveRecord::Base.connection_pool.disconnect!
17+
end

0 commit comments

Comments
 (0)