home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Practical mod_perlPractical mod_perlSearch this book

Chapter 15. Improving Performance Through Build Options

It's important how you build mod_perl-enabled Apache. The build process influences the size of the httpd executable—for example, some irrelevant modules might slow down performance.

When you build Apache, it strips the debug symbols by default, so you don't have to strip them yourself. For production use, you definitely shouldn't build mod_perl with debugging options enabled. Apache and mod_perl do not add these options unless you explicitly require them. In Chapter 21 we talk about debug build options in detail.

15.1. Server Size as a Function of Compiled-in Features

You might wonder if it's better to compile in only the required modules and mod_perl hooks, or if it doesn't really matter. To answer this question, let's first make a few compilations and compare the results.

We'll build mod_perl starting with:

panic% perl Makefile.PL APACHE_SRC=../apache_1.3.x/src \
       DO_HTTPD=1 USE_APACI=1

and followed by one of these option groups, in turn:

  • Default (no arguments)

  • Minimum:

    APACI_ARGS='--disable-module=env, \
                --disable-module=negotiation, \
                --disable-module=status, \
                --disable-module=info, \
                --disable-module=include, \
                --disable-module=autoindex, \
                --disable-module=dir, \
                --disable-module=cgi, \
                --disable-module=asis, \
                --disable-module=imap, \
                --disable-module=userdir, \
                --disable-module=access, \
                --disable-module=auth'
  • mod_perl's EVERYTHING:

    EVERYTHING=1
  • mod_perl's EVERYTHING and debug:

    EVERYTHING=1 PERL_DEBUG=1

After recompiling with the arguments of each of these groups in turn, we can summarize the results as follows:

Build group    httpd size (bytes)  Difference
---------------------------------------------
Minimum              892928         +     0
Default              994316         +101388
Everything          1044432         +151504
Everything+Debug    1162100         +269172

Clearly when you strip most of the defaults, the server size is slimmer. But the savings become insignificant, because you don't multiply the added size by the number of child processes if your OS supports memory sharing. The parent process is a little bigger, but it shares these memory pages with its child processes. Of course, not all the memory will be shared, but most of it will.

This is just an example to show the maximum possible difference in size. You can't actually strip everything away, because there will be Apache modules and mod_perl options that you won't be able to work without. But as a good system administrator's rule says: "Run the absolute minimum of the applications. If you don't know or need something, disable it." Following this rule to decide on the required Apache components and disabling the unneeded default components makes you a better Apache administrator.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.