Blogmark
The secret to perfectly calculate Rails database connection pool size
via jbranchaud@gmail.com
https://island94.org/2024/09/secret-to-rails-database-connection-pool-size
Ruby on Rails
Databases
tl;dr: don't compute the pool
size, set it to a big number, the pool size is the max that Rails enforces, but the thing that matters is the number of connections available at the database (which is a separate issue).
If, rather, you're running out of connections at the database, then try things like:
- reduce the number of Puma threads
- reduce background job threads (e.g. via GoodJob, Solid Queue, etc.)
- "Configure anything else using a background thread making database queries"
- among others
Or increase the number of connections available at the database with a tool like PgBouncer.
This post was written by the person who created GoodJob.