1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4<html xmlns="http://www.w3.org/1999/xhtml">
5  <head>
6    <meta name="generator" content="HTML Tidy, see www.w3.org" />
7
8    <title>Hints on Running a High-Performance Web Server</title>
9  </head>
10  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
11
12  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
13  vlink="#000080" alink="#FF0000">
14        <div align="CENTER">
15      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" />
16
17      <h3>Apache HTTP Server Version 1.3</h3>
18    </div>
19
20
21    <h1 align="CENTER">Hints on Running a High-Performance Web
22    Server</h1>
23    Running Apache on a heavily loaded web server, one often
24    encounters problems related to the machine and OS
25    configuration. "Heavy" is relative, of course - but if you are
26    seeing more than a couple hits per second on a sustained basis
27    you should consult the pointers on this page. In general the
28    suggestions involve how to tune your kernel for the heavier TCP
29    load, hardware/software conflicts that arise, <em>etc.</em>
30
31    <ul>
32      <li><a href="#AUX">A/UX (Apple's UNIX)</a></li>
33
34      <li><a href="#BSD">BSD-based (BSDI, FreeBSD, etc)</a></li>
35
36      <li><a href="#DEC">Digital UNIX</a></li>
37
38      <li><a href="perf-hp.html">HPUX</a></li>
39
40      <li><a href="#irix">IRIX</a></li>
41
42      <li><a href="#Linux">Linux</a></li>
43
44      <li><a href="#Solaris">Solaris</a></li>
45
46      <li><a href="#SunOS">SunOS 4.x</a></li>
47
48      <li><a href="#SVR4">SVR4</a></li>
49    </ul>
50    <hr />
51
52    <h3><a id="AUX" name="AUX">A/UX (Apple's UNIX)</a></h3>
53    If you are running Apache on A/UX, a page that gives some
54    helpful performance hints (concerning the <em>listen()</em>
55    queue and using virtual hosts) <a
56    href="http://www.jaguNET.com/apache.html">can be found here</a>
57
58    <hr />
59
60    <h3><a id="BSD" name="BSD">BSD-based (BSDI, FreeBSD,
61    etc)</a></h3>
62    <a href="perf-bsd44.html#initial">Quick</a> and <a
63    href="perf-bsd44.html#detail">detailed</a> performance tuning
64    hints for BSD-derived systems. <a
65    href="perf-bsd44.html#accf">Accept filtering</a> on FreeBSD.
66    <hr />
67
68    <h3><a id="DEC" name="DEC">Digital UNIX</a></h3>
69
70    <ul>
71      <li><a
72      href="http://www.sean.de/Solaris/tune.html">
73      Solaris 2.x - tuning your TCP/IP stack</a> contains some good
74      technical information about tuning various Solaris TCP/IP
75      parameters.</li>
76    </ul>
77    <hr />
78
79    <h3><a id="SunOS" name="SunOS">SunOS 4.x</a></h3>
80    More information on tuning SOMAXCONN on SunOS can be found at
81    <a
82    href="http://www.islandnet.com/~mark/somaxconn.html">http://www.islandnet.com/~mark/somaxconn.html</a>.
83
84    <hr />
85
86    <h3><a id="SVR4" name="SVR4">SVR4</a></h3>
87    Some SVR4 versions waste three system calls on every
88    <samp>gettimeofday()</samp> call. Depending on the syntactic
89    form of the <samp>TZ</samp> environment variable, these systems
90    have several different algorithms to determine the local time
91    zone (presumably <em>compatible</em> with something). The
92    following example uses the central european time zone to
93    demonstrate this:
94
95    <dl>
96      <dt><strong>TZ=:MET</strong></dt>
97
98      <dd>
99        This form delegates the knowledge of the time zone
100        information to an external compiled zoneinfo file (&agrave;
101        la BSD).<br />
102         <strong>Caveat:</strong> Each time the gettimeofday()
103        function is called, the external zone info is read in again
104        (at least on some SVR4 systems). That results in three
105        wasted system calls with every apache request served.
106<pre>
107     open("/usr/lib/locale/TZ/MET", O_RDONLY) = 3
108     read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 7944) = 778
109     close(3)                                = 0
110</pre>
111      </dd>
112
113      <dt>
114      <strong>TZ=MET-1MDT,M3.5.0/02:00:00,M10.5.0/03:00:00</strong></dt>
115
116      <dd>This syntax form (&agrave; la SYSV) contains all the
117      knowledge about time zone beginning and ending times in its
118      external representation. It has to be parsed each time it is
119      evaluated, resulting in a slight computing overhead, but it
120      requires no system call. Though the table lookup &agrave; la
121      BSD is the more sophisticated technical solution, the bad
122      SVR4 implementation makes this the preferred syntax on
123      systems which otherwise access the external zone info file
124      repeatedly.</dd>
125    </dl>
126    You should use the <samp>truss</samp> utility on a
127    single-process apache server (started with the <samp>-X</samp>
128    debugging switch) to determine whether your system can profit
129    from the second form of the <samp>TZ</samp> environment
130    variable. If it does, you could integrate the setting of the
131    preferred <samp>TZ</samp> syntax into the httpd startup script,
132    which is usually simply a copy of (or symbolic link to) the
133    <samp>apachectl</samp> utility script, or into the system's
134    <samp>/etc/TIMEZONE</samp> script.
135    <hr />
136
137    <h3>More welcome!</h3>
138    If you have tips to contribute, please submit them to
139    the <a href="http://bugs.apache.org/">Apache Bug
140    Database</a>.
141
142        <hr />
143
144    <h3 align="CENTER">Apache HTTP Server Version 1.3</h3>
145    <a href="./"><img src="../images/index.gif" alt="Index" /></a>
146    <a href="../"><img src="../images/home.gif" alt="Home" /></a>
147
148  </body>
149</html>
150
151