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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.