[Zope-dev] DB connection pooling
Erik Stephens
samurai@ep.newtimes.com
Mon, 05 Mar 2001 09:45:05 -0700
Dieter Maurer wrote:
>
> Erik Stephens writes:
> > I've been working on an implementation of connection pooling for the
> > MySQLDA. Basically, Zope connections will be pooled by connection
> > string to reduce the number of unecessary connections to MySQL.
>
> Isn't that trivial with Zope (thanks to acquisition)?
>
> Just instantiate a single MySQL Database Connection per connect
> string (sufficiently high above in the site hierarchy).
> Use it below through acquisition.
For security reasons, we don't want the connections at the root folder
(or some equivantly high point in the heirarchy). We cannot find a way
to disallow a user of an arbitrary role from accessing the connection
properties. If I create a separate role and remove all permissions for
that role, users of that role can still access the properties, in
particular the connection string with user name and password info.
Haven't researched if this is a bug or not. Probably would be better to
do that before trying to implement a pooling mechanism, eh?
Placing the connections where they are acquirable everywhere takes care
of one source of redundant/unnecessary connections. There is still the
potential for redundant/unnecessary connections from the fact that each
thread maintains its own connections. Of course, for speed, you might
want each thread to have its own connection.
I've only had experience with the MySQL DA. As far as connection
pooling is concerned, are the other DA's similar to the MySQL DA in that
respect.
Thanks,
Erik