I am having problems with errors ActiveRecord::ConnectionTimeoutError
in my application recently. This is a Rails 4 application deployed to Heroku on Puma. When I start heroku pg:info
, I see that only 5/20 connections are active when I encounter an error ActiveRecord::ConnectionTimeoutError
. I ended up increasing my variable MAX_THREADS
and MIN_THREADS
env from 2 to 5 after reading this post in the Heroku forum , which is why the problem has disappeared for now, but this solution seems to apply black magic to the problem and hope that it goes away.
What I would like to know is how I can correctly determine how large my connection pool should be. Now I have one web worker and two additional resque
workers.
My application is currently handling a lot of S3 image downloads, which I think might cause a problem. This is what I want to talk to the employee about resque
to free the web employee. I noticed that the boot process accelerated when I increased the pool size, however, I am worried that simply increasing the pool size is not a scalable long-term solution.
source
share