Reducing Page Flicker with Turbo Frames in Rails
Learn how to eliminate full-page reloads in Ruby on Rails using Turbo Frames to create a snappier, SPA-like experience without leaving the server-side ecosystem.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to eliminate full-page reloads in Ruby on Rails using Turbo Frames to create a snappier, SPA-like experience without leaving the server-side ecosystem.
Symptom A Rails application running on Puma with multiple threads intermittently raises ActiveRecord::ConnectionTimeoutError ("could not obtain a database connection within 5.000 seconds") under moderate load. Sampling ActiveRecord::Base.connection_pool.stat during incidents shows busy equal to the configured pool size and waiting above zero, which points at
ActiveRecord::Base.retry_on is documented to automatically retry on database errors such as ActiveRecord::Deadlocked. The retry is implemented by re-executing the entire transaction block from the start rather than resuming mid-statement. Because the block is re-run, non-idempotent operations inside the block can execute multiple times. This includes counter
To minimize infrastructure costs for low-traffic workloads, Ruby on Rails applications often utilize a single-process, multi-threaded Puma configuration. This approach aims to reduce the total RAM footprint by avoiding the overhead of multiple worker processes. However, there is uncertainty regarding the relationship between thread count and memory bloat whe