If you are not sure whether this module is working as advertised and that your connections are actually persistent, you should enable debug mode in the startup.pl script, like this:
$Apache::DBI::DEBUG = 1;
Starting with Apache::DBI Version 0.84, the above setting will produce only minimal output. For a full trace, you should set:
$Apache::DBI::DEBUG = 2;
After setting the DEBUG level, you will see entries in the error_log file. Here is a sample of the output with a DEBUG level of 1:
12851 Apache::DBI new connect to 'test::localhostPrintError=1RaiseError=0AutoCommit=1' 12853 Apache::DBI new connect to 'test::localhostPrintError=1RaiseError=0AutoCommit=1'
When a connection is reused, Apache::DBIstays silent, so you can see when a real connect( ) is called. If you set the DEBUG level to 2, you'll see a more verbose output. This output was generated after two identical requests with a single server running:
12885 Apache::DBI need ping: yes 12885 Apache::DBI new connect to 'test::localhostPrintError=1RaiseError=0AutoCommit=1' 12885 Apache::DBI need ping: yes 12885 Apache::DBI already connected to 'test::localhostPrintError=1RaiseError=0AutoCommit=1'
You can see that process 12885 created a new connection on the first request and on the next request reused it, since it was using the same connect( ) argument. Moreover, you can see that the connection was validated each time with the ping( ) method.
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).