A Rails app at peak has two pools to size: Puma workers and threads, and the ActiveRecord connection pool behind them. Size Puma first, since the connection pool has to cover its threads. Start with Puma Workers and Threads for Rails at Peak.
- Could Not Obtain a Connection From the Pool in Rails
Give each Rails process a pool that covers every thread that can query, so ActiveRecord::ConnectionTimeoutError stops at peak and the database keeps headroom.
- Puma Workers and Threads for Rails at Peak
Size Puma workers to the CPU your Rails pod gets and threads to its I/O wait, so peak traffic queues less and the pod stays inside its memory limit.