And how many workers does apache have? I think thats what you're seeing
This is what I tried, can't get simpler/faster than this, cgi-bin/printenv.pl
#!perl print "Content-type: text/plain; charset=iso-8859-1\n\n"; foreach my $var (sort(keys(%ENV))) { my $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; print "${var}=\"${val}\"\n"; }
This one does more (loads modules) so it should be slower , dumpenv.psgi started with plackup -l 127.6.6.6:80 dumpenv.psgi 2>2 1>1
#!/usr/bin/perl -- use CGI(); use Data::Dump qw/ dd pp /; my $app = sub { #~ die "@_"; my $q = CGI->new( $_[0] ); return [ '200', [ 'Content-Type' => 'text/html', 'Content-Length' => '2', ], [ $q->start_html, $q->Dump, $q->end_html, ], ]; };
Then see whats faster
for ( 1 .. 10 ) { cmpthese( 1000, { 'psgi' => q{ # LWP::Simple::get('http://127.0.0.1:5000/'); LWP::Simple::get('http://127.6.6.6:80/'); qw//; }, 'apache2cgi' => q{ LWP::Simple::get('http://localhost/cgi-bin/printenv.pl'); qw//; }, } ); }
I tried it a bunch of times, and psgi is faster "half" the time (ok 4/10 or 3/10)
Rate apache2cgi psgi apache2cgi 194/s -- -23% psgi 252/s 30% -- Rate apache2cgi psgi apache2cgi 261/s -- -35% psgi 400/s 53% -- Rate psgi apache2cgi psgi 296/s -- -5% apache2cgi 311/s 5% -- Rate apache2cgi psgi apache2cgi 215/s -- -32% psgi 314/s 46% -- Rate psgi apache2cgi psgi 257/s -- -14% apache2cgi 300/s 17% -- Rate psgi apache2cgi psgi 261/s -- -19% apache2cgi 323/s 24% -- Rate psgi apache2cgi psgi 255/s -- -19% apache2cgi 315/s 24% -- Rate psgi apache2cgi psgi 275/s -- -14% apache2cgi 318/s 16% -- Rate apache2cgi psgi apache2cgi 201/s -- -34% psgi 302/s 50% -- Rate psgi apache2cgi psgi 275/s -- -17% apache2cgi 332/s 21% --
So is apache "cgi" or psgi faster?
My Apache is configured with ThreadsPerChild 4 -- not sure how many actual workers that is on my machine, but I see two apache processes ... one has 1 thread the other has 6, so 6 or 7 workers?
And psgi still wins 3/10 times? How does that make apache faster?
But yeah maybe the LWP is skewing the benchmark or .... something I dont understand
In reply to Re^11: appending to html at beginning (psgi kids)
by Anonymous Monk
in thread appending to html at beginning
by Limbomusic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |