Description
I have noticed a large performance regression between Rails 4.2 and 6.1 when quickly checking out a large number of connections.
https://github.com/skunkworker/jruby_activerecord_checkout_regression
The included benchmark creates connection pools, randomly selects a pool, opens N
connections, runs select 1=1
then checks in the connections. Connected to the postgres
database (which should be empty).
When the Rails log level is set to :debug
. Rails 4.2 is up to 5x faster than 6.1. When using MRI, Rails 6.1 goes back to a normal amount of time.
When the Rails log level is set to :info
. Rails 4.2 is 1.5x faster than 6.1.
I'll be doing further investigation into multi database and multi schema with large tables to see if I can reproduce some of the behavior we have been seeing.