Posts mit dem Label benchmark werden angezeigt. Alle Posts anzeigen
Posts mit dem Label benchmark werden angezeigt. Alle Posts anzeigen

Dienstag, 14. Juni 2011

Simple Web benchmark with Perl or faking web login with Perl

Sometimes it is not necessary to start Apache's jmeter or selenium for benchmarking a web site.
But one difficulty remains: Authentification.

What else is needed by common frameworks?
- HTTPS
- Cookies
  • Package libwww-perl (perl-libwww-perl-5.805-1.1.1.noarch or perl-libwww-perl)
  • Package HTTP
For details have a look at CPAN

Perl helps out with a few lines. Furthermore this also one way for automating web login to gain a valid session. This valid Session (or rather the Cookie) will be stored in the variable "$browser".

#!/usr/bin/perl
use LWP;
use Data::Dumper;
use HTTP::Cookies;
use Time::HiRes qw( time );

my $browser = LWP::UserAgent->new;
my $cookie_jar = HTTP::Cookies->new();
$browser->cookie_jar($cookie_jar);

my $loggedinPage = $browser->post(
'https://cv-parser.de/',
['username'=>'user', 'password' => 'password' ]
);
my $start = time();
print 'Header: '. Dumper($loggedinPage->{'_headers'})."\n";
my $end = time();
printf("Login: %.2f\n", $end - $start);


The only difficult part, is to evaluate the form parameter which the original site uses.
At this point Firebug or Chrome development bar is your friend.

Donnerstag, 11. Oktober 2007

sysbench - create high system load

SysBench- the system benchmark is the utility for creating high load on a machine.

So for example with this parameters:
sysbench --max-time=86400 --num-threads=4096 --max-requests=1000000 --thread-stack-size=512 --init-rng=on --validate=on --test=fileio --file-total-size=1024M --file-test-mode=rndwr run you can get a load about 4000, very impressive. So if you ever searched some tool for creating a lot of stress, this one your friend.
See this:
top - 16:26:35 up 1 day, 19 min, 3 users, load average: 7361.45, 7355.47, 735

BTW, the machine was a single processor Intel P4 3.6 GHz with 3GB DDR ECC RAM and Maxtor IDE drive.

(If you ever wanted to know, what the load of a linux system stands for, this link explains it).