You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tamas <to...@net800.co.uk> on 2000/11/13 11:52:13 UTC

PerlAuth DB configuration.

Hi again,

Having not really found viable solution to my sleeping processes,
I thought it best to try and cut down on the number of DB connections
that I make during the Auth steps.

I have a database for each site, so that I can handle Authorization
based on different user information. Currently I connect to a DB
and look up which DB I should be using for the Auth. And then
connect to that DB.

I end of with 4 DB connections for each web server thread (2 for Authen
and 2 for Authz). After a short time of inaction (about 30 secs), the
web server makes a new child, and the 4 DB connections just sit there.
Useless. And 4 more are created for the new thread.

Now this is starting to look a little inefficient, and I was wondering
if anyone who has any experience with this kind of problem could give me
a few pointers; some different (better) ideas on how to solve the problem.

All the software is free (Apache, mySQL).

Cheers,
Tom

PS: Sorry if you feel the solution lies outisde of Perl.

Re: PerlAuth DB configuration.

Posted by re...@ch.twi.tudelft.nl.
On Mon, 13 Nov 2000, Tamas wrote:

> Hi again,

Hi,

> Having not really found viable solution to my sleeping processes,
> I thought it best to try and cut down on the number of DB connections
> that I make during the Auth steps.
> 
> I have a database for each site, so that I can handle Authorization
> based on different user information. Currently I connect to a DB
> and look up which DB I should be using for the Auth. And then
> connect to that DB.
> 
> I end of with 4 DB connections for each web server thread (2 for Authen
> and 2 for Authz). After a short time of inaction (about 30 secs), the
> web server makes a new child, and the 4 DB connections just sit there.
> Useless. And 4 more are created for the new thread.

I suppose you are using Apache::DBI then...

> Now this is starting to look a little inefficient, and I was wondering
> if anyone who has any experience with this kind of problem could give me
> a few pointers; some different (better) ideas on how to solve the problem.

I have considered the same problem once...
What I have tried (but never yet further implemented) and seems to be
possible, is connecting to one (general dummyor even none at all,
that is an empty databasename while connecting) database. If you use the
same database-user and database-password with Apache::DBI, with mySQL you
can then do a

	$dbh->do(use otherdatabase);

after which you're connection is effectively another database, with the
same db-user and db-passwd. Theonly thing you must surely do, is do a use
database every start of a request. I do not know whether it is portable to
other databases. Neither have I considered security-risks or other
"shielding" of separate users...

Maybe it's a useable suggestion. Of course I would like to know the
results if you try some.
Any comment from (Apache::)DBI-people on this ?

> All the software is free (Apache, mySQL).
> 
> Cheers,
> Tom
> 
> PS: Sorry if you feel the solution lies outisde of Perl.

I think the problem quite mod_perl specific, a solution maybe not...

Bye,
remco

/----------------------------------------------------------------------\
| Remco Schaar                                                         |
| e-mail: Remco@ch.twi.tudelft.nl                                      |
\----------------------------------------------------------------------/

    South Park meets Linux:
        - "Oh my God, they killed init!"
        - "You bastards!"