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
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>mpm_common - Apache HTTP Server Version 2.5</title>
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
<script src="../style/scripts/prettify.min.js" type="text/javascript">
</script>
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
<body>
<div id="page-header">
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
<p class="apache">Apache HTTP Server Version 2.5</p>
<img alt="" src="../images/feather.png" /></div>
<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
<div id="page-content">
<div id="preamble"><h1>Apache MPM Common Directives</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
<a href="../en/mod/mpm_common.html" title="English"> en </a> |
<a href="../fr/mod/mpm_common.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
<a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
</div>
<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A collection of directives that are implemented by
more than one multi-processing module (MPM)</td></tr>
<tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr></table>
</div>
<div id="quickview"><h3 class="directives">Directives</h3>
<ul id="toc">
<li><img alt="" src="../images/down.gif" /> <a href="#accepterrorsnonfatal">AcceptErrorsNonFatal</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#coredumpdirectory">CoreDumpDirectory</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#enableexceptionhook">EnableExceptionHook</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#gracefulshutdowntimeout">GracefulShutdownTimeout</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#listen">Listen</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#listenbacklog">ListenBackLog</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxconnectionsperchild">MaxConnectionsPerChild</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxmemfree">MaxMemFree</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxrequestworkers">MaxRequestWorkers</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#maxsparethreads">MaxSpareThreads</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#minsparethreads">MinSpareThreads</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#pidfile">PidFile</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#receivebuffersize">ReceiveBufferSize</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#scoreboardfile">ScoreBoardFile</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#sendbuffersize">SendBufferSize</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#serverlimit">ServerLimit</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#startservers">StartServers</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#startthreads">StartThreads</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#threadlimit">ThreadLimit</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#threadsperchild">ThreadsPerChild</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#threadstacksize">ThreadStackSize</a></li>
</ul>
<h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&list_id=144532&product=Apache%20httpd-2&query_format=specific&order=changeddate%20DESC%2Cpriority%2Cbug_severity&component=mpm_common">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&component=mpm_common">Report a bug</a></li></ul><h3>See also</h3>
<ul class="seealso">
<li><a href="#comments_section">Comments</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="AcceptErrorsNonFatal" id="AcceptErrorsNonFatal">AcceptErrorsNonFatal</a> <a name="accepterrorsnonfatal" id="accepterrorsnonfatal">Directive</a> <a title="Permanent link" href="#accepterrorsnonfatal" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Treat some errors accepting a new connection as non-fatal
to the httpd process.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AcceptErrorsNonFatal ON</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>OFF (ECONNREFUSED, ECONNABORTED, ECONNRESET cause the process to
exit)</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>2.5.1 and later</td></tr>
</table>
<p>The <code class="directive">AcceptErrorsNonFatal</code> alters the servers
behavior under some rare errors that may occur while accepting a new
client connection. By default, the child process handling a request
will gracefully exit when nearly any socket error occurs during the
accept() system call. This is to ensure a potentially unhealthy
child process does not try to take on more new connections.</p>
<p>With <code class="directive">AcceptErrorsNonFatal</code> set to "ON",
the process will <em>not</em> begin to exit if the accept() error is
ECONNREFUSED, ECONNABORTED, or ECONNRESET.</p>
<div class="note">Some third-party firwewall software components may inject errors
into accept() processing, using return codes not specified by the
operating system</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="CoreDumpDirectory" id="CoreDumpDirectory">CoreDumpDirectory</a> <a name="coredumpdirectory" id="coredumpdirectory">Directive</a> <a title="Permanent link" href="#coredumpdirectory" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Directory where Apache HTTP Server attempts to
switch before dumping core</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>CoreDumpDirectory <var>directory</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for the default setting</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
</table>
<p>This controls the directory to which Apache httpd attempts to
switch before dumping core. If your operating system is configured to
create core files in the working directory of the crashing process,
<code class="directive">CoreDumpDirectory</code> is necessary to change working
directory from the default <code class="directive"><a href="../mod/core.html#serverroot">ServerRoot</a></code>
directory, which should not be writable by the user the server runs as.</p>
<p>If you want a core dump for debugging, you can use this directive to
place it in a different location. This directive has no effect if your
operating system is not configured to write core files to the working directory
of the crashing processes.</p>
<div class="warning">
<h3>Security note for Linux systems</h3>
<p>Using this directive on Linux may allow other processes on
the system (if running with similar privileges, such as CGI
scripts) to attach to httpd children via the <code>ptrace</code>
system call. This may make weaken the protection from certain
security attacks. It is not recommended to use this directive
on production systems.</p>
</div>
<div class="note"><h3>Core Dumps on Linux</h3>
<p>If Apache httpd 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 httpd (2.0.46 and later) reenables core dumps
on Linux 2.4 and beyond, but only if you explicitly configure a <code class="directive">CoreDumpDirectory</code>.</p>
</div>
<div class="note">
<h3>Core Dumps on BSD</h3>
<p>To enable core-dumping of suid-executables on BSD-systems (such
as FreeBSD), set <code>kern.sugid_coredump</code> to 1.
</p>
</div>
<div class="note"><h3>Specific signals</h3>
<p><code class="directive">CoreDumpDirectory</code> processing only occurs for
a select set of fatal signals: SIGFPE, SIGILL, SIGABORT,
SIGSEGV, and SIGBUS.</p>
<p>On some operating systems, SIGQUIT also results in a core dump but
does not go through <code class="directive">CoreDumpDirectory</code> or
<code class="directive">EnableExceptionHook</code> processing, so the core
location is dictated entirely by the operating system.</p>
</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="EnableExceptionHook" id="EnableExceptionHook">EnableExceptionHook</a> <a name="enableexceptionhook" id="enableexceptionhook">Directive</a> <a title="Permanent link" href="#enableexceptionhook" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables a hook that runs exception handlers
after a crash</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>EnableExceptionHook On|Off</code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>EnableExceptionHook Off</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
</table>
<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="https://emptyhammock.com/projects/httpd/diag/">EnableExceptionHook site</a> for more information about these.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="GracefulShutdownTimeout" id="GracefulShutdownTimeout">GracefulShutdownTimeout</a> <a name="gracefulshutdowntimeout" id="gracefulshutdowntimeout">Directive</a> <a title="Permanent link" href="#gracefulshutdowntimeout" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a timeout after which a gracefully shutdown server
will exit.</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>GracefulShutdownTimeout <var>seconds</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>GracefulShutdownTimeout 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
</table>
<p>The <code class="directive">GracefulShutdownTimeout</code> specifies
how many seconds after receiving a "graceful-stop" signal, a
server should continue to run, handling the existing connections.</p>
<p>Setting this value to zero means that the server will wait
indefinitely until all remaining requests have been fully served.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="Listen" id="Listen">Listen</a> <a name="listen" id="listen">Directive</a> <a title="Permanent link" href="#listen" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>IP addresses and ports that the server
listens to</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Listen [<var>IP-address</var>:]<var>portnumber</var> [<var>protocol</var>]</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>The <code class="directive">Listen</code> directive instructs Apache httpd to
listen to only specific IP addresses or ports; by default it
responds to requests on all IP interfaces. <code class="directive">Listen</code>
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 httpd.</p>
<p>The <code class="directive">Listen</code> 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 <code class="directive">Listen</code> 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>
<pre class="prettyprint lang-config">Listen 80
Listen 8000</pre>
<p>To make the server accept connections on two specified
interfaces and port numbers, use </p>
<pre class="prettyprint lang-config">Listen 192.170.2.1:80
Listen 192.170.2.5:8000</pre>
<p>IPv6 addresses must be surrounded in square brackets, as in the
following example:</p>
<pre class="prettyprint lang-config">Listen [2001:db8::a00:20ff:fea7:ccea]:80</pre>
<p>The optional <var>protocol</var> argument is not required for most
configurations. If not specified, <code>https</code> is the default for
port 443 and <code>http</code> the default for all other ports. The
protocol is used to determine which module should handle a request, and
to apply protocol specific optimizations with the
<code class="directive"><a href="../mod/core.html#acceptfilter">AcceptFilter</a></code> directive.</p>
<p>You only need to set the protocol if you are running on non-standard
ports. For example, running an <code>https</code> site on port 8443:</p>
<pre class="prettyprint lang-config">Listen 192.170.2.1:8443 https</pre>
<div class="note"><h3>Error condition</h3>
Multiple <code class="directive">Listen</code> directives for the same ip
address and port will result in an <code>Address already in use</code>
error message.
</div>
<h3>See also</h3>
<ul>
<li><a href="../dns-caveats.html">DNS Issues</a></li>
<li><a href="../bind.html">Setting which addresses and ports Apache HTTP Server
uses</a></li>
<li><a href="http://wiki.apache.org/httpd/CouldNotBindToAddress">Further
discussion of the <code>Address already in use</code> error message,
including other causes.</a></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ListenBackLog" id="ListenBackLog">ListenBackLog</a> <a name="listenbacklog" id="listenbacklog">Directive</a> <a title="Permanent link" href="#listenbacklog" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum length of the queue of pending connections</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenBackLog <var>backlog</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenBackLog 511</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<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>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ListenCoresBucketsRatio" id="ListenCoresBucketsRatio">ListenCoresBucketsRatio</a> <a name="listencoresbucketsratio" id="listencoresbucketsratio">Directive</a> <a title="Permanent link" href="#listencoresbucketsratio" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ratio between the number of CPU cores (online) and the number of
listeners' buckets</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ListenCoresBucketsRatio <var>ratio</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ListenCoresBucketsRatio 0 (disabled)</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.4.17, with a kernel supporting
the socket option <code>SO_REUSEPORT</code> and distributing new connections
evenly across listening processes' (or threads') sockets using it (eg. Linux
3.9 and later, but not the current implementations of <code>SO_REUSEPORT</code>
in *BSDs.</td></tr>
</table>
<p>A <var>ratio</var> between the number of (online) CPU cores and the
number of listeners' buckets can be used to make Apache HTTP Server create
<code>num_cpu_cores / ratio</code> listening buckets, each containing its
own <code class="directive"><a href="#listen">Listen</a></code>-ing socket(s) on the same port(s), and
then make each child handle a single bucket (with round-robin distribution
of the buckets at children creation time).</p>
<div class="note"><h3>Meaning of "online" CPU core</h3>
<p>On Linux (and also BSD) a CPU core can be turned on/off if
<a href="https://www.kernel.org/doc/Documentation/cpu-hotplug.txt">Hotplug</a>
is configured, therefore <code class="directive">ListenCoresBucketsRatio</code> needs to
take this parameter into account while calculating the number of buckets to create.</p>
</div>
<p><code class="directive">ListenCoresBucketsRatio</code> can improve the
scalability when accepting new connections is/becomes the bottleneck.
On systems with a large number of CPU cores, enabling this feature has
been tested to show significant performances improvement and shorter
responses time.</p>
<p>There must be at least twice the number of CPU cores than the
configured <var>ratio</var> for this to be active. The recommended
<var>ratio</var> is <code>8</code>, hence at least <code>16</code>
cores should be available at runtime when this value is used.
The right <var>ratio</var> to obtain maximum performance needs to be calculated
for each target system, testing multiple values and observing the variations in your
key performance metrics.</p>
<p>This directive influences the calculation of the
<code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code> and
<code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code> lower bound values.
The number of children processes needs to be a multiple of the number
of buckets to optimally accept connections.</p>
<div class="note">
<h3>Multiple <code class="directive">Listen</code>ers or Apache HTTP servers on
the same IP address and port</h3>
<p>Setting the <code>SO_REUSEPORT</code> option on the listening socket(s)
consequently allows multiple processes (sharing the same <code>EUID</code>,
e.g. <code>root</code>) to bind to the the same IP address and port,
without the binding error raised by the system in the usual case.</p>
<p>This also means that multiple instances of Apache httpd configured on a
same <code>IP:port</code> and with a positive <code class="directive">ListenCoresBucketsRatio</code>
would start without an error too, and then run with incoming connections
evenly distributed accross both instances (this is NOT a recommendation or
a sensible usage in any case, but just a notice that it would prevent such
possible issues to be detected).</p>
<p>Within the same instance, Apache httpd will check and fail to start if
multiple <code class="directive">Listen</code> directives on the exact same IP (or
hostname) and port are configured, thus avoiding the creation of some
duplicated buckets which would be useless and kill performances. However
it can't (and won't try harder to) catch all the possible overlapping cases
(like a hostname resolving to an IP used elsewhere).</p>
</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="MaxConnectionsPerChild" id="MaxConnectionsPerChild">MaxConnectionsPerChild</a> <a name="maxconnectionsperchild" id="maxconnectionsperchild">Directive</a> <a title="Permanent link" href="#maxconnectionsperchild" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Limit on the number of connections that an individual child server
will handle during its life</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxConnectionsPerChild <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxConnectionsPerChild 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available Apache HTTP Server 2.3.9 and later. The old name
<code>MaxRequestsPerChild</code> is still supported.</td></tr>
</table>
<p>The <code class="directive">MaxConnectionsPerChild</code> directive sets
the limit on the number of connections that an individual child
server process will handle. After
<code class="directive">MaxConnectionsPerChild</code> connections, the child
process will die. If <code class="directive">MaxConnectionsPerChild</code> is
<code>0</code>, then the process will never expire.</p>
<p>Setting <code class="directive">MaxConnectionsPerChild</code> to a
non-zero value limits the amount of memory that process can consume
by (accidental) memory leakage.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="MaxMemFree" id="MaxMemFree">MaxMemFree</a> <a name="maxmemfree" id="maxmemfree">Directive</a> <a title="Permanent link" href="#maxmemfree" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of memory that the main allocator is allowed
to hold without calling <code>free()</code></td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxMemFree <var>KBytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>MaxMemFree 2048</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
</table>
<p>The <code class="directive">MaxMemFree</code> directive sets the
maximum number of free Kbytes that every allocator is allowed
to hold without calling <code>free()</code>. In threaded MPMs, every
thread has its own allocator. When set
to zero, the threshold will be set to unlimited.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="MaxRequestWorkers" id="MaxRequestWorkers">MaxRequestWorkers</a> <a name="maxrequestworkers" id="maxrequestworkers">Directive</a> <a title="Permanent link" href="#maxrequestworkers" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of connections that will be processed
simultaneously</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxRequestWorkers <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
</table>
<p>The <code class="directive">MaxRequestWorkers</code> directive sets the limit
on the number of simultaneous requests that will be served. Any
connection attempts over the <code class="directive">MaxRequestWorkers</code>
limit will normally be queued, up to a number based on the
<code class="directive"><a href="#listenbacklog">ListenBacklog</a></code>
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>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>),
<code class="directive">MaxRequestWorkers</code> 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
<code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
<p>For threaded and hybrid servers (<em>e.g.</em> <code class="module"><a href="../mod/event.html">event</a></code>
or <code class="module"><a href="../mod/worker.html">worker</a></code>) <code class="directive">MaxRequestWorkers</code> restricts
the total number of threads that will be available to serve clients.
For hybrid MPMs the default value is <code>16</code> (<code class="directive"><a href="#serverlimit">ServerLimit</a></code>) multiplied by the value of
<code>25</code> (<code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>). Therefore, to increase <code class="directive">MaxRequestWorkers</code> to a value that requires more than 16 processes,
you must also raise <code class="directive"><a href="#serverlimit">ServerLimit</a></code>.</p>
<p><code class="directive">MaxRequestWorkers</code> was called
<code class="directive">MaxClients</code> before version 2.3.13. The old name is still
supported.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="MaxSpareThreads" id="MaxSpareThreads">MaxSpareThreads</a> <a name="maxsparethreads" id="maxsparethreads">Directive</a> <a title="Permanent link" href="#maxsparethreads" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of idle threads</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MaxSpareThreads <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>Maximum number of idle threads. Different MPMs deal with this
directive differently.</p>
<p>For <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, 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. Additional processes/threads
might be created if <code class="directive"><a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></code>
is enabled.</p>
<p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> the default is
<code>MaxSpareThreads 100</code>. Since this MPM runs a
single-process, the spare thread count is also server-wide.</p>
<p><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. For
<code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>10</code>.</p>
<div class="note"><h3>Restrictions</h3>
<p>The range of the <code class="directive">MaxSpareThreads</code> value
is restricted. Apache httpd will correct the given value automatically
according to the following rules:</p>
<ul>
<li><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> wants the value to be greater than
<code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>.</li>
<li>For <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code>, the value
must be greater or equal to the sum of <code class="directive"><a href="#minsparethreads">
MinSpareThreads</a></code> and <code class="directive"><a href="#threadsperchild">
ThreadsPerChild</a></code>.</li>
</ul>
</div>
<h3>See also</h3>
<ul>
<li><code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code></li>
<li><code class="directive"><a href="#startservers">StartServers</a></code></li>
<li><code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="MinSpareThreads" id="MinSpareThreads">MinSpareThreads</a> <a name="minsparethreads" id="minsparethreads">Directive</a> <a title="Permanent link" href="#minsparethreads" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimum number of idle threads available to handle request
spikes</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>MinSpareThreads <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>Minimum number of idle threads to handle request spikes.
Different MPMs deal with this directive differently.</p>
<p><code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event</a></code> 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 <var>number</var>. Additional processes/threads
might be created if <code class="directive"><a href="#listencoresbucketsratio">ListenCoresBucketsRatio</a></code>
is enabled.</p>
<p><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> 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><code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> works
similar to <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>. For
<code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code> the default value is <code>5</code>.</p>
<h3>See also</h3>
<ul>
<li><code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code></li>
<li><code class="directive"><a href="#startservers">StartServers</a></code></li>
<li><code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="PidFile" id="PidFile">PidFile</a> <a name="pidfile" id="pidfile">Directive</a> <a title="Permanent link" href="#pidfile" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>File where the server records the process ID
of the daemon</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PidFile <var>filename</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>PidFile httpd.pid</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>The <code class="directive">PidFile</code> 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
<code class="directive"><a href="../mod/core.html#defaultruntimedir">DefaultRuntimeDir</a></code>.</p>
<div class="example"><h3>Example</h3><pre class="prettyprint lang-config">PidFile /var/run/apache.pid</pre>
</div>
<p>It is often useful to be able to send the server a signal,
so that it closes and then re-opens its <code class="directive"><a href="../mod/core.html#errorlog">ErrorLog</a></code> and <code class="directive"><a href="../mod/mod_log_config.html#transferlog">TransferLog</a></code>, and
re-reads its configuration files. This is done by sending a
SIGHUP (kill -1) signal to the process id listed in the
<code class="directive">PidFile</code>.</p>
<p>The <code class="directive">PidFile</code> is subject to the same
warnings about log file placement and <a href="../misc/security_tips.html#serverroot">security</a>.</p>
<div class="note"><h3>Note</h3>
<p>As of Apache HTTP Server 2, we recommended that you only use the <code class="program"><a href="../programs/apachectl.html">apachectl</a></code> script, or the init script that your OS provides,
for (re-)starting or stopping the server.</p>
</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ReceiveBufferSize" id="ReceiveBufferSize">ReceiveBufferSize</a> <a name="receivebuffersize" id="receivebuffersize">Directive</a> <a title="Permanent link" href="#receivebuffersize" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP receive buffer size</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ReceiveBufferSize <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ReceiveBufferSize 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<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>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ScoreBoardFile" id="ScoreBoardFile">ScoreBoardFile</a> <a name="scoreboardfile" id="scoreboardfile">Directive</a> <a title="Permanent link" href="#scoreboardfile" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Location of the file used to store coordination data for
the child processes</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ScoreBoardFile <var>file-path</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ScoreBoardFile apache_runtime_status</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
</table>
<p>Apache HTTP Server 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 httpd 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 httpd to always create the file on the disk.</p>
<p>If <var>file-path</var> is not an absolute path, the location specified
will be relative to the value of
<code class="directive"><a href="../mod/core.html#defaultruntimedir">DefaultRuntimeDir</a></code>.</p>
<div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ScoreBoardFile /var/run/apache_runtime_status</pre>
</div>
<p>File-based shared memory is useful for third-party applications
that require direct access to the scoreboard.</p>
<p>If you use a <code class="directive">ScoreBoardFile</code> 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>
<h3>See also</h3>
<ul>
<li><a href="../stopping.html">Stopping and Restarting
Apache HTTP Server</a></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="SendBufferSize" id="SendBufferSize">SendBufferSize</a> <a name="sendbuffersize" id="sendbuffersize">Directive</a> <a title="Permanent link" href="#sendbuffersize" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>TCP buffer size</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>SendBufferSize <var>bytes</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>SendBufferSize 0</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>Sets the server's TCP send buffer size to the number of bytes
specified. It is often useful to set this past the OS's standard
default value on high speed, high latency connections
(<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
default value provided by your OS.</p>
<p>Further configuration of your operating system may be required to elicit
better performance on high speed, high latency connections.</p>
<div class="note"> <p> On some operating systems, changes in TCP behavior resulting
from a larger <code class="directive">SendBufferSize</code> may not be seen unless
<code class="directive"><a href="../mod/core.html#enablesendfile">EnableSendfile</a></code> is set to OFF. This
interaction applies only to static files.</p> </div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ServerLimit" id="ServerLimit">ServerLimit</a> <a name="serverlimit" id="serverlimit">Directive</a> <a title="Permanent link" href="#serverlimit" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Upper limit on configurable number of processes</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ServerLimit <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code></td></tr>
</table>
<p>For the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, this directive sets the
maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
Apache httpd process. For the <code class="module"><a href="../mod/worker.html">worker</a></code> and <code class="module"><a href="../mod/event.html">event
</a></code> MPMs, this directive in combination with <code class="directive"><a href="#threadlimit">ThreadLimit</a></code> sets
the maximum configured value for <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> for the lifetime of the
Apache httpd process. For the <code class="module"><a href="../mod/event.html">event</a></code> MPM, this directive
also defines how many old server processes may keep running and finish processing
open connections.
Any attempts to change this directive during a restart will be ignored, but
<code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> can be modified
during a restart.</p>
<p>Special care must be taken when using this directive. If
<code class="directive">ServerLimit</code> is set to a value much higher
than necessary, extra, unused shared memory will be allocated. If
both <code class="directive">ServerLimit</code> and <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> are set to values
higher than the system can handle, Apache httpd may not start or the
system may become unstable.</p>
<p>With the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM, use this directive only
if you need to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> higher than 256 (default).
Do not set the value of this directive any higher than what you
might want to set <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> to.</p>
<p>With <code class="module"><a href="../mod/worker.html">worker</a></code>, use this directive only if your
<code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers
</a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>
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 <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers </a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>.</p>
<p>With <code class="module"><a href="../mod/event.html">event</a></code>, increase this directive if the process
number defined by your <code class="directive"><a href="#maxrequestworkers">MaxRequestWorkers</a></code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> settings, plus the
number of gracefully shutting down processes, is more than 16 server
processes (default).</p>
<div class="note"><h3>Note</h3>
<p>There is a hard limit of <code>ServerLimit 20000</code> compiled
into the server (for the <code class="module"><a href="../mod/prefork.html">prefork</a></code> MPM 200000). This is
intended to avoid nasty effects caused by typos. To increase it
even further past this limit, you will need to modify the value of
MAX_SERVER_LIMIT in the mpm source file and rebuild the server.</p>
</div>
<h3>See also</h3>
<ul>
<li><a href="../stopping.html">Stopping and Restarting Apache HTTP Server</a></li>
</ul>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="StartServers" id="StartServers">StartServers</a> <a name="startservers" id="startservers">Directive</a> <a title="Permanent link" href="#startservers" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of child server processes created at startup</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartServers <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/prefork.html">prefork</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>The <code class="directive">StartServers</code> directive sets the
number of child server processes created on startup. As the number
of processes is dynamically controlled depending on the load, (see
<code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
<code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
<code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
there is usually little reason to adjust this parameter.</p>
<p>The default value differs from MPM to MPM. <code class="module"><a href="../mod/worker.html">worker</a></code> and
<code class="module"><a href="../mod/event.html">event</a></code> default to <code>StartServers 3</code>; <code class="module"><a href="../mod/prefork.html">
prefork</a></code> defaults to <code>5</code>; <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code>
defaults to <code>2</code>.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="StartThreads" id="StartThreads">StartThreads</a> <a name="startthreads" id="startthreads">Directive</a> <a title="Permanent link" href="#startthreads" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created on startup</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>StartThreads <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code></td></tr>
</table>
<p>Number of threads created on startup. As the
number of threads is dynamically controlled depending on the
load, (see
<code class="directive"><a href="#minsparethreads">MinSpareThreads</a></code>,
<code class="directive"><a href="#maxsparethreads">MaxSpareThreads</a></code>,
<code class="directive"><a href="../mod/prefork.html#minspareservers">MinSpareServers</a></code>, <code class="directive"><a href="../mod/prefork.html#maxspareservers">MaxSpareServers</a></code>)
there is usually little reason to adjust this
parameter.</p>
<p>For <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code> 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>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ThreadLimit" id="ThreadLimit">ThreadLimit</a> <a name="threadlimit" id="threadlimit">Directive</a> <a title="Permanent link" href="#threadlimit" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the upper limit on the configurable number of threads
per child process</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadLimit <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
</table>
<p>This directive sets the maximum configured value for <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the lifetime
of the Apache httpd process. Any attempts to change this directive
during a restart will be ignored, but <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> 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
<code class="directive">ThreadLimit</code> is set to a value much higher
than <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code>,
extra unused shared memory will be allocated. If both
<code class="directive">ThreadLimit</code> and <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> are set to values
higher than the system can handle, Apache httpd 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 <code class="directive"><a href="#threadsperchild">ThreadsPerChild</a></code> for the
current run of Apache httpd.</p>
<p>The default value for <code class="directive">ThreadLimit</code> is
<code>1920</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
<code>64</code> when used with the others.</p>
<div class="note"><h3>Note</h3>
<p>There is a hard limit of <code>ThreadLimit 20000</code> (or
<code>ThreadLimit 100000</code> with <code class="module"><a href="../mod/event.html">event</a></code>,
<code>ThreadLimit 15000</code> with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>)
compiled into the server. This is intended to avoid nasty effects
caused by typos. To increase it even further past this limit, you
will need to modify the value of MAX_THREAD_LIMIT in the mpm
source file and rebuild the server.</p>
</div>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ThreadsPerChild" id="ThreadsPerChild">ThreadsPerChild</a> <a name="threadsperchild" id="threadsperchild">Directive</a> <a title="Permanent link" href="#threadsperchild" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of threads created by each child process</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadsPerChild <var>number</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for details</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code></td></tr>
</table>
<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 <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>,
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 <code class="module"><a href="../mod/worker.html">worker</a></code>, 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 <code class="directive">ThreadsPerChild</code> is
<code>64</code> when used with <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code> and
<code>25</code> when used with the others.</p>
<p>The value of <code class="directive">ThreadsPerChild</code> can not exceed the
value of <code class="directive"><a href="#threadlimit">ThreadLimit</a></code>. If a
higher value is configured, it will be automatically reduced at start-up
and a warning will be logged. The relationship between these 2 directives
is explained in <code class="directive"><a href="#threadlimit">ThreadLimit</a></code>.</p>
</div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="directive-section"><h2><a name="ThreadStackSize" id="ThreadStackSize">ThreadStackSize</a> <a name="threadstacksize" id="threadstacksize">Directive</a> <a title="Permanent link" href="#threadstacksize" class="permalink">¶</a></h2>
<table class="directive">
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The size in bytes of the stack used by threads handling
client connections</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ThreadStackSize <var>size</var></code></td></tr>
<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>65536 on NetWare; varies on other operating systems</code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>MPM</td></tr>
<tr><th><a href="directive-dict.html#Module">Module:</a></th><td><code class="module"><a href="../mod/event.html">event</a></code>, <code class="module"><a href="../mod/worker.html">worker</a></code>, <code class="module"><a href="../mod/mpm_winnt.html">mpm_winnt</a></code>, <code class="module"><a href="../mod/mpm_netware.html">mpm_netware</a></code>, <code class="module"><a href="../mod/mpmt_os2.html">mpmt_os2</a></code></td></tr>
</table>
<p>The <code class="directive">ThreadStackSize</code> directive sets the
size of the stack (for autodata) of threads which handle client
connections and call modules to help process those connections.
In most cases the operating system default for stack size is
reasonable, but there are some conditions where it may need to be
adjusted:</p>
<ul>
<li>On platforms with a relatively small default thread stack size
(e.g., HP-UX), Apache httpd may crash when using some third-party modules
which use a relatively large amount of autodata storage. Those
same modules may have worked fine on other platforms where the
default thread stack size is larger. This type of crash is
resolved by setting <code class="directive">ThreadStackSize</code> to a
value higher than the operating system default. This type of
adjustment is necessary only if the provider of the third-party
module specifies that it is required, or if diagnosis of an Apache httpd
crash indicates that the thread stack size was too small.</li>
<li>On platforms where the default thread stack size is
significantly larger than necessary for the web server
configuration, a higher number of threads per child process
will be achievable if <code class="directive">ThreadStackSize</code> is
set to a value lower than the operating system default. This type
of adjustment should only be made in a test environment which allows
the full set of web server processing can be exercised, as there
may be infrequent requests which require more stack to process.
The minimum required stack size strongly depends on the modules
used, but any change in the web server configuration can invalidate
the current <code class="directive">ThreadStackSize</code> setting.</li>
<li>On Linux, this directive can only be used to increase the default
stack size, as the underlying system call uses the value as a
<em>minimum</em> stack size. The (often large) soft limit for
<code>ulimit -s</code> (8MB if unlimited) is used as the default stack
size.</li>
</ul>
<div class="note">It is recommended to not reduce <code class="directive">ThreadStackSize</code>
unless a high number of threads per child process is needed. On some
platforms (including Linux), a setting of 128000 is already too low and
causes crashes with some common modules.</div>
</div>
</div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="../de/mod/mpm_common.html" hreflang="de" rel="alternate" title="Deutsch"> de </a> |
<a href="../en/mod/mpm_common.html" title="English"> en </a> |
<a href="../fr/mod/mpm_common.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a> |
<a href="../ja/mod/mpm_common.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
<a href="../tr/mod/mpm_common.html" hreflang="tr" rel="alternate" title="T�rk�e"> tr </a></p>
</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
<script type="text/javascript"><!--//--><![CDATA[//><!--
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mpm_common.html';
(function(w, d) {
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
}
else {
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
}
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
//--><!]]></script>
</body></html>
|