File: abtest

package info (click to toggle)
libkqueue 0.9.2-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 508 kB
  • ctags: 614
  • sloc: ansic: 5,418; sh: 258; makefile: 202; perl: 22
file content (32 lines) | stat: -rwxr-xr-x 689 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl
#
# Test using ApacheBench against an HTTP server with lots of idle clients
#
use IO::Socket;
use Getopt::Long;

use strict;
use warnings;

our $NCLIENT = 3000;
our $BASELINE = 0;
our @CLIENT;

sub create_client {
    my $socket = new IO::Socket::INET (
            PeerAddr  => '127.0.0.1',
            PeerPort  =>  8080,
            Proto => 'tcp',
            )                
        or die $!;
    push @CLIENT, $socket;
}

GetOptions("baseline" => \$BASELINE, "idle=i" => \$NCLIENT) or die;

for (my $i = 0; $i < $NCLIENT; $i++) { 
    create_client();
}
print "====> Created $NCLIENT idle connections <=====\n";

system "ab -n 5000 -c 500 http://localhost:8080/";