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

1173[mp2] Making Apache::ASP optimized for mod_perl 2

Expand Messages
  • Josh Chamas
    May 5, 2003
    • 0 Attachment
      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) {
      $self->{r}->pool->cleanup_register(@_);
      } else {
      $self->{r}->register_cleanup(@_);
      }

      - and -

      unless($Apache::ASP::ModPerl2) {
      # don't need this for mod_perl2 it seems from Apache::compat
      $r->send_http_header();
      }

      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.

      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.

      Here are some benchmark numbers for comparison:


      ========== APACHE 1.x / mod_perl 1.x
      Test Name Test File Hits/sec # of Hits Time(sec) secs/Hit Bytes/Hit Mem(KB)
      --------- --------- --------- --------- --------- --------- --------- ---------
      Apache::ASP v2.55 mod_perl 2000 h2000.asp 389.7 1952 5.01 0.002566 29025 29932
      Apache::ASP v2.55 mod_perl Hello hello.asp 495.8 2480 5.00 0.002017 258 27384

      Apache Server Header Tokens
      ---------------------------
      Apache/1.3.27
      OpenSSL/0.9.6g
      PHP/4.3.0
      mod_fastcgi/2.2.12
      mod_perl/1.27
      mod_ssl/2.8.12


      ========== APACHE 2.x / mod_perl 1.99 ( normal prefork mpm )
      Test Name Test File Hits/sec # of Hits Time(sec) secs/Hit Bytes/Hit Mem(KB)
      --------- --------- --------- --------- --------- --------- --------- ---------
      Apache::ASP v2.55 mod_perl 2000 h2000.asp 258.2 1351 5.23 0.003873 29051 42572
      Apache::ASP v2.55 mod_perl Hello hello.asp 334.6 1710 5.11 0.002988 284 36116

      Apache Server Header Tokens
      ---------------------------
      Apache/2.0.40
      OpenSSL/0.9.6g
      PHP/4.2.3
      Perl/v5.8.0
      Python/2.2.1
      mod_perl/1.99_09
      mod_python/3.0.1
      mod_ssl/2.0.40

      Regards,

      Josh
      ________________________________________________________________
      Josh Chamas, Founder phone:925-552-0128
      Chamas Enterprises Inc. http://www.chamas.com
      NodeWorks Link Checking http://www.nodeworks.com


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