0N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0N/A <
TITLE>Apache module mod_mmap_static</
TITLE>
0N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) --> 0N/A <
H1 ALIGN="CENTER">Module mod_mmap_static</
H1>
0N/A This module provides mmap()ing of a statically configured list
1472N/A of frequently requested but not changed files.
0N/A><
STRONG>Status:</
STRONG></
A> Experimental
0N/A><
STRONG>Module Identifier:</
STRONG></
A> mmap_static_module
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 <
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 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 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 <
LI><
A HREF="#mmapfile">MMapFile</
A>
2318N/A <
H2><
A NAME="mmapfile">MMapFile</
A> directive</
H2>
0N/A ><
STRONG>Syntax:</
STRONG></
A> MMapFile <
EM>filename</
em>
0N/A [<
em>filename</
em>] ...
0N/A ><
STRONG>Default:</
STRONG></
A> <
EM>None</
EM>
0N/A ><
STRONG>Context:</
STRONG></
A> server-config
0N/A ><
STRONG>Override:</
STRONG></
A> <
EM>Not applicable</
EM>
0N/A ><
STRONG>Status:</
STRONG></
A> Experimental
0N/A ><
STRONG>Module:</
STRONG></
A> mod_mmap_static
0N/A ><
STRONG>Compatibility:</
STRONG></
A> Only available in Apache 1.3 or later
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 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 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 <
STRONG>Note</
STRONG>: don't bother asking for a for a <
CODE>MMapDir</
CODE>
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: