mod_mmap_static.html revision 1997e02bed99bd0c081962ade257a0ea12ebe15b
0N/A<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2318N/A<HTML>
0N/A <HEAD>
0N/A <TITLE>Apache module mod_mmap_static</TITLE>
0N/A </HEAD>
0N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
0N/A <BODY
0N/A BGCOLOR="#FFFFFF"
0N/A TEXT="#000000"
0N/A LINK="#0000FF"
0N/A VLINK="#000080"
0N/A ALINK="#FF0000"
0N/A >
0N/A<!--#include virtual="header.html" -->
0N/A <H1 ALIGN="CENTER">Module mod_mmap_static</H1>
0N/A
0N/A <P>
0N/A This module provides mmap()ing of a statically configured list
1472N/A of frequently requested but not changed files.
1472N/A
1472N/A<P><A
0N/AHREF="module-dict.html#Status"
0N/AREL="Help"
0N/A><STRONG>Status:</STRONG></A> Experimental
0N/A<BR>
0N/A<A
0N/AHREF="module-dict.html#SourceFile"
0N/AREL="Help"
0N/A><STRONG>Source File:</STRONG></A> mod_mmap_static.c
0N/A<BR>
0N/A<A
0N/AHREF="module-dict.html#ModuleIdentifier"
0N/AREL="Help"
0N/A><STRONG>Module Identifier:</STRONG></A> mmap_static_module
0N/A</P>
0N/A
0N/A <H2>Summary</H2>
0N/A <P>
0N/A This is an <STRONG>experimental</STRONG> module and should be used with
0N/A care. You can easily create a broken site using this module, read this
0N/A document carefully.
0N/A <CODE>mod_mmap_static</CODE> maps a list of statically configured files (via
0N/A <CODE>MMapFile</CODE> directives in the main server configuration) into
0N/A memory through the system call <CODE>mmap()</CODE>. This system
0N/A call is available on most modern Unix derivates, but not on all. There
0N/A are sometimes system-specific limits on the size and number of files that
0N/A can be mmap()d, experimentation is probably the easiest way to find out.
0N/A </P>
0N/A <P>
0N/A This mmap()ing is done once at server start or restart, only. So whenever
0N/A one of the mapped files changes on the filesystem you <EM>have</EM> to
0N/A restart the server by at least sending it a HUP or USR1 signal (see the
0N/A <A HREF="/stopping.html">Stopping and Restarting</A> documentation). To
0N/A reiterate that point: if the files are modified <EM>in place</EM> without
0N/A restarting the server you may end up serving requests that are completely
0N/A bogus. You should update files by unlinking the old copy and putting a new
0N/A copy in place. Most tools such as <CODE>rdist</CODE> and <CODE>mv</CODE> do
0N/A this. The reason why this modules doesn't take care of changes to the files
0N/A is that this check would need an extra <CODE>stat()</CODE> every time which
0N/A is a waste and against the intent of I/O reduction.
0N/A </P>
0N/A
0N/A <H2>Directives</H2>
0N/A <UL>
0N/A <LI><A HREF="#mmapfile">MMapFile</A>
0N/A </LI>
0N/A </UL>
0N/A
0N/A <HR>
2318N/A
2318N/A <H2><A NAME="mmapfile">MMapFile</A> directive</H2>
0N/A <P>
0N/A <A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A ><STRONG>Syntax:</STRONG></A> MMapFile <EM>filename</em>
0N/A [<em>filename</em>] ...
0N/A <BR>
0N/A <A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A ><STRONG>Default:</STRONG></A> <EM>None</EM>
0N/A <BR>
0N/A <A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A ><STRONG>Context:</STRONG></A> server-config
0N/A <BR>
0N/A <A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A ><STRONG>Override:</STRONG></A> <EM>Not applicable</EM>
0N/A <BR>
0N/A <A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A ><STRONG>Status:</STRONG></A> Experimental
0N/A <BR>
0N/A <A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A ><STRONG>Module:</STRONG></A> mod_mmap_static
0N/A <BR>
0N/A <A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A ><STRONG>Compatibility:</STRONG></A> Only available in Apache 1.3 or later
0N/A
0N/A <P>
0N/A The <CODE>MMapFile</CODE> directive maps one or more files (given as
0N/A whitespace separated arguments) into memory at server startup time. They
0N/A are automatically unmapped on a server shutdown. When the files have changed
0N/A on the filesystem at least a HUP or USR1 signal should be send to the server
0N/A to re-mmap them.
0N/A </P>
0N/A
0N/A <P>
0N/A Be careful with the <EM>filename</EM> arguments: They have to literally
0N/A match the filesystem path Apache's URL-to-filename translation handlers
0N/A create. We cannot compare inodes or other stuff to match paths through
0N/A symbolic links <EM>etc.</EM> because that again would cost extra <CODE>stat()</CODE>
0N/A system calls which is not acceptable. This module may or may not work
0N/A with filenames rewritten by <CODE>mod_alias</CODE> or
0N/A <CODE>mod_rewrite</CODE>... it is an experiment after all.
0N/A </P>
0N/A
0N/A <P>
0N/A Notice: You cannot use this for speeding up CGI programs or other files
0N/A which are served by special content handlers. It can only be used for
0N/A regular files which are usually served by the Apache core content handler.
0N/A </P>
0N/A
0N/A Example:
0N/A
0N/A <PRE>
0N/A MMapFile /usr/local/apache/htdocs/index.html
0N/A </PRE>
0N/A
0N/A <P>
0N/A <STRONG>Note</STRONG>: don't bother asking for a for a <CODE>MMapDir</CODE>
0N/A directive which
0N/A recursively maps all the files in a directory. Use Unix the way it was
0N/A meant to be used. For example, see the
0N/A <A HREF="core.html#include">Include</A> directive, and consider this command:
0N/A <PRE>
0N/A find /www/htdocs -type f -print \
0N/A | sed -e 's/.*/mmapfile &amp;/' &gt; /www/conf/mmap.conf
0N/A </PRE>
0N/A
0N/A<!--#include virtual="footer.html" -->
0N/A </BODY>
0N/A</HTML>
0N/A