<div dir="ltr">Hi all,<div><br></div><div>I would like to pool my database connections in an application I&#39;m writing, and so far haven&#39;t found any prior art on the subject (besides this[1]). I was wondering if:</div>
<div><br></div><div>* There&#39;s a package somewhere that does this</div><div>* Others have implemented it and have suggestions</div><div>* There&#39;s some big gotchas</div><div><br></div><div>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:</div>
<div><br></div><div>* 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).</div><div>* If a process dies and for some reason doesn&#39;t return its connection, there shouldn&#39;t be a problem. Of course, I&#39;d use bracket, so such a situation should never arise anyway.</div>
<div>* Keep the coding against MVar to a minimum to avoid normal multi-threaded pitfalls.</div><div><br></div><div>I&#39;m using HDBC in this case, but I don&#39;t think I&#39;ll be using any HDBC-specific code.</div><div>
<br></div><div>Thanks,</div><div>Michael</div><div><br></div><div>[1] <a href="http://stackoverflow.com/questions/1141677/concurrent-db-connection-pool-in-haskell">http://stackoverflow.com/questions/1141677/concurrent-db-connection-pool-in-haskell</a></div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"></div>