Re: Connection pool issues with clsql
Kevin Rosenberg <kevin-HJRc7zDS/[email protected]>
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <[email protected]> |
On Feb 3, 2010, at 7:17 AM, Ralf Mattes wrote: > But we still have some "issues" with connection pooling. One nagging > problem we repeatedly run into: the pool never realeases connections, so > if you have a peek of parallel connections the pool keeps them hanging > around. Well, that is the point of the pool -- to keep connections open with the assumption that they'd all be used at some point in the future. I do see your point about if there is a significantly higher peak usage than average usage so non-needed connections are left open. There are several ways to add flexibility to the logic of removing connections from the pool that one doesn't think would be needed later on. Some possibilities, in increasing order of implementation complexity, are: 1) Use the existing CLEAR-CONN-POOL function in your application to clear all connections. 2) Add a variable, such as *MAXIMUM-POOLED-CONNECTIONS* so that if a connection is released back, but the pool has hit maximum size, then the released connection will be closed and discarded. A value of NIL means no maximum, which is the current behavior. 3) Add a variable, such as *MAXIMUM-LIFETIME-UNUSED-POOLED-CONNECTION* which limits the life of a that a pooled connection will exist unused. Every time a connection is requested or released, the library will search all pooled connections and close/discard any connection which has a unused time greater than that variable. To the degree this issue has been "nagging" for you, the most immediate compensation would be to add a periodic call to CLEAR-CONN-POOL from your application. Kevin