Tizen 2.1 base
[platform/upstream/gcd.git] / kqueue-1.0.4 / test / benchmark / abtest
1 #!/usr/bin/perl
2 #
3 # Test using ApacheBench against an HTTP server with lots of idle clients
4 #
5 use IO::Socket;
6 use Getopt::Long;
7
8 use strict;
9 use warnings;
10
11 our $NCLIENT = 3000;
12 our $BASELINE = 0;
13 our @CLIENT;
14
15 sub create_client {
16     my $socket = new IO::Socket::INET (
17             PeerAddr  => '127.0.0.1',
18             PeerPort  =>  8080,
19             Proto => 'tcp',
20             )                
21         or die $!;
22     push @CLIENT, $socket;
23 }
24
25 GetOptions("baseline" => \$BASELINE, "idle=i" => \$NCLIENT) or die;
26
27 for (my $i = 0; $i < $NCLIENT; $i++) { 
28     create_client();
29 }
30 print "====> Created $NCLIENT idle connections <=====\n";
31
32 system "ab -n 5000 -c 500 http://localhost:8080/";