-
-
Save wchristian/a90bcd5a854fa0ea76ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c:\wamp\bin\apache\Apache2.2.21\bin>ab -c 1 -n 30000 http://localhost:5000/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 3000 requests | |
Completed 6000 requests | |
Completed 9000 requests | |
Completed 12000 requests | |
Completed 15000 requests | |
Completed 18000 requests | |
Completed 21000 requests | |
Completed 24000 requests | |
Completed 27000 requests | |
Completed 30000 requests | |
Finished 30000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 5000 | |
Document Path: / | |
Document Length: 15 bytes | |
Concurrency Level: 1 | |
Time taken for tests: 6.481 seconds | |
Complete requests: 30000 | |
Failed requests: 0 | |
Write errors: 0 | |
Total transferred: 1800000 bytes | |
HTML transferred: 450000 bytes | |
Requests per second: 4629.24 [#/sec] (mean) | |
Time per request: 0.216 [ms] (mean) | |
Time per request: 0.216 [ms] (mean, across all concurrent requests) | |
Transfer rate: 271.24 [Kbytes/sec] received | |
Connection Times (ms) | |
min mean[+/-sd] median max | |
Connect: 0 0 0.7 0 16 | |
Processing: 0 0 1.2 0 16 | |
Waiting: 0 0 1.0 0 16 | |
Total: 0 0 1.3 0 16 | |
Percentage of the requests served within a certain time (ms) | |
50% 0 | |
66% 0 | |
75% 0 | |
80% 0 | |
90% 0 | |
95% 0 | |
98% 3 | |
99% 3 | |
100% 16 (longest request) | |
c:\wamp\bin\apache\Apache2.2.21\bin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d:\>perl -V | |
Summary of my perl5 (revision 5 version 12 subversion 4) configuration: | |
Platform: | |
osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread | |
uname='' | |
config_args='undef' | |
hint=recommended, useposix=true, d_sigaction=undef | |
useithreads=define, usemultiplicity=define | |
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef | |
use64bitint=undef, use64bitall=undef, uselongdouble=undef | |
usemymalloc=n, bincompat5005=undef | |
Compiler: | |
cc='C:/Perl/site/bin/gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T | |
-DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields', | |
optimize='-O2', | |
cppflags='-DWIN32' | |
ccversion='', gccversion='3.4.5 (mingw-vista special r3)', gccosandvers='' | |
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 | |
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 | |
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 | |
alignbytes=8, prototype=define | |
Linker and Libraries: | |
ld='C:\Perl\site\bin\g++.exe', ldflags ='-L"C:\Perl\lib\CORE"' | |
libpth=\lib | |
libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt | |
perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt | |
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl512.lib | |
gnulibc_version='' | |
Dynamic Linking: | |
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' | |
cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"' | |
Characteristics of this binary (from libperl): | |
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV | |
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS | |
PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS | |
USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF | |
USE_SITECUSTOMIZE | |
Locally applied patches: | |
ActivePerl Build 1205 [294981] | |
c6fbf28 [perl #71806] perldb does not setup %dbline with the shebang option -d | |
1fd8fa4 Add Wolfram Humann to AUTHORS | |
f120055 make string-append on win32 100 times faster | |
a2a8d15 Define _USE_32BIT_TIME_T for VC6 and VC7 | |
007cfe1 Don't pretend to support really old VC++ compilers | |
6d8f7c9 Get rid of obsolete PerlCRT.dll support | |
d956618 Make Term::ReadLine::findConsole fall back to STDIN if /dev/tty can't be opened | |
321e50c Escape patch strings before embedding them in patchlevel.h | |
Built under MSWin32 | |
Compiled at Jun 20 2011 18:35:25 | |
%ENV: | |
PERL_JSON_BACKEND="JSON::XS" | |
PERL_STRICTURES_EXTRA="1" | |
PERL_YAML_BACKEND="YAML::XS" | |
@INC: | |
C:/Perl/site/lib/MSWin32-x86-multi-thread | |
C:/Perl/site/lib | |
C:/Perl/lib | |
. | |
d:\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d:\>perl server.pl | |
GLOB(0x15fcfbc) at meep.pl line 30. | |
Terminating on signal SIGINT(2) | |
d:\> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use threads; | |
require Socket; | |
sub process_connection { | |
my ( $sock ) = @_; | |
setsockopt $sock, Socket::IPPROTO_TCP(), Socket::TCP_NODELAY(), 1 | |
or die "setsockopt: $!"; | |
while ( my $line = <$sock> ) { | |
$line =~ s/\015?\012$//; | |
if ( $line =~ /^$/ ) { | |
print $sock "HTTP/1.0 200 OK\015\012Content-Type: | |
text/plain\015\012\015\012Hello, world!\015\012"; | |
last; | |
} | |
} | |
close $sock; | |
} | |
socket my $server, Socket::AF_INET(), Socket::SOCK_STREAM(), 0 or die "socket: $!"; | |
setsockopt $server, Socket::SOL_SOCKET(), Socket::SO_REUSEADDR(), pack( "l", 1 ) or die "setsockopt: $!"; | |
bind $server, Socket::pack_sockaddr_in( 5000, "\x00\x00\x00\x00" ) | |
or die "bind: $!"; | |
listen $server, Socket::SOMAXCONN() or die "listen: $!"; | |
warn $server; | |
sub worker { | |
my ( $n, $server ) = @_; | |
while ( accept my $client, $server ) { | |
process_connection( $client ); | |
} | |
} | |
for my $n ( 1 .. 20 ) { | |
my $thr = threads->create( \&worker, $n, $server ); | |
} | |
foreach my $thr ( threads->list ) { | |
$thr->join; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment