Re: Help with my perl script



On 8/23/06, Stephen Carville <stephen@xxxxxxxxxxxxxx> wrote:

joe bayer wrote:
> Group,
>
> I am trying to write a load testing script.
>
> The script goes like this: ++++++++++++++++++++++++++++++++++ my $j =
> 0; while ($j < 300) { $dbh[$j] = DBI->connect (
> "dbi:Oracle:$instance[$i]", "$username[$i]", "$passwd[$i]", {
> PrintError => 1, RaiseError => 1, AutoCommit => 1 } ) || die
> "Database Connection not made $DBI::errstr" ;# Create a Database #do
> some random, endless select statement here. $j++; }
> ++++++++++++++++++++++++++++++++++++++++++
>
> What I want is 300 session do the select statement simultaneously.
> But this script will do one session after another.
>
> Do I REALLY have to start 300 perl script in order to this testing,
> or there is some way in perl that one script can start up 300
> session and do their invidual select simultaneously?

Check out Parallel::ForkManager.

> Thanks for your help.
>
> Joe
>
> --------------------------------- All-new Yahoo! Mail - Fire up a
> more powerful email and get things done faster.



Hi Stephen,

Unless I'm missing something (I'm no expert in this arena)
It seems like a script will ecxecute one stmt at a time anyway-
so how about cranking up 300 separate Perl scripts that synchoronize (ie,
soak up all available system resources simultaneously) with a named
semaphore?

(Win)
$sem = Win32::Semaphore->new($initial,$maximum,$name);

(Unix)
$sem = new IPC::Semaphore(IPC_PRIVATE, 10, S_IRWXU | IPC_CREAT);

I would envision you building a 300-line script to start up each individual
DB connect, and a single Perl script to "lower the flag" - causing the 300
perl scripts to pounce.

It seems like this is a much better test anyway- because I very much doubt
as *single* perl script will have 300 separate DB connections... but then
again... I don't know what your environment needs.

HTH

KC

Relevant Pages

  • [NEWS] IBM Informix Web DataBlade Local Root by Design
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... that ease development of "intelligent", interactive, Web-enabled database ... person who has access to change the Perl script. ...
    (Securiteam)
  • my perl script for ripping mp3s...aka MP3scRIPt
    ... This is a Perl script to convert audio cd tracks to mp3s. ... Possibly root privs to access the cdrom device ... - this is mainly a problem on 'variety cds', mp3 files suffering from this ill ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Perl script to mimic uniq
    ... mdfoster44@netscape.net spits TOFU in my face: ... > # Perl script to find most common CS ... > So I'm back to my original script which looks like this. ... > identify a sequence as unique. ...
    (comp.lang.perl)
  • Re: Slow Performance When Using DBI, otherwise Not
    ... If I run the same perl script on the database server itself it runs ... check versions of DBI and DBD (I greped for version on every module under ...
    (perl.dbi.users)
  • Re: Recovering from compromised system
    ... > perl script I have ever seen, and I would hate even more to learn a new ... > language to understand one script. ... That command is normal for a lot of substring functions. ... Hey, put a few lines in list_2_ck, run the perl script, cat j.ksh. ...
    (comp.os.linux.security)