Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Sharing database handle

by mamboking (Monk)
on Apr 18, 2002 at 18:16 UTC ( #160294=note: print w/ replies, xml ) Need Help??


in reply to Sharing database handle

Instead of sharing a connection you probably want to do connection pooling. You could have your app open up a bunch of connections at application startup then as a child process is spawned it gets a connection from the pool. When it is finished it returns the connection to the pool. If there aren't any available connections then your process can block until one becomes available. Since opening and closing database connections is very costly this should greatly help your performance. Also, by pre-allocating the connections, you always have control over how many connections are out there.


Comment on Re: Sharing database handle
Re: Re: Sharing database handle
by perrin (Chancellor) on Apr 18, 2002 at 18:40 UTC
    I don't think that will actually work. The trouble is, you can't easilly pass DBI objects (which involve open sockets and XS code) back and forth between processes.
Re: Re: Sharing database handle
by belg4mit (Prior) on Apr 24, 2002 at 02:24 UTC
    Here is a connection pooler, sqlrelay. Good thing is it has interfaces for numerous languages as well (so you can pool what would otherwise be per-language puddles). I haven't gotten around to setting it up yet (tuit deficit), but look forward to doing so.

    --
    perl -pew "s/\b;([mnst])/'$1/g"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://160294]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-10-02 14:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (61 votes), past polls