open

Web Server benchmarks with PERL

Since the last update, i’ve been working on PERL to test web server benchmark performance. So far, i’m able to download and print a page, using the below mechanism:

#!/usr/bin/perl

require HTTP::Request;
require LWP::UserAgent;

my $url = ‘http://192.168.50.201/index.html’;
my $request = HTTP::Request->new(GET => $url);
my $ua = LWP::UserAgent->new;
my $response = $ua->request($request);
$response->is_success or die $response->status_line;
my $content = $response->content;
print $content;

I’m now looking into developing this code by using the below mechanism from CPAN.org and building it into the code:

use WWW::Mechanize::Timed;
my $ua = WWW::Mechanize::Timed->new();
$ua->get($url);
print “Total time: ” . $ua->client_total_time . “\n”;
print “Elapsed time: ” . $ua->client_elapsed_time . “\n”;

This will allow me to test the time taken to download a web page from the web server, e.g. IIS/Apache Tomcat which is useful to my virtualization thesis.

Leave a Reply

You must be logged in to post a comment.