Re: Sharing a DBI::Mysql database connection with your children

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Quoted text here. Click to load it
Quoted text here. Click to load it
Do you want to use threads or fork?

Quoted text here. Click to load it

This cannot be done. Not only will the database server get a mixture of
requests from different database clients on the same connection (this
could be solved), but it also has to send back all replies via the same
connection: Which client will receive the response? There is no way to
determine that.

(There is at least one RDBMS where the client automatically opens a new
connection when it detects a pid change - presumably the new connection
will be pre-authenticated and faster to establish).

Your best bet is probably to use a pre-forked approach like some web
servers. Run a number of your your daemons in parallel, all listening on
the same port. A client connecting to that port will get any of them.
If all are busy, the client has to wait, or a controlling process can
start more worker processes.


Site Timeline