I have a rails 4 application that I place on a hero. They give some specific recommendations on how to manage the database connection pool when using a multi-threaded server (puma) https://devcenter.heroku.com/articles/concurrency-and-database-connections
When I started load testing for my application, I got an error - I can not connect to db. when each page hits, the rails initialize the active record, even if I do not make any requests on this page or refer to any models.
My question is:
How can I make some kind of whitelist (or blacklist) so that the active record is not initialized with a db connection for these specific controller actions? In the initializer?
Ideally, I would run a cheaper postgres service on heroku (40 connections) because I know that my application does not use db very often. If traffic gets higher than 40 connections, an error will occur, which seems silly for an application that was not going to use db for these requests.
I read about how to disable active recording for the entire application: Disable ActiveRecord for Rails 4
But how to selectively enable it? Are there any other performance considerations here (not loading these things or any other errors)
ruby-on-rails activerecord postgresql connection-pooling heroku
awongh
source share