[Haskell-cafe] Database connection pool

Bryan O'Sullivan bos at serpentine.com
Thu May 6 02:13:49 EDT 2010


On Wed, May 5, 2010 at 10:51 PM, Michael Snoyman <michael at snoyman.com>wrote:

> * When a connection is released, is goes to the end of the pool, so
> connections get used evenly (not sure if this actually matters in practice).
>

In practice, you're better off letting idle connections stay that way,
because then your DB server can close connections and free up resources. In
other words, when you're done with a connection, put it at the front of the
reuse queue, not the back.

You'll also want to handle the possibility that a connection that you grab
from the pool has been closed by the server. Many connection pooling
implementations I've seen get this wrong in subtle or expensive ways.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100506/2a2c94f2/attachment-0001.html


More information about the Haskell-Cafe mailing list