ActiveRecord call ConnectionPool#checkout and create new connection to
MySQL when receive a first HTTP request.
At this time, register to connection pool its connection in
ConnectionPool#checkout_new_connection.
but, Rack::Handler::WEBrick#service call body.close in ensure section
when return the HTTP response.
It call another method. after some call, it call
ConnectionPool#clear_reloadable_connections and clear its connection
pool.
As a result, the connection was created by every request and spend
time for connection.
How to use connection pool?
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.