summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mpm_common.xml
blob: cc53c1b1abdf41ec8dc75dc1ffa89f17494fdbb5 (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<!-- $LastChangedRevision$ -->

<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You under the Apache License, Version 2.0
 (the "License"); you may not use this file except in compliance with
 the License.  You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

<modulesynopsis metafile="mpm_common.xml.meta">

<name>mpm_common</name>
<description>A collection of directives that are implemented by
more than one multi-processing module (MPM)</description>
<status>MPM</status>

<directivesynopsis>
<name>AcceptMutex</name>
<description>Method that Apache uses to serialize multiple children
accepting requests on network sockets</description>
<syntax>AcceptMutex Default|<var>method</var></syntax>
<default>AcceptMutex Default</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>The <directive>AcceptMutex</directive> directives sets the
    method that Apache uses to serialize multiple children accepting
    requests on network sockets. Prior to Apache 2.0, the method was
    selectable only at compile time. The optimal method to use is
    highly architecture and platform dependent. For further details,
    see the <a href="../misc/perf-tuning.html">performance tuning</a>
    documentation.</p>

    <p>If this directive is set to <code>Default</code>, then the
    compile-time selected default will be used. Other possible
    methods are listed below. Note that not all methods are
    available on all platforms. If a method is specified which is
    not available, a message will be written to the error log
    listing the available methods.</p>

    <dl>
      <dt><code>flock</code></dt>
      <dd>uses the <code>flock(2)</code> system call to lock the
      file defined by the <directive module="mpm_common"
      >LockFile</directive> directive.</dd>

      <dt><code>fcntl</code></dt>
      <dd>uses the <code>fcntl(2)</code> system call to lock the
      file defined by the <directive module="mpm_common"
      >LockFile</directive> directive.</dd>

      <dt><code>posixsem</code></dt>
      <dd>uses POSIX compatible semaphores to implement the mutex.</dd>

      <dt><code>pthread</code></dt>
      <dd>uses POSIX mutexes as implemented by the POSIX Threads
      (PThreads) specification.</dd>

      <dt><code>sysvsem</code></dt>
      <dd>uses SySV-style semaphores to implement the mutex.</dd>
    </dl>

    <p>If you want to find out the compile time chosen default
    for your system, you may set your <directive module="core"
    >LogLevel</directive> to <code>debug</code>. Then the default <directive
    >AcceptMutex</directive> will be written into the <directive
    module="core">ErrorLog</directive>.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>BS2000Account</name>
<description>Define the non-privileged account on BS2000
machines</description>
<syntax>BS2000Account <var>account</var></syntax>
<contextlist><context>server config</context></contextlist>
<modulelist><module>perchild</module><module>prefork</module></modulelist>
<compatibility>Only available for BS2000 machines</compatibility>

<usage>
    <p>The <directive>BS2000Account</directive> directive is available for
    BS2000 hosts only. It must be used to define the account number for
    the non-privileged apache server user (which was configured using the
    <directive module="mpm_common">User</directive> directive). This is
    required by the BS2000 POSIX subsystem (to change the underlying BS2000
    task environment by performing a sub-LOGON) to prevent CGI scripts
    from accessing resources of the privileged account which started the
    server, usually <code>SYSROOT</code>.</p>

    <note><title>Note</title>
      <p>Only one <code>BS2000Account</code> directive can be used.</p>
    </note>
</usage>
<seealso><a href="../platform/ebcdic.html">Apache EBCDIC port</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>CoreDumpDirectory</name>
<description>Directory where Apache attempts to
switch before dumping core</description>
<syntax>CoreDumpDirectory <var>directory</var></syntax>
<default>See usage for the default setting</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_winnt</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>This controls the directory to which Apache attempts to
    switch before dumping core. The default is in the
    <directive module="core">ServerRoot</directive> directory, however
    since this should not be writable by the user the server runs
    as, core dumps won't normally get written. If you want a core
    dump for debugging, you can use this directive to place it in a
    different location.</p>

    <note><title>Core Dumps on Linux</title>
      <p>If Apache starts as root and switches to another user, the
      Linux kernel <em>disables</em> core dumps even if the directory is
      writable for the process. Apache (2.0.46 and later) reenables core dumps
      on Linux 2.4 and beyond, but only if you explicitly configure a <directive
      >CoreDumpDirectory</directive>.</p>
    </note>

    <note><title>Core Dumps on BSD</title>
    <p>To enable core-dumping of suid-executables on BSD-systems (such
    as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
    </p></note>

</usage>
</directivesynopsis>

<directivesynopsis>
<name>EnableExceptionHook</name>
<description>Enables a hook that runs exception handlers
after a crash</description>
<syntax>EnableExceptionHook On|Off</syntax>
<default>EnableExceptionHook Off</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module>
<module>worker</module></modulelist>
<compatibility>Available in version 2.0.49 and later</compatibility>

<usage>
    <p>For safety reasons this directive is only available if the server was
    configured with the <code>--enable-exception-hook</code> option. It
    enables a hook that allows external modules to plug in and do something
    after a child crashed.</p>
    
    <p>There are already two modules, <code>mod_whatkilledus</code> and
    <code>mod_backtrace</code> that make use of this hook. Please have a
    look at Jeff Trawick's <a
    href="http://www.apache.org/~trawick/exception_hook.html"
    >EnableExceptionHook site</a> for more information about these.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>Group</name>
<description>Group under which the server will answer
requests</description>
<syntax>Group <var>unix-group</var></syntax>
<default>Group #-1</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>
<compatibility>Only valid in global server config since Apache
2.0</compatibility>

<usage>
    <p>The <directive>Group</directive> directive sets the group under
    which the server will answer requests. In order to use this
    directive, the server must be run initially as <code>root</code>. If
    you start the server as a non-root user, it will fail to change to the
    specified group, and will instead continue to run as the group of the
    original user. <var>Unix-group</var> is one of:</p>

    <dl>
      <dt>A group name</dt>
      <dd>Refers to the given group by name.</dd>

      <dt><code>#</code> followed by a group number.</dt>
      <dd>Refers to a group by its number.</dd>
    </dl>

    <example><title>Example</title>
      Group www-group
    </example>

    <p>It is recommended that you set up a new group specifically for
    running the server. Some admins use user <code>nobody</code>,
    but this is not always possible or desirable.</p>

    <note type="warning"><title>Security</title>
      <p>Don't set <directive>Group</directive> (or <directive
      module="mpm_common">User</directive>) to <code>root</code> unless
      you know exactly what you are doing, and what the dangers are.</p>
    </note>

    <p>Special note: Use of this directive in <directive module="core"
    type="section">VirtualHost</directive> is no longer supported. To
    configure your server for <program>suexec</program> use
    <directive module="mod_suexec">SuexecUserGroup</directive>.</p>

    <note><title>Note</title>
      <p>Although the <directive>Group</directive> directive is present
      in the <module>beos</module> and <module>mpmt_os2</module> MPMs,
      it is actually a no-op there and only exists for compatibility
      reasons.</p>
    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>PidFile</name>
<description>File where the server records the process ID
of the daemon</description>
<syntax>PidFile <var>filename</var></syntax>
<default>PidFile logs/httpd.pid</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_winnt</module><module>mpmt_os2</module>
<module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>The <directive>PidFile</directive> directive sets the file to
    which the server records the process id of the daemon. If the
    filename is not absolute then it is assumed to be relative to the
    <directive module="core">ServerRoot</directive>.</p>

    <example><title>Example</title>
      PidFile /var/run/apache.pid
    </example>

    <p>It is often useful to be able to send the server a signal,
    so that it closes and then re-opens its <directive
    module="core">ErrorLog</directive> and <directive
    module="mod_log_config">TransferLog</directive>, and
    re-reads its configuration files. This is done by sending a
    SIGHUP (kill -1) signal to the process id listed in the
    <directive>PidFile</directive>.</p>

    <p>The <directive>PidFile</directive> is subject to the same
    warnings about log file placement and <a
    href="../misc/security_tips.html#serverroot">security</a>.</p>

    <note><title>Note</title>
      <p>As of Apache 2 it is recommended to use only the <program>
      apachectl</program> script for (re-)starting or stopping the server.</p>
    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>Listen</name>
<description>IP addresses and ports that the server
listens to</description>
<syntax>Listen [<var>IP-address</var>:]<var>portnumber</var></syntax>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<compatibility>Required directive since Apache 2.0</compatibility>

<usage>
    <p>The <directive>Listen</directive> directive instructs Apache to
    listen to only specific IP addresses or ports; by default it
    responds to requests on all IP interfaces. <directive>Listen</directive>
    is now a required directive. If it is not in the config file, the
    server will fail to start. This is a change from previous versions
    of Apache.</p>

    <p>The <directive>Listen</directive> directive tells the server to
    accept incoming requests on the specified port or address-and-port
    combination. If only a port number is specified, the server listens to
    the given port on all interfaces. If an IP address is given as well
    as a port, the server will listen on the given port and
    interface.</p>

    <p>Multiple <directive>Listen</directive> directives may be used to
    specify a number of addresses and ports to listen to. The server will
    respond to requests from any of the listed addresses and ports.</p>

    <p>For example, to make the server accept connections on both
    port 80 and port 8000, use:</p>

    <example>
      Listen 80<br />
      Listen 8000
    </example>

    <p>To make the server accept connections on two specified
    interfaces and port numbers, use </p>

    <example>
      Listen 192.170.2.1:80<br />
      Listen 192.170.2.5:8000
    </example>

    <p>IPv6 addresses must be surrounded in square brackets, as in the
    following example:</p>

    <example>
      Listen [2001:db8::a00:20ff:fea7:ccea]:80
    </example>

    <note><title>Error condition</title>
      Multiple <directive>Listen</directive> directives for the same ip
      address and port will result in an <code>Address already in use</code>
      error message.
    </note>
</usage>
<seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
<seealso><a href="../bind.html">Setting which addresses and ports Apache
    uses</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>ListenBackLog</name>
<description>Maximum length of the queue of pending connections</description>
<syntax>ListenBacklog <var>backlog</var></syntax>
<default>ListenBacklog 511</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>The maximum length of the queue of pending connections.
    Generally no tuning is needed or desired, however on some
    systems it is desirable to increase this when under a TCP SYN
    flood attack. See the backlog parameter to the
    <code>listen(2)</code> system call.</p>

    <p>This will often be limited to a smaller number by the
    operating system. This varies from OS to OS. Also note that
    many OSes do not use exactly what is specified as the backlog,
    but use a number based on (but normally larger than) what is
    set.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>LockFile</name>
<description>Location of the accept serialization lock file</description>
<syntax>LockFile <var>filename</var></syntax>
<default>LockFile logs/accept.lock</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>The <directive>LockFile</directive> directive sets the path to
    the lockfile used when Apache is used with an <directive
    module="mpm_common">AcceptMutex</directive> value of either
    <code>fcntl</code> or <code>flock</code>. This directive should
    normally be left at its default value. The main reason for changing
    it is if the <code>logs</code> directory is NFS mounted, since
    <strong>the lockfile must be stored on a local disk</strong>. The PID
    of the main server process is automatically appended to the
    filename.</p>

    <note type="warning"><title>Security</title>
      <p>It is best to <em>avoid</em> putting this file in a world writable
      directory such as <code>/var/tmp</code> because someone could create
      a denial of service attack and prevent the server from starting by
      creating a lockfile with the same name as the one the server will try
      to create.</p>
    </note>
</usage>
<seealso><directive module="mpm_common">AcceptMutex</directive></seealso>
</directivesynopsis>

<directivesynopsis>
<name>MaxClients</name>
<description>Maximum number of connections that will be processed
simultaneously</description>
<syntax>MaxClients <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>The <directive>MaxClients</directive> directive sets the limit
    on the number of simultaneous requests that will be served.  Any
    connection attempts over the <directive>MaxClients</directive>
    limit will normally be queued, up to a number based on the
    <directive module="mpm_common">ListenBacklog</directive>
    directive. Once a child process is freed at the end of a different
    request, the connection will then be serviced.</p>

    <p>For non-threaded servers (<em>i.e.</em>, <module>prefork</module>),
    <directive>MaxClients</directive> translates into the maximum
    number of child processes that will be launched to serve requests.
    The default value is <code>256</code>; to increase it, you must also raise
    <directive module="mpm_common">ServerLimit</directive>.</p>

    <p>For threaded and hybrid servers (<em>e.g.</em> <module>beos</module>
    or <module>worker</module>) <directive>MaxClients</directive> restricts
    the total number of threads that will be available to serve clients.
    The default value for <module>beos</module> is <code>50</code>. For
    hybrid MPMs the default value is <code>16</code> (<directive
    module="mpm_common">ServerLimit</directive>) multiplied by the value of
    <code>25</code> (<directive module="mpm_common"
    >ThreadsPerChild</directive>). Therefore, to increase <directive
    >MaxClients</directive> to a value that requires more than 16 processes,
    you must also raise <directive module="mpm_common"
    >ServerLimit</directive>.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxMemFree</name>
<description>Maximum amount of memory that the main allocator is allowed
to hold without calling <code>free()</code></description>
<syntax>MaxMemFree <var>KBytes</var></syntax>
<default>MaxMemFree 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>prefork</module>
<module>threadpool</module><module>worker</module><module>mpm_winnt</module></modulelist>

<usage>
    <p>The <directive>MaxMemFree</directive> directive sets the
    maximum number of free Kbytes that the main allocator is allowed
    to hold without calling <code>free()</code>. When not set, or when set
    to zero, the threshold will be set to unlimited.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxRequestsPerChild</name>
<description>Limit on the number of requests that an individual child server
will handle during its life</description>
<syntax>MaxRequestsPerChild <var>number</var></syntax>
<default>MaxRequestsPerChild 10000</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_netware</module>
<module>mpm_winnt</module><module>mpmt_os2</module>
<module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>The <directive>MaxRequestsPerChild</directive> directive sets
    the limit on the number of requests that an individual child
    server process will handle. After
    <directive>MaxRequestsPerChild</directive> requests, the child
    process will die. If <directive>MaxRequestsPerChild</directive> is
    <code>0</code>, then the process will never expire.</p>

    <note><title>Different default values</title>
      <p>The default value for <module>mpm_netware</module> and
      <module>mpm_winnt</module> is <code>0</code>.</p>
    </note>

    <p>Setting <directive>MaxRequestsPerChild</directive> to a
    non-zero value limits the amount of memory that process can consume
    by (accidental) memory leakage.</p>

    <note><title>Note</title>
      <p>For <directive module="core">KeepAlive</directive> requests, only
      the first request is counted towards this limit. In effect, it
      changes the behavior to limit the number of <em>connections</em> per
      child.</p>
    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>MaxSpareThreads</name>
<description>Maximum number of idle threads</description>
<syntax>MaxSpareThreads <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpmt_os2</module>
<module>perchild</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>Maximum number of idle threads. Different MPMs deal with this
    directive differently.</p>

    <p>For <module>perchild</module> the default is
    <code>MaxSpareThreads 10</code>. This MPM monitors the number of
    idle threads on a per-child basis. If there are too many idle
    threads in that child, the server will begin to kill threads
    within that child.</p>

    <p>For <module>worker</module>, <module>leader</module> and <module
    >threadpool</module> the default is <code>MaxSpareThreads 250</code>.
    These MPMs deal with idle threads on a server-wide basis. If there
    are too many idle threads in the server then child processes are
    killed until the number of idle threads is less than this number.</p>

    <p>For <module>mpm_netware</module> the default is
    <code>MaxSpareThreads 100</code>. Since this MPM runs a
    single-process, the spare thread count is also server-wide.</p>

    <p><module>beos</module> and <module>mpmt_os2</module> work
    similar to <module>mpm_netware</module>. The default for
    <module>beos</module> is <code>MaxSpareThreads 50</code>. For
    <module>mpmt_os2</module> the default value is <code>10</code>.</p>

    <note><title>Restrictions</title>
      <p>The range of the <directive>MaxSpareThreads</directive> value
      is restricted. Apache will correct the given value automatically
      according to the following rules:</p>
      <ul>
        <li><module>perchild</module> requires <directive
        >MaxSpareThreads</directive> to be less or equal than <directive
        module="mpm_common">ThreadLimit</directive>.</li>

        <li><module>mpm_netware</module> wants the value to be greater than
        <directive module="mpm_common">MinSpareThreads</directive>.</li>

        <li>For <module>leader</module>, <module>threadpool</module> and
        <module>worker</module> the value must be greater or equal than
        the sum of <directive module="mpm_common">MinSpareThreads</directive>
        and <directive module="mpm_common">ThreadsPerChild</directive>.</li>
      </ul>
    </note>
</usage>
<seealso><directive module="mpm_common">MinSpareThreads</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>

<directivesynopsis>
<name>MinSpareThreads</name>
<description>Minimum number of idle threads available to handle request
spikes</description>
<syntax>MinSpareThreads <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpmt_os2</module>
<module>perchild</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>Minimum number of idle threads to handle request spikes.
    Different MPMs deal with this directive
    differently.</p>

    <p><module>perchild</module> uses a default of
    <code>MinSpareThreads 5</code> and monitors the number of idle
    threads on a per-child basis. If there aren't enough idle threads
    in that child, the server will begin to create new threads within
    that child. Thus, if you set <directive module="perchild"
    >NumServers</directive> to <code>10</code> and a <directive
    >MinSpareThreads</directive> value of <code>5</code>, you'll have
    at least 50 idle threads on your system.</p>

    <p><module>worker</module>, <module>leader</module> and
    <module>threadpool</module> use a default of <code>MinSpareThreads
    75</code> and deal with idle threads on a server-wide basis. If
    there aren't enough idle threads in the server then child
    processes are created until the number of idle threads is greater
    than number.</p>

    <p><module>mpm_netware</module> uses a default of
    <code>MinSpareThreads 10</code> and, since it is a single-process
    MPM, tracks this on a server-wide bases.</p>

    <p><module>beos</module> and <module>mpmt_os2</module> work
    similar to <module>mpm_netware</module>. The default for
    <module>beos</module> is <code>MinSpareThreads 1</code>. For
    <module>mpmt_os2</module> the default value is <code>5</code>.</p>
</usage>
<seealso><directive module="mpm_common">MaxSpareThreads</directive></seealso>
<seealso><directive module="mpm_common">StartServers</directive></seealso>
</directivesynopsis>

<directivesynopsis>
<name>ScoreBoardFile</name>
<description>Location of the file used to store coordination data for
the child processes</description>
<syntax>ScoreBoardFile <var>file-path</var></syntax>
<default>ScoreBoardFile logs/apache_status</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_winnt</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>Apache uses a scoreboard to communicate between its parent
    and child processes.  Some architectures require a file to facilitate
    this communication. If the file is left unspecified, Apache first
    attempts to create the scoreboard entirely in memory (using anonymous
    shared memory) and, failing that, will attempt to create the file on
    disk (using file-based shared memory). Specifying this directive causes
    Apache to always create the file on the disk.</p>

    <example><title>Example</title>
      ScoreBoardFile /var/run/apache_status
    </example>

    <p>File-based shared memory is useful for third-party applications
    that require direct access to the scoreboard.</p>

    <p>If you use a <directive>ScoreBoardFile</directive> then
    you may see improved speed by placing it on a RAM disk. But be
    careful that you heed the same warnings about log file placement
    and <a href="../misc/security_tips.html">security</a>.</p>
</usage>
<seealso><a href="../stopping.html">Stopping and Restarting
Apache</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>ReceiveBufferSize</name>
<description>TCP receive buffer size</description>
<syntax>ReceiveBufferSize <var>bytes</var></syntax>
<default>ReceiveBufferSize 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>The server will set the TCP receive buffer size to the number of
    bytes specified.</p>

    <p>If set to the value of <code>0</code>, the server will use the
    OS default.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>SendBufferSize</name>
<description>TCP buffer size</description>
<syntax>SendBufferSize <var>bytes</var></syntax>
<default>SendBufferSize 0</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>leader</module>
<module>mpm_netware</module><module>mpm_winnt</module>
<module>mpmt_os2</module><module>perchild</module><module>prefork</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>The server will set the TCP send buffer size to the number of bytes
    specified. Very useful to increase past standard OS defaults on
    high speed high latency (<em>i.e.</em>, 100ms or so, such as
    transcontinental fast pipes).</p>

    <p>If set to the value of <code>0</code>, the server will use the
    OS default.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ServerLimit</name>
<description>Upper limit on configurable number of processes</description>
<syntax>ServerLimit <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>For the <module>prefork</module> MPM, this directive sets the
    maximum configured value for <directive
    module="mpm_common">MaxClients</directive> for the lifetime of the
    Apache process.  For the <module>worker</module> MPM, this directive
    in combination with <directive
    module="mpm_common">ThreadLimit</directive> sets
    the maximum configured value for <directive
    module="mpm_common">MaxClients</directive> for the lifetime of the
    Apache process.  Any attempts to change this directive during a
    restart will be ignored, but <directive
    module="mpm_common">MaxClients</directive> can be modified during
    a restart.</p>

    <p>Special care must be taken when using this directive.  If
    <directive>ServerLimit</directive> is set to a value much higher
    than necessary, extra, unused shared memory will be allocated.  If
    both <directive>ServerLimit</directive> and <directive
    module="mpm_common">MaxClients</directive> are set to values
    higher than the system can handle, Apache may not start or the
    system may become unstable.</p>

    <p>With the <module>prefork</module> MPM, use this directive only
    if you need to set <directive
    module="mpm_common">MaxClients</directive> higher than 256 (default).
    Do not set the value of this directive any higher than what you
    might want to set <directive
    module="mpm_common">MaxClients</directive> to.</p>

    <p>With <module>worker</module>, <module>leader</module> and
    <module>threadpool</module> use this directive only
    if your <directive module="mpm_common">MaxClients</directive> and
    <directive module="mpm_common">ThreadsPerChild</directive>
    settings require more than 16 server processes (default). Do not set
    the value of this directive any higher than the number of server
    processes required by what you may want for <directive
    module="mpm_common">MaxClients </directive> and <directive
    module="mpm_common">ThreadsPerChild</directive>.</p>

    <p>With the <module>perchild</module> MPM, use this directive only
    if you need to set <directive
    module="perchild">NumServers</directive> higher than 8 (default).</p>

    <note><title>Note</title>
      <p>There is a hard limit of <code>ServerLimit 20000</code> compiled
      into the server. This is intended to avoid nasty effects caused by
      typos.</p>
    </note>
</usage>
<seealso><a href="../stopping.html">Stopping and Restarting Apache</a></seealso>
</directivesynopsis>

<directivesynopsis>
<name>StartServers</name>
<description>Number of child server processes created at startup</description>
<syntax>StartServers <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpmt_os2</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>

<usage>
    <p>The <directive>StartServers</directive> directive sets the
    number of child server processes created on startup. As the number
    of processes is dynamically controlled depending on the load,
    there is usually little reason to adjust this parameter.</p>

    <p>The default value differs from MPM to MPM. For
    <module>leader</module>, <module>threadpool</module> and
    <module>worker</module> the default is <code>StartServers 3</code>.
    For <module>prefork</module> defaults to <code>5</code> and for
    <module>mpmt_os2</module> to <code>2</code>.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>StartThreads</name>
<description>Number of threads created on startup</description>
<syntax>StartThreads <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>beos</module><module>mpm_netware</module>
<module>perchild</module></modulelist>

<usage>
    <p>Number of threads created on startup. As the
    number of threads is dynamically controlled depending on the
    load, there is usually little reason to adjust this
    parameter.</p>

    <p>For <module>perchild</module> the default is <code>StartThreads
    5</code> and this directive tracks the number of threads per
    process at startup.</p>

    <p>For <module>mpm_netware</module> the default is
    <code>StartThreads 50</code> and, since there is only a single
    process, this is the total number of threads created at startup to
    serve requests.</p>

    <p>For <module>beos</module> the default is <code>StartThreads
    10</code>. It also reflects the total number of threads created
    at startup to serve requests.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ThreadLimit</name>
<description>Sets the upper limit on the configurable number of threads
per child process</description>
<syntax>ThreadLimit <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_winnt</module>
<module>perchild</module><module>threadpool</module><module>worker</module>
</modulelist>
<compatibility>Available for <module>mpm_winnt</module> in Apache 2.0.41
and later</compatibility>

<usage>
    <p>This directive sets the maximum configured value for <directive
    module="mpm_common">ThreadsPerChild</directive> for the lifetime
    of the Apache process.  Any attempts to change this directive
    during a restart will be ignored, but <directive
    module="mpm_common">ThreadsPerChild</directive> can be modified
    during a restart up to the value of this directive.</p>

    <p>Special care must be taken when using this directive.  If
    <directive>ThreadLimit</directive> is set to a value much higher
    than <directive module="mpm_common">ThreadsPerChild</directive>,
    extra unused shared memory will be allocated.  If both
    <directive>ThreadLimit</directive> and <directive
    module="mpm_common">ThreadsPerChild</directive> are set to values
    higher than the system can handle, Apache may not start or the
    system may become unstable. Do not set the value of this directive
    any higher than your greatest predicted setting of <directive
    module="mpm_common">ThreadsPerChild</directive> for the
    current run of Apache.</p>

    <p>The default value for <directive>ThreadLimit</directive> is
    <code>1920</code> when used with <module>mpm_winnt</module> and
    <code>64</code> when used with the others.</p>

    <note><title>Note</title>
      <p>There is a hard limit of <code>ThreadLimit 20000</code> (or
      <code>ThreadLimit 15000</code> with <module>mpm_winnt</module>)
      compiled into the server. This is intended to avoid nasty effects
      caused by typos.</p>
    </note>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>ThreadsPerChild</name>
<description>Number of threads created by each child process</description>
<syntax>ThreadsPerChild <var>number</var></syntax>
<default>See usage for details</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>mpm_winnt</module>
<module>threadpool</module><module>worker</module></modulelist>

<usage>
    <p>This directive sets the number of threads created by each
    child process. The child creates these threads at startup and
    never creates more. If using an MPM like <module>mpm_winnt</module>,
    where there is only one child process, this number should be high
    enough to handle the entire load of the server. If using an MPM
    like <module>worker</module>, where there are multiple child processes,
    the <em>total</em> number of threads should be high enough to handle
    the common load on the server.</p>

    <p>The default value for <directive>ThreadsPerChild</directive> is
    <code>64</code> when used with <module>mpm_winnt</module> and
    <code>25</code> when used with the others.</p>
</usage>
</directivesynopsis>

<directivesynopsis>
<name>User</name>
<description>The userid under which the server will answer
requests</description>
<syntax>User <var>unix-userid</var></syntax>
<default>User #-1</default>
<contextlist><context>server config</context></contextlist>
<modulelist><module>leader</module><module>perchild</module>
<module>prefork</module><module>threadpool</module><module>worker</module>
</modulelist>
<compatibility>Only valid in global server config since Apache
2.0</compatibility>

<usage>
    <p>The <directive>User</directive> directive sets the user ID as
    which the server will answer requests. In order to use this
    directive, the server must be run initially as <code>root</code>.
    If you start the server as a non-root user, it will fail to change
    to the lesser privileged user, and will instead continue to run as
    that original user. If you do start the server as <code>root</code>,
    then it is normal for the parent process to remain running as root.
    <var>Unix-userid</var> is one of:</p>

    <dl>
      <dt>A username</dt>
      <dd>Refers to the given user by name.</dd>

      <dt># followed by a user number.</dt>
      <dd>Refers to a user by its number.</dd>
    </dl>

    <p>The user should have no privileges that result in it being
    able to access files that are not intended to be visible to the
    outside world, and similarly, the user should not be able to
    execute code that is not meant for HTTP requests. It is
    recommended that you set up a new user and group specifically for
    running the server. Some admins use user <code>nobody</code>, but
    this is not always desirable, since the <code>nobody</code> user
    can have other uses on the system.</p>

    <note type="warning"><title>Security</title>
      <p>Don't set <directive>User</directive> (or <directive
      module="mpm_common">Group</directive>) to <code>root</code> unless
      you know exactly what you are doing, and what the dangers are.</p>
    </note>

    <p>With the <module>perchild</module> MPM, which is intended to
    server virtual hosts run under different user IDs, the
    <directive>User</directive> directive defines the user ID for the
    main server and the fallback for <directive type="section"
    module="core">VirtualHost</directive> sections without an
    <directive module="perchild">AssignUserID</directive> directive.</p>

    <p>Special note: Use of this directive in <directive module="core"
    type="section">VirtualHost</directive> is no longer supported. To
    configure your server for <program>suexec</program> use
    <directive module="mod_suexec">SuexecUserGroup</directive>.</p>

    <note><title>Note</title>
      <p>Although the <directive>User</directive> directive is present
      in the <module>beos</module> and <module>mpmt_os2</module> MPMs,
      it is actually a no-op there and only exists for compatibility
      reasons.</p>
    </note>
</usage>
</directivesynopsis>

</modulesynopsis>