Hello Marijn,
Quoth Marijn Haverbeke marijnh@gmail.com:
You're right, you have to use local connection and specify that you want them to be pooled. (This model has much less overhead -- a single synchronization point -- than a model where a single handle can be used in a multi-threaded way.)
This touches on something I've wanted to clarify for some time, namely, best practise for connecting to a database when using Postmodern in web application code.
1. Don't use a single, permanent connection, established at web server start time. This may work fine in development but will soon stall in production. Rather, wrap database operations in WITH-CONNECTION forms and always use pooled connections.
2. Avoid multiple WITH-CONNECTION forms (nested or otherwise) within the code handling a single HTTP request.
3. Leave *MAX-POOL-SIZE* bound to NIL (unlimited) at least to begin with. The number of pooled connections only grows when a new connection is needed and all others are busy. The size of the pool will therefore reflect the latest peak in web server traffic.
Any and all corrections, clarifications or refinements to my thinking very much appreciated.
Sebastian