PerlRequire "/etc/apache2/startup.pl"
PerlModule Apache::DBI
PerlModule SQLLoad;
PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "SQLLoad"
SetHandler perl-script
PerlHandler SQLLoad
ServerLimit 2000
StartServers 1
MinSpareServers 1
MaxSpareServers 1
MaxClients 2000
MaxRequestsPerChild 200
####
startup.pl:
use DBI ();
use CGI ();
CGI->compile(':all');
DBI->install_driver("Oracle");
SQLLoad.pm:
package SQLLoad;
use strict;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::Const -compile => qw(:common);
use DBI;
use CGI;
our $dbh;
sub handler
{
my $r = shift;
# Connect to DB
$dbh = DBI->connect( "DBI:Oracle:host=oracle.ourdomain.com;port=1521;sid=XE", "hr", "password" ) unless $dbh;
my $err = '';
# Do the selects
my $dbi_query_object = $dbh->prepare("SELECT id FROM zz_system_options");
$dbi_query_object->execute();
my $dbi_insert_object =
$dbh->prepare("INSERT INTO zz_system_options (id,option_name) VALUES (zz_system_optionsids.nextval,?)");
$dbi_insert_object->execute("load testing");
# Print out some info about this...
$r->content_type('text/plain');
$r->print("Errors: \n");
return Apache2::Const::OK;
}
####
$cs = "//oracle.ourdomain.com:1521/XE";
$oc = oci_pconnect("hr","password",$cs);
if(!$oc) { print oci_error(); }
$stid = oci_parse($oc, 'SELECT id FROM zz_system_options WHERE id = 1');
oci_execute($stid);
$stmt = oci_parse($oc, "INSERT INTO zz_system_options (id,option_name) VALUES (zz_system_optionsids.nextval,'load testing')");
oci_execute($stmt);
echo "hello world";
####
Concurrency Level: 300
Time taken for tests: 13.286 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2071035 bytes
HTML transferred: 110055 bytes
Requests per second: 752.69 [#/sec] (mean)
Time per request: 398.569 [ms] (mean)
Time per request: 1.329 [ms] (mean, across all concurrent requests)
Transfer rate: 152.23 [Kbytes/sec] received
####
Concurrency Level: 300
Time taken for tests: 63.716 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1541003 bytes
HTML transferred: 130923 bytes
Requests per second: 156.95 [#/sec] (mean)
Time per request: 1911.488 [ms] (mean)
Time per request: 6.372 [ms] (mean, across all concurrent requests)
Transfer rate: 23.62 [Kbytes/sec] received