Sharing a DBI::Mysql database connection with your children
am 31.03.2008 05:45:45 von Andrew DeFariaThis is a multi-part message in MIME format.
--------------050001070300010900070500
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
I have a process I was thinking of making into a multithreaded daemon
that deals with a MySQL database. The thought is that the daemon would
open the database once, then listen for clients. As clients connected
the daemon would fork off a copy of itself and handle the requests. This
would make the process faster because I wouldn't need to open the
database every time a new client wanted service.
However, I've found that once I fork the database handle (obtained
through DBI) is no longer valid. Reading around a little bit I noticed
people saying to reopen or reconnect to the database in the child. Well
that's the very time consuming thing I was trying to avoid!
Does anybody know how to open a MySQL database such that that database
connection can be used in forked children?
--
Andrew DeFaria
Instead of talking to your plants, if you yelled a them would they still
grow, only to be troubled and insecure?
--------------050001070300010900070500
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
I have a process I was thinking of making into a multithreaded daemon
that deals with a MySQL database. The thought is that the daemon would
open the database once, then listen for clients. As clients connected
the daemon would fork off a copy of itself and handle the requests.
This would make the process faster because I wouldn't need to open the
database every time a new client wanted service.
However, I've found that once I fork the database handle (obtained
through DBI) is no longer valid. Reading around a little bit I noticed
people saying to reopen or reconnect to the database in the child. Well
that's the very time consuming thing I was trying to avoid!
Does anybody know how to open a MySQL database such that that database
connection can be used in forked children?
Instead of talking to your plants, if you
yelled a them would they still grow, only to be troubled and insecure?
--------------050001070300010900070500--