Hi all,

I would like to pool my database connections in an application I'm writing,
and so far haven't found any prior art on the subject (besides this[1]). I
was wondering if:

* There's a package somewhere that does this
* Others have implemented it and have suggestions
* There's some big gotchas

The stackoverflow that I linked to gives one approach to this that seems
valid. My original thought on an implementation was to use a Chan. That way:

* 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).
* If a process dies and for some reason doesn't return its connection, there
shouldn't be a problem. Of course, I'd use bracket, so such a situation
should never arise anyway.
* Keep the coding against MVar to a minimum to avoid normal multi-threaded
pitfalls.

I'm using HDBC in this case, but I don't think I'll be using any
HDBC-specific code.

Thanks,
Michael

[1]
http://stackoverflow.com/questions/1141677/concurrent-db-connection-pool-in-haskell
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to