Loading ...
Sorry, an error occurred while loading the content.

1174Re: [mp2] Making Apache::ASP optimized for mod_perl 2

Expand Messages
  • Stas Bekman
    May 6, 2003
      Josh Chamas wrote:
      > Hey,
      > I just wanted to share my experience with making Apache::ASP
      > not use Apache::compat to run under mod_perl 2 ( 1.99_09 actually ).
      > Keeping Apache::ASP running under mod_perl 1 is important, so part
      > of the effort was to minimize code impact on ASP, while using the
      > correct APIs under mp2. I expect this work to be available for the
      > Apache::ASP 2.55 release, but this is still in development.
      > What I found was that the only APIs that I needed to trigger off of
      > a MP2 type constant was register_cleanup and send_http_header.
      > Following the example of Apache::compat, I basically did these things:
      > if($ModPerl2) {

      Another minor optimization would be to use:

      use constant MODPERL2 => ...; instead of $ModPerl2

      this will save a few if() run-time checks.

      > Besides not using Apache::compat, I tried also to not
      > &ModPerl::MethodLookup::preload_all_modules();
      > but ended up leaving it in because Apache::ASP uses so much of the
      > Apache API, via these necessary modules...
      > Apache::RequestRec
      > Apache::RequestUtil
      > Apache::RequestIO
      > Apache::Response
      > APR::Table
      > APR::Pool
      > Apache::Connection
      > Apache::Server
      > Apache::Log
      > that the savings in memory did not warrant explicitly listing just these
      > modules for loading. The savings was between 500K-2M post benchmark run
      > by explicitly loading, and I don't want to run the risk that I missed
      > some obscure Apache API code reference that comes up only rarely at
      > runtime,
      > so I'll load in all the modules for now.

      Bad programmer, no cookie ;)

      Seriously, please do not do that. Currently there are 38 Classes and more will
      be added. You hardly need 10 or so classes. and if users want some
      functionality in their code, they should be responsible for loading it. Now if
      I use Apache::ASP you force the loading of all modules on me, even if I don't
      want them and Apache::ASP doesn't use even half of them. This is the same
      problem as with Apache::compat. These tools are there to easy the porting, but
      not for use by CPAN modules. It'll also have side effects on your users, since
      once they load Apache::ASP they won't have a need to load modules anymore,
      since everything will be loaded. Once they move their code elsewhere without
      Apache::ASP, their code will suddenly won't work anymore.

      > I also managed to get Apache::ASP working under modperl handler config
      > for an extra 5-10% performance speedup.
      > At the end of all this, I am finding that despite my best efforts,
      > Apache::ASP
      > runs some 30-40% slower under Apache2/mp2 than Apache1/mp1. Though both
      > perls
      > are perl 5.8, a big difference is that for mp2 the perl has usethreads
      > defined,
      > but the perl 5.8 for mp1 does not. Maybe the thread layer has to do
      > with the
      > slower performance? I believe that having the thread layer on for eventual
      > use of the Apache 2 worker mpm is essential, so this is why I compiled perl
      > that way for benchmarking.

      Yes, perl-5.8.0 w/ ithreads and w/o them have quite a big performance
      differences as it was pointed out several times on the p5p list. I think you
      should benchmark perl-5.8.0 w/o threads against mp1 and mp1/prefork to make
      the benchmark fair.

      Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
      http://stason.org/ mod_perl Guide ---> http://perl.apache.org
      mailto:stas@... http://use.perl.org http://apacheweek.com
      http://modperlbook.org http://apache.org http://ticketmaster.com

      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Show all 2 messages in this topic