elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

Investigate delaying checkin for poolboy pool (and single connection) #38

Closed fishcakez closed 8 years ago

fishcakez commented 8 years ago

When a socket is checked in to the DBConnection.Connection process and no check outs requests are waiting in the internal queue it sets the socket into active: :once. If there is a client queue in Poolboy's central process a client will immediately be assigned to the connection process, a checkout request sent to the connection, the socket will be set to active: false immediately and checked out again. Given that idle connections are pinged at :idle_timeout we could investigate if delaying the check in/ active: :once until the first idle timeout improves performance under load.

fishcakez commented 8 years ago

Simpler approach added in 1ff760bca1f7467c9da6d8688c498ade337831c9 and defaulting to :passive (as sojourn pool does).