How to use connection pool in Rails2.3.5 with WEBrick and MySQL?

We use Rails 2.3.5, MySQL, and WEBrick.

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.

| Privacy Policy | Terms of Service | Remote Ruby Jobs