I have a Sinatra app running on Heroku free plan with Postgres, and I tried to set the database connection to 20 but after I pushed and run heroku pg:info
the connection is still 5/20. It also wouldn't use all 20 connections even if I try to to a loader.io load test on it.
So I wonder what could I do to make it utilize all the 20 available connections or I am having some misunderstanding here?
# database.yml (for ActiveRecord)
production:
adapter: postgresql
encoding: unicode
database: mydb
username: <%= ENV['PG_USER'] %>
password: <%= ENV['PG_PASS'] %>
pool: <%= ENV['DB_POOL'] || ENV['RAILS_MAX_THREADS'] || 20 %>
# Procfile
web: bundle exec puma -t 5:20 -p $PORT
# puma.rb
preload_app!
on_worker_boot do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end
# config.ru
require_relative './config/init'
use Rack::SSL if ENV['RACK_ENV'] == 'production'
run Sinatra::Application
The DB_POOL
variable has been set to 20 on Heroku but it still doesn't do anything. Any help will be appreciated.
I fixed this by running puma with -C config/puma.rb