Patrick Kelley 8fd444092b initial
2025-05-07 15:35:15 -04:00

33 lines
672 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/";