Forum OpenACS Development: Re: Proposed correction to DB Pools settings in OpenACS default config.tcl

to be sore, about which version of aolserver are you talking?
at least in 4.5*, the values of "0" mean no predefined lifetime for the handles, they are kept open as long they are not stale or closed for other reasons. The value means "maximum performance".

Providing the values helps for e.g. db-memory leaks, which is not an issue (at least not with postgres).

Gustaf,

I have just checked my references. The docs I looked up were the configuration reference material at www.aolserver.com.

Initially, the detailed reference....

http://www.aolserver.com/docs/admin/config-detailed.html

{

MaxIdle

600

The maximum length of time in seconds that a database connection within this pool can remain open and idle.

The default setting causes connections that are idle for 10 minutes to be closed. Note that MaxIdle will not have an effect if it is equal to MaxOpen.

Setting MaxIdle to 0 makes it impossible for database handles to become stale, unless the MaxOpen time expires.

MaxOpen

3600

The maximum length of time in seconds that a database connection within this pool can remain open. It is recommended that MaxOpen be a multiple of MaxIdle; otherwise, MaxOpen may be off by as much as (MaxOpen mod MaxIdle).

The default setting causes all connections to be closed after one hour, regardless of activity level. Database pool connections will then be opened again as needed up to the value of the Connections parameter.

Setting MaxOpen to 0 makes it impossible for database handles to become stale when they are not idle.

}

...and this file states that where differences exists between it and the "Annotated Configuration Reference", the latter is authoritative. It is found at this url:

http://www.aolserver.com/docs/admin/config-reference.tcl.txt

...and seems to re-inforce the same information, to the effect that the defaults are 600 and 3600 respectively, and that a setting of 0 causes connections to close immediately their initial purpose has been fulfilled.

Regards
Richard

The documentation above says that "setting MaxIdle to 0 makes it impossible for database handles to become stale". "stale" means that the connection will close.

The 2nd source, the config-reference.tcl.txt is not complete and does not tell what happens in the 0 case (or negative case). Not sure, where you are reading "0 causes connections to close immediately their initial purpose has been fulfilled" ... whatever this might mean.

If aolserver would close after every db-query the connection, it would be horrible for our setup. In our production environment, we have 90 connection threads and 150 db-connections, every day typically 1000 concurrent users, ... and we are using 0 for both values.

Anyhow, you don't have to believe me, the authoritative source is the code:

if ((handlePtr->poolPtr->maxidle && handlePtr->atime < minAccess) ||
(handlePtr->poolPtr->maxopen && (handlePtr->otime < minOpen)) ||
(handlePtr->stale == NS_TRUE) ||
....
see on
http://aolserver.cvs.sourceforge.net/viewvc/aolserver/aolserver/nsdb/dbinit.c?annotate=1.5&pathrev=aolserver_v45_r1

if maxidle or maxopen are 0, the timeouts do not apply, no close happens for that reason....

-gustaf neumann

Gustaf,

Be assured that I didn't doubt your assertion for a second, particularly since I know you are part of the core team for Aolserver! I merely wanted to flag up the source of my misinterpretation to establish whether or not the docs needed to be updated or clarified.

The source of the confusion was that I understood the word 'stale' to mean something other than closed (hung process or something!).

I also assumed, in the absence of specific detail about the 0 case, that this would mean zero seconds as a timeout, leading to a connection being stale after 0 seconds.

The code is crystal clear, thanks.

Richard