darling-libkqueue/test/benchmark/abtest
mheily f6550c4888 more benchmark
git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@226 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
2010-03-20 14:22:19 +00:00

33 lines
689 B
Perl
Executable File

#!/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/";