summaryrefslogtreecommitdiff
path: root/htdocs/manual/mod/mod_mmap_static.html
blob: 247bae246eb8975be9767ab6cbd1b6d4f6706190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />

    <title>Apache module mod_mmap_static</title>
<style>
.obsolete
{
  margin: 0;
  padding: 8px 10px;
  padding-left: 50px;
  padding-bottom: 10px;
  line-height: 1.4em;
  background: #f99 url(../images/warning.png) no-repeat 0px 0px;
}

.currentdocs
{
    background: #f99;
}

</style>

  </head>
  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->

  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
  vlink="#000080" alink="#FF0000">
    <div align="CENTER">
      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" />

      <h3>Apache HTTP Server Version 1.3</h3>
        <div class="obsolete"><p>You are looking at the documentation for the 
        1.3 version of the Apache HTTP Server, which is no longer
        maintained, and has been declared "end of life". If you are in
        fact still using the 1.3 version, please consider upgrading.
        The current version of the server is <a 
        href="http://httpd.apache.org/docs/2.4/">2.4</a>.

        In the current version of the server, there is no equivalent to this module.</p> 

        </div>

    </div>

    <h1 align="CENTER">Module mod_mmap_static</h1>

    <p>This module provides mmap()ing of a statically configured
    list of frequently requested but not changed files.</p>

    <p><a href="module-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Experimental<br />
     <a href="module-dict.html#SourceFile"
    rel="Help"><strong>Source File:</strong></a>
    mod_mmap_static.c<br />
     <a href="module-dict.html#ModuleIdentifier"
    rel="Help"><strong>Module Identifier:</strong></a>
    mmap_static_module<br />
     <a href="module-dict.html#Compatibility"
    rel="Help"><strong>Compatibility:</strong></a> Available in
    Apache 1.3 and later.</p>

    <h2>Summary</h2>

    <p>This is an <strong>experimental</strong> module and should
    be used with care. You can easily create a broken site using
    this module, read this document carefully.
    <code>mod_mmap_static</code> maps a list of statically
    configured files (via <code>MMapFile</code> directives in the
    main server configuration) into memory through the system call
    <code>mmap()</code>. This system call is available on most
    modern Unix derivates, but not on all. There are sometimes
    system-specific limits on the size and number of files that can
    be mmap()d, experimentation is probably the easiest way to find
    out.</p>

    <p>This mmap()ing is done once at server start or restart,
    only. So whenever one of the mapped files changes on the
    filesystem you <em>have</em> to restart the server by at least
    sending it a HUP or USR1 signal (see the <a
    href="../stopping.html">Stopping and Restarting</a>
    documentation). To reiterate that point: if the files are
    modified <em>in place</em> without restarting the server you
    may end up serving requests that are completely bogus. You
    should update files by unlinking the old copy and putting a new
    copy in place. Most tools such as <code>rdist</code> and
    <code>mv</code> do this. The reason why this modules doesn't
    take care of changes to the files is that this check would need
    an extra <code>stat()</code> every time which is a waste and
    against the intent of I/O reduction.</p>

    <h2>Directives</h2>

    <ul>
      <li><a href="#mmapfile">MMapFile</a></li>
    </ul>
    <hr />

    <h2><a id="mmapfile" name="mmapfile">MMapFile</a>
    directive</h2>

    <p><a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> MMapFile
    <em>filename</em> [<em>filename</em>] ...<br />
     <a href="directive-dict.html#Default"
    rel="Help"><strong>Default:</strong></a> <em>None</em><br />
     <a href="directive-dict.html#Context"
    rel="Help"><strong>Context:</strong></a> server-config<br />
     <a href="directive-dict.html#Override"
    rel="Help"><strong>Override:</strong></a> <em>Not
    applicable</em><br />
     <a href="directive-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Experimental<br />
     <a href="directive-dict.html#Module"
    rel="Help"><strong>Module:</strong></a> mod_mmap_static<br />
     <a href="directive-dict.html#Compatibility"
    rel="Help"><strong>Compatibility:</strong></a> Only available
    in Apache 1.3 or later</p>

    <p>The <code>MMapFile</code> directive maps one or more files
    (given as whitespace separated arguments) into memory at server
    startup time. They are automatically unmapped on a server
    shutdown. When the files have changed on the filesystem at
    least a HUP or USR1 signal should be send to the server to
    re-mmap them.</p>

    <p>Be careful with the <em>filename</em> arguments: They have
    to literally match the filesystem path Apache's URL-to-filename
    translation handlers create. We cannot compare inodes or other
    stuff to match paths through symbolic links <em>etc.</em>
    because that again would cost extra <code>stat()</code> system
    calls which is not acceptable. This module may or may not work
    with filenames rewritten by <code>mod_alias</code> or
    <code>mod_rewrite</code>... it is an experiment after all.</p>

    <p>Notice: You cannot use this for speeding up CGI programs or
    other files which are served by special content handlers. It
    can only be used for regular files which are usually served by
    the Apache core content handler.</p>
    Example: 
<pre>
  MMapFile /usr/local/apache/htdocs/index.html
 
</pre>

    <p><strong>Note</strong>: don't bother asking for a for a
    <code>MMapDir</code> directive which recursively maps all the
    files in a directory. Use Unix the way it was meant to be used.
    For example, see the <a href="core.html#include">Include</a>
    directive, and consider this command:</p>
<pre>
  find /www/htdocs -type f -print \
  | sed -e 's/.*/mmapfile &amp;/' &gt; /www/conf/mmap.conf
 
</pre>
    <!--#include virtual="footer.html" -->
  </body>
</html>