Hi,

recently there was a large thread on connection pooling. One idea was to use
DBI::ProxyServer for this purpose. This may not fit all needs, but some
them, at least mine :-)

The idea is to use DBI's connect_cached method together with ProxyServer. As
in the above mentioned thread already discussed, this doesn't works out of
the box. So I hacked my way thru the sources and send two patches which
should make this possible.

The first one adds the 'connect_cached' configuration directive to
dbiproxy's configuration file. If set to true, DBI::ProxyServer uses
connect_cached, instead of connect. This alone works pretty well in single
mode (of course you have to take care that a process used the database
handle before, may have set some attributes. This is similar to the usage of
Apache::DBI under mod_perl), but when switching to forked mode it is pretty
useless, because every connection gets a new childs and therefore doesn't
get any cached connection.

So the second patch changes Net::Daemon to pre-fork a fixed number of
childs, before doing any processing. You can set the number with the new
configuration directive 'childs' (mode is ignored in this case). Because
these childs never ends (unless the parent process terminates), we now can
set the connect_cached configuration directive from the first patch and get
the benefit from cached connections.

Any comments are welcome

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     [EMAIL PROTECTED]         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------

ProxyServer.pm.diff

Daemon.pm.diff

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to