Perrin Harkins wrote: > > To answer the original question, I don't think Apache::DBI is much > overhead at all. It amounts to little more than a hash lookup. > Certainly less work than the the thread synchronization required for > connection pooling. >
My only problem with Apache::DBI for a benchmark is its default ping of the db per connect(). For a benchmark that is little more that a ping itself, this might not be fair to cause 2 pings. In this light, I might want to just use a global like: $dbh ||= DBI->connect(); I just did a quick test, and these were the results: Test Name Test File Hits/sec # of Hits Time(sec) secs/Hit Bytes/Hit Mem(KB) --------- --------- --------- --------- --------- --------- --------- --------- mod_perl HelloDB MySQL Apache::DBI my_hellod 451.3 9042 20.04 0.002216 191 16092 mod_perl HelloDB MySQL Global $dbh my_hellod 570.2 11418 20.02 0.001754 191 15296 My question is is this a fair optimization for a benchmark like this. I tend to not over optimize the benchmarks as a rule, but I spent hours ( & 12 lines of code :) ) writing an overly simple database connection pooling manager for the JSP benchmarks where a standard one seems to be lacking in JDBC & JNDI, so I'm not sure using a mod_perl global instead of Apache::DBI would be skewing things. The PHP test I had to do nothing, connection persistence is enabled by default. Thanks for the feedback & still looking for more! --Josh ________________________________________________________________ Josh Chamas, Founder phone:714-625-4051 Chamas Enterprises Inc. http://www.chamas.com NodeWorks Link Checking http://www.nodeworks.com