File: abtest

package info (click to toggle)
libkqueue 2.3.1-1.1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 792 kB
  • sloc: ansic: 9,341; makefile: 68; perl: 22; sh: 7
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/";