Stas Bekman wrote:
Hi,
As mod_perl 2 is going to be released shortly the issue with DBI and friends not being thread-safe (I believe DBI is fine, but DBDs are not) becomes a problem. Since Apache 2 has a bunch of threaded MPM implementations and while Unix users could always use prefork MPM (no threads) windows users can't afford this luxary, they need the modules to be thread-safe in order to use those.
So how hard will it be to bring the DBI world to the thread-safety? What are the issues that prevent us from getting there (besides the ever lacking tuits).
Thanks.
Probably the biggest issue is the thread safety of the underlying DBMS client API (for non-pure perl implementations), and the XS wrapper.
For those of us with Pure Perl drivers, its a bit simpler: implement the CLONE method in the driver, and make sure any global variables that might exist are either shared or converted to instance (rather than package/class) level variables. For "real" databases, MySQL and Pg both have pure perl implementations, tho I'm not certain how current they are, nor whether they've been tested for thread safety at this point.
OK, but what about DBI itself. When installing with ithreads perl I get:
CPAN.pm: Going to build T/TI/TIMB/DBI-1.46.tar.gz
*** You are using a perl configured with threading enabled. *** You should be aware that using multiple threads is *** not recommended for production environments.
I guess we should start here before moving to talking about DBD::?
However, Since $dbh's can't be shared between threads, I wonder how Apache connection pools will behave in such an environment (if at all) ?
Once mod_perl 2.0 is released and assuming that I have the time, I'll continue working on DBI::Pool whose prototype was written some 2+ years ago.
-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com