Just another Perl shrine | |
PerlMonks |
Sharing a database handle over multiple processesby Anonymous Monk |
on Jun 28, 2001 at 05:20 UTC ( [id://92147]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, monks! I've got a server which listen()s on a certain port and then fork()s off a new process for every accept()ed connection. Each child process then reads X number of bytes from the socket, checks data for validity and then writes everything to the database (Oracle). In the current implementation, each child process does its own $dbh = DBI->connect($source, $uname, $auth, \%attr); thing and I have a feeling that this slows things down dramatically... So, my question is: Is there a way to share the same database connection among multiple processes ? For instance, can I do the following? What will happen in case when multiple processes try to use their copies of $dbh at the same time? Any input is greately appreciated. Thanks in advance!
Back to
Seekers of Perl Wisdom
|
|