in reply to Database Workload Simulator

Here's a simple script that executes some SQL as often as possible. I've used it to e.g. measure the overhead of Java stored procedures in Sybase and stuff like that, but I think any SQL statement should work as long as it doesn't return billions and billions of rows. Check out the DBD::Oracle docs on how to form the connect string.

Start as many instances if you need to simulate many connections.

#!/usr/bin/perl -w $|++; use strict; use Time::HiRes qw/time/; use DBI; use DBD::Sybase; my ($dbi, $user, $pass, $sql, $logEvery) = @ARGV or die(q{ Syntax: call_sp connect_string user password sql Example: call_sp dbi:Sybase:server=DEV_DB_01_DS;database=test_performance sa PA +SSWORD "exec jpl_test" }); $logEvery ||= 200; my $dbh = DBI->connect( $dbi, $user, $pass, { RaiseError => 1, PrintError => 0 } ); my $sth = $dbh->prepare($sql); my @aOldAverage; my $maxOldAverage = 10; my $no = 0; my $timeLatest = time(); while(1) { if($no++ > $logEvery) { my $timeNow = time(); my $timeDuration = $timeNow - $timeLatest; my $freq = sprintf("%0.2d", $no / ($timeDuration || 1)); $timeLatest = $timeNow; $no = 0; push(@aOldAverage, $freq); if(@aOldAverage > $maxOldAverage) { shift(@aOldAverage); } my $oldCount = @aOldAverage; my $sum = 0; $sum += $_ for(@aOldAverage); my $avg = sprintf("%0.2d", $sum / $oldCount); print localtime() . ": $freq / sec ($avg/sec for the last $old +Count readings)\n"; } eval { $sth->execute(); }; if($@) { warn("$@\n"); $sth = $dbh->prepare($sql); next; } $sth->fetchall_arrayref; $sth->finish; } __END__

If you need more complex behaviour, you may need to develop a robot (bot) user that simulates typical behaviour with a proper mix of idle time, selects, inserts, etc. If most of the time is spent idle, look into POE (or something like that) to run hundreds or thousands of users in a single process. Start more processes until the machine can't handle any more, then add extra machines.

/J