DBI profiling

samtregar on 2002-10-06T20:14:18

A week or so ago I got the idea to build a generalized DBI profiler, similar in functionality to Devel::DProf (and my cheap knockoff, Devel::Profiler). A few months back I wrote a DBI profiler for Bricolage but it works through Bricolage's procedural wrapper around DBI so it can't be used by other apps. However, it was so insanely useful in solving some nasty performance problems that I don't want to have to do without it again.

So, I headed off to CPAN to make sure I wasn't reinventing the wheel. I'd already looked at DBIx::Profile and I knew it didn't fit my needs. It's definitely not up to the task of profiling an application making thousands of database queries in multiple processes (i.e. a large scale mod_perl app).

However, CPAN had a surprise in store for me: DBI::Profile. DBI::Profile is a module included in recent versions of DBI that provides basic profiling hooks and profile reporting. Although it isn't up to the job of profiling large applications, it was built to be extended by more featureful profilers. Wooo hooo.

So I wrote a message to dbi-users describing my project and soliciting advice. This resulted in Tim Bunce offering to make the module part of DBI if we could agree on the interface.

So, I got straight to work on fleshing out my design. The results are two POD docs posted to dbi-dev: DBI::ProfileDumper and dbi_prof. Any potential users out in the audience are encouraged to read them and tell me what I missed!

-sam