You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <sb...@stason.org> on 2000/06/07 21:45:44 UTC

[performance/benchmark] $|=1 doesn't matter ?!

Ok, you'd get surprised on this one. I cannot make benchmark show me
unbuffered output worse than buffered. Anyone can tell me why? there is
ap_flash call after each print in the unbuffered case, how comes the
results are the same?

name         | avtime completed failed    rps 
----------------------------------------------
buffering    |    324      5000      0    151 
unbuffering  |    325      5000      0    150 
----------------------------------------------

I've tried to print the average page size of about 64k to make as close as
possible to the real world test, but certainly using a way too many print
calls... still it doesn't change the results. I'm probably missing
something... can you see what it is?

The code:

package UnBuffered;
use Apache::Constants qw(:common);
local $|=1;
sub handler{
  my $r = shift;
  $r->send_http_header('text/plain');
  my $string = "a" x 128;
  for (1..512){
    print $string,"\n";
  }
  return OK;
}

1;

package Buffered;
use Apache::Constants qw(:common);
sub handler{
  my $r = shift;
  $r->send_http_header('text/plain');
  my $string = "a" x 128;
  for (1..512){
    print $string,"\n";
  }
  return OK;
}

1;


Thanks!


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://perl.org     http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org


Re: [performance/benchmark] $|=1 doesn't matter ?!

Posted by Stas Bekman <st...@stason.org>.
Matt Sergeant wrote:
> 
> On Wed, 7 Jun 2000, Stas Bekman wrote:
> 
> > Ok, you'd get surprised on this one. I cannot make benchmark show me
> > unbuffered output worse than buffered. Anyone can tell me why? there is
> > ap_flash call after each print in the unbuffered case, how comes the
> > results are the same?
> 
> I assume that's ap_flush ;-)

Right, hey Doug, how about implementing the real ap_flash :) wired to the
digital cam :)


> I'd guess this is probably OS dependant to do with socket libraries and
> such. But I'm just guessing. It's probably also to do with the size of the
> output.

Argh, but then I don't know what to do with this section... From one side
I claim that you shouldn't use $|=1, from the other side the benchmark
shows no difference (in the handler) can anyone prove it different? Using
a different OS maybe? I did mine on linux of course... Thanks a lot!
 
> I'm sorry I flamed the original benchmark, but now you've done some more
> real tests, I'm not sorry, if you see what I mean ;-)

Oh, no, Matt. I post these to learn the real world application and
truthfulness of my benchmarks. Otherwise what's the point of having a
great benchmarking results when in reallity the application is slow. So
critics are absolutely wonderful, even if they raise the heat. In
arguments the truth gets born... or not :) 


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide 
mailto:stas@stason.org   http://perl.org     http://stason.org/TULARC
http://singlesheaven.com http://perlmonth.com http://sourcegarden.org

Re: [performance/benchmark] $|=1 doesn't matter ?!

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wed, 7 Jun 2000, Stas Bekman wrote:

> Ok, you'd get surprised on this one. I cannot make benchmark show me
> unbuffered output worse than buffered. Anyone can tell me why? there is
> ap_flash call after each print in the unbuffered case, how comes the
> results are the same?

I assume that's ap_flush ;-)

I'd guess this is probably OS dependant to do with socket libraries and
such. But I'm just guessing. It's probably also to do with the size of the
output.

I'm sorry I flamed the original benchmark, but now you've done some more
real tests, I'm not sorry, if you see what I mean ;-)

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org