> its definitely running under mod_perl. But imho the time it takes to
> create a new cgi-object should not depend too much wheter its running
> under mod_perl or not, cause the CGI-module is loaded before. (In fact
> I load in httpd.conf using PerlModule-Directive)

If it was running under CGI, it would be compiling CGI.pm on each request,
which I've seen take .3 seconds.  Taking that long just to create the new
CGI instance seems unusual.  How did you time it?  Are you using
Apache::DProf?

> This makes very much sense. Apache::DBI does not limit the number of
> persistent connections. It just keeps all the connections open per
> apache-process.

That should mean one connection per process if you're connecting with the
same parameters every time.

>  if (exists($ptr->{global}->{dbhandles}->{_some_id_string}))

You know that this is only for one process, right?  If you limit this cache
to 20 connections, you may get hundreds of connections.

> I would prefer to handle this in a special pooling-module
> like Apache::DBI is, but where one can specify a maximum number of
> open connections and a timeout per connection (connection will be
> terminated after it was not used a specified amount of time).

You can just set a timeout in your database server.  If a connection times
out and then needs to be used, the ping will fail and Apache::DBI will
re-connect.

> As soon
> as I get IPC::Sharable to work I'll consider writing such a thingy.

You can't share database handles over IPC::Shareable, but you could share a
global number tracking how many total database handles exist.  However, I
think you'd be better off using Apache::DBI and limiting the number of
Apache children to the number of connections your database can deal with.

- Perrin

Reply via email to