CLASS="section" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

29.22. Optimizing Apache

The mod_mmap_static module of Apache, is a special module with the Apache distribution named mod_mmap_static that can be used to improve the performance of your Web Server. This module works by providing mappings of a statically configured list of frequently requested, but not changed, files in your RootDirectory. So, if files displayed by Apache don't change often, you can use this module to memory-map the static documents and increase the speed of your Apache web server.

It's important to note that the mod_mmap_static module of Apache must be enabled during the configuration and compilation time of Apache before you can use it. If you have followed our steps described in the configuration and compilation time section above, this is already in Apache --add-module-../mod_mmap_static.c.

  1. To memory-map static documents, use the following command:
    
          [root@deep ]/# find /home/httpd/ona -type f -print | sed -e 's/.*/mmapfile &/' /etc/httpd/conf/mmap.conf
            
    The /home/httpd/ona is the RootDirectory, or to be more precise, the directory out of which you will serve your documents, and the /etc/httpd/conf/mmap.conf is the location where we want to create this file, mmap.conf, that contains a static memory-map of all documents under our RootDirectory.

  2. Once the mmap.conf file has been created under the location where we have chosen to keep this file, we must include it in the httpd.conf file of Apache to be able to use its features on our web server. Edit the httpd.conf file, vi /etc/httpd/conf/httpd.conf and add the line:
    
          <IfModule mod_include.c>
              Include conf/mmap.conf
              </IfModule>
            

Proxy Netscape Configuration: See your Apache documentation for more information about the use of mod_mmap_static. Remember that this feature must be only used when you serve documents that don't change often on your web site.

You must restart the Apache web server for the changes to take effect:

          [root@deep ]/# /etc/rc.d/init.d/httpd restart
        

          Shutting down http:                                        	[  OK  ]
          Starting httpd:                                            	[  OK  ]
        

The atime and noatime attributes:

Tip

The atime and noatime attributes of Linux can be used to get measurable performance gains in Apache. See in this book, General System Optimization, for more information on the subject.