DBI: For speed-critical forking server, is DB reconnection in each child required? And prepared statements?

James Marshall <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <CAGEp=f1ouw1XNbK5uCDDQaMzBMXO1RNSgs0+rhO5y9ptPav9Xw@mail.gmail.com>
I'm writing a forking HTTP server that needs to access a database with each
hit.  Speed is pretty important, so I was hoping to reuse database handles
and prepared statement handles in the forked child processes.  Is this
possible, or do I really need to reconnect to the database and prepare the
statements in each child?

Info I found from googling, faqs, and list archives generally implies
reconnection is required, but is inconclusive (at least what I found).

Alternately, is there any way to clone (deep or shallow) a prepared
statement handle without repreparing, or a database handle without
reconnecting?

The only solution I've come up with is to have the server daemon manage a
pool of connected database handles and prepared statement handles, which
complicates the program a bit.  Any other solutions I'm missing?

Thanks!  Links to old discussions welcome if this has been answered before.

James
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.