I'm trying to figure out how many database connections my app will use.
It's Rails 5 hosted on Heroku.
Here is my Puma config
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
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'
on_worker_boot do
ActiveRecord::Base.establish_connection
end
And the first part of my DB config:
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %>
The part that seems strange to me is # of connections, and also my pool
setting in database.yml
are all using RAILS_MAX_THREADS
... but shouldn't it be using RAILS_MAX_THREADS
multiplied by the number of workers (WEB_CONCURRENCY
?