If not specified, ActiveRecord starts 4 connections by default.
I noticed that if I reload a simple page that makes at least one call to ActiveRecord, 4 times each thing works fine. However, for the fifth time, it hangs for almost 5 seconds. Thus, every 5th page load freezes for 5 seconds.
I increased the default connection pool in my adapter to 8 and now it hangs every 9th page request. It does not seem to reuse connections, but instead kills them and restores them after reaching the pool limit.
I actually do not use ActiveRecord with the Rails stack.
Is there a magic ActiveRecord connection flag that prevents this? Or is there something else wrong?
source share