Mercurial > hg > nginx-site
comparison xml/en/docs/ngx_core_module.xml @ 957:6d9d4bb571a9
Text review of the ngx_core_module.
author | Egor Nikitin <yegor.nikitin@gmail.com> |
---|---|
date | Sat, 08 Jun 2013 20:55:52 +0400 |
parents | aded7086e84f |
children | 95c3c3bbf1ce |
comparison
equal
deleted
inserted
replaced
956:488a3f738db0 | 957:6d9d4bb571a9 |
---|---|
39 <syntax><literal>on</literal> | <literal>off</literal></syntax> | 39 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
40 <default>on</default> | 40 <default>on</default> |
41 <context>events</context> | 41 <context>events</context> |
42 | 42 |
43 <para> | 43 <para> |
44 If enabled, | 44 If <literal>accept_mutex</literal> is enabled, |
45 accepts of new connections by multiple worker processes will be serialized. | 45 worker processes will accept new connections by turn. |
46 Otherwise, all worker processes will be notified about new connections, | 46 Otherwise, all worker processes will be notified about new connections, |
47 and if volume of new connections is low, some of the worker processes | 47 and if volume of new connections is low, some of the worker processes |
48 may just waste system resources. | 48 may just waste system resources. |
49 <note> | 49 <note> |
50 The use of <link doc="events.xml" id="rtsig"/> | 50 The use of <link doc="events.xml" id="rtsig"/> |
62 <context>events</context> | 62 <context>events</context> |
63 | 63 |
64 <para> | 64 <para> |
65 If <link id="accept_mutex"/> is enabled, specifies the maximum time | 65 If <link id="accept_mutex"/> is enabled, specifies the maximum time |
66 during which a worker process will try to restart accepting new | 66 during which a worker process will try to restart accepting new |
67 connections if another worker process is already doing this | 67 connections if another worker process is currently accepting |
68 currently. | 68 new connections. |
69 </para> | 69 </para> |
70 | 70 |
71 </directive> | 71 </directive> |
72 | 72 |
73 | 73 |
133 | 133 |
134 <para> | 134 <para> |
135 When internal error is detected, e.g. the leak of sockets on | 135 When internal error is detected, e.g. the leak of sockets on |
136 restart of working processes, enabling <literal>debug_points</literal> | 136 restart of working processes, enabling <literal>debug_points</literal> |
137 leads to a core file creation (<literal>abort</literal>) | 137 leads to a core file creation (<literal>abort</literal>) |
138 or stopping a process (<literal>stop</literal>) for further | 138 or to stopping of a process (<literal>stop</literal>) for further |
139 analysis using a system debugger. | 139 analysis using a system debugger. |
140 </para> | 140 </para> |
141 | 141 |
142 </directive> | 142 </directive> |
143 | 143 |
261 <context>main</context> | 261 <context>main</context> |
262 | 262 |
263 <para> | 263 <para> |
264 By default, nginx removes all environment variables inherited | 264 By default, nginx removes all environment variables inherited |
265 from its parent process except the TZ variable. | 265 from its parent process except the TZ variable. |
266 This directive allows to preserve some of the inherited variables, | 266 This directive allows preserving some of the inherited variables, |
267 change their values, or create new environment variables. | 267 changing their values, or creating new environment variables. |
268 These variables are then: | 268 These variables are then: |
269 <list type="bullet"> | 269 <list type="bullet"> |
270 | 270 |
271 <listitem> | 271 <listitem> |
272 inherited during a <link doc="control.xml" id="upgrade">live upgrade</link> | 272 inherited during a <link doc="control.xml" id="upgrade">live upgrade</link> |
273 of an executable file; | 273 of an executable file; |
274 </listitem> | 274 </listitem> |
275 | 275 |
276 <listitem> | 276 <listitem> |
277 used by the module | 277 used by the |
278 <link doc="http/ngx_http_perl_module.xml">ngx_http_perl_module</link>; | 278 <link doc="http/ngx_http_perl_module.xml">ngx_http_perl_module</link> module; |
279 </listitem> | 279 </listitem> |
280 | 280 |
281 <listitem> | 281 <listitem> |
282 used by worker processes. | 282 used by worker processes. |
283 Please bear in mind that controlling system libraries in this way | 283 One should bear in mind that controlling system libraries in this way |
284 is not always possible as it is not uncommon for libraries to check | 284 is not always possible as it is common for libraries to check |
285 variables only during initialization, well before they can be set | 285 variables only during initialization, well before they can be set |
286 using this directive. | 286 using this directive. |
287 An exception from this is an above mentioned | 287 An exception from this is an above mentioned |
288 <link doc="control.xml" id="upgrade">live upgrade</link> | 288 <link doc="control.xml" id="upgrade">live upgrade</link> |
289 of an executable file. | 289 of an executable file. |
291 | 291 |
292 </list> | 292 </list> |
293 </para> | 293 </para> |
294 | 294 |
295 <para> | 295 <para> |
296 The TZ variable is always inherited and made available to the module | 296 The TZ variable is always inherited and available to the |
297 <link doc="http/ngx_http_perl_module.xml">ngx_http_perl_module</link>, | 297 <link doc="http/ngx_http_perl_module.xml">ngx_http_perl_module</link> |
298 unless configured explicitly. | 298 module, unless it is configured explicitly. |
299 </para> | 299 </para> |
300 | 300 |
301 <para> | 301 <para> |
302 Usage example: | 302 Usage example: |
303 <example> | 303 <example> |
321 <syntax block="yes"/> | 321 <syntax block="yes"/> |
322 <default/> | 322 <default/> |
323 <context>main</context> | 323 <context>main</context> |
324 | 324 |
325 <para> | 325 <para> |
326 Provides a configuration file context in which the directives that | 326 Provides the configuration file context in which the directives that |
327 affect connection processing are specified. | 327 affect connection processing are specified. |
328 </para> | 328 </para> |
329 | 329 |
330 </directive> | 330 </directive> |
331 | 331 |
358 <default>logs/nginx.lock</default> | 358 <default>logs/nginx.lock</default> |
359 <context>main</context> | 359 <context>main</context> |
360 | 360 |
361 <para> | 361 <para> |
362 nginx uses the locking mechanism to implement <link id="accept_mutex"/> | 362 nginx uses the locking mechanism to implement <link id="accept_mutex"/> |
363 and serialize accesses to shared memory. | 363 and serialize access to shared memory. |
364 On most systems the locks are implemented using atomic operations, | 364 On most systems the locks are implemented using atomic operations, |
365 and this directive is ignored. | 365 and this directive is ignored. |
366 On other systems the “lock file” mechanism is used. | 366 On other systems the “lock file” mechanism is used. |
367 This directive specifies a prefix for the names of lock files. | 367 This directive specifies a prefix for the names of lock files. |
368 </para> | 368 </para> |
387 <syntax><literal>on</literal> | <literal>off</literal></syntax> | 387 <syntax><literal>on</literal> | <literal>off</literal></syntax> |
388 <default>off</default> | 388 <default>off</default> |
389 <context>events</context> | 389 <context>events</context> |
390 | 390 |
391 <para> | 391 <para> |
392 If disabled, a worker process | 392 If <literal>multi_accept</literal> is disabled, a worker process |
393 will accept one new connection at a time. | 393 will accept one new connection at a time. |
394 Otherwise, a worker process | 394 Otherwise, a worker process |
395 will accept all new connections at a time. | 395 will accept all new connections at a time. |
396 <note> | 396 <note> |
397 The directive is ignored if <link doc="events.xml" id="kqueue"/> | 397 The directive is ignored if <link doc="events.xml" id="kqueue"/> |
398 connection processing method is used because it can report | 398 connection processing method is used, because it reports |
399 the number of new connections waiting to be accepted. | 399 the number of new connections waiting to be accepted. |
400 </note> | 400 </note> |
401 <note> | 401 <note> |
402 The use of <link doc="events.xml" id="rtsig"/> | 402 The use of <link doc="events.xml" id="rtsig"/> |
403 connection processing method | 403 connection processing method |
414 <context>main</context> | 414 <context>main</context> |
415 <appeared-in>1.1.12</appeared-in> | 415 <appeared-in>1.1.12</appeared-in> |
416 | 416 |
417 <para> | 417 <para> |
418 Enables or disables the use of “just-in-time compilation” (PCRE JIT) | 418 Enables or disables the use of “just-in-time compilation” (PCRE JIT) |
419 for regular expressions known at configuration parse time. | 419 for the regular expressions known by the time of configuration parsing. |
420 </para> | 420 </para> |
421 | 421 |
422 <para> | 422 <para> |
423 PCRE JIT can speed up processing of regular expressions significantly. | 423 PCRE JIT can speed up processing of regular expressions significantly. |
424 <note> | 424 <note> |
425 The JIT is available in PCRE libraries starting from version 8.20 | 425 The JIT is available in PCRE libraries starting from version 8.20 |
426 built with the <literal>--enable-jit</literal> configuration parameter. | 426 built with the <literal>--enable-jit</literal> configuration parameter. |
427 When building the PCRE library with nginx (<literal>--with-pcre=</literal>), | 427 When the PCRE library is built with nginx (<literal>--with-pcre=</literal>), |
428 the JIT support should be enabled with the | 428 the JIT support is enabled via the |
429 <literal>--with-pcre-jit</literal> configuration parameter. | 429 <literal>--with-pcre-jit</literal> configuration parameter. |
430 </note> | 430 </note> |
431 </para> | 431 </para> |
432 | 432 |
433 </directive> | 433 </directive> |
464 | 464 |
465 <para> | 465 <para> |
466 Reduces timer resolution in worker processes, thus reducing the | 466 Reduces timer resolution in worker processes, thus reducing the |
467 number of <c-func>gettimeofday</c-func> system calls made. | 467 number of <c-func>gettimeofday</c-func> system calls made. |
468 By default, <c-func>gettimeofday</c-func> is called each time | 468 By default, <c-func>gettimeofday</c-func> is called each time |
469 on receiving a kernel event. | 469 a kernel event is received. |
470 With reduced resolution, <c-func>gettimeofday</c-func> is only | 470 With reduced resolution, <c-func>gettimeofday</c-func> is only |
471 called once per specified <value>interval</value>. | 471 called once per specified <value>interval</value>. |
472 </para> | 472 </para> |
473 | 473 |
474 <para> | 474 <para> |
477 timer_resolution 100ms; | 477 timer_resolution 100ms; |
478 </example> | 478 </example> |
479 </para> | 479 </para> |
480 | 480 |
481 <para> | 481 <para> |
482 An internal implementation of interval depends on the method used: | 482 Internal implementation of the interval depends on the method used: |
483 <list type="bullet"> | 483 <list type="bullet"> |
484 | 484 |
485 <listitem> | 485 <listitem> |
486 an <c-def>EVFILT_TIMER</c-def> filter if <literal>kqueue</literal> is used; | 486 the <c-def>EVFILT_TIMER</c-def> filter if <literal>kqueue</literal> is used; |
487 </listitem> | 487 </listitem> |
488 | 488 |
489 <listitem> | 489 <listitem> |
490 <c-func>timer_create</c-func> if <literal>eventport</literal> is used; | 490 <c-func>timer_create</c-func> if <literal>eventport</literal> is used; |
491 </listitem> | 491 </listitem> |
506 <context>events</context> | 506 <context>events</context> |
507 | 507 |
508 <para> | 508 <para> |
509 Specifies the <link doc="events.xml">connection processing</link> | 509 Specifies the <link doc="events.xml">connection processing</link> |
510 <value>method</value> to use. | 510 <value>method</value> to use. |
511 There is normally no need to specify it explicitly because nginx will | 511 There is normally no need to specify it explicitly, because nginx will |
512 by default use the most efficient method. | 512 by default use the most efficient method. |
513 </para> | 513 </para> |
514 | 514 |
515 </directive> | 515 </directive> |
516 | 516 |
558 can be opened by a worker process. | 558 can be opened by a worker process. |
559 </para> | 559 </para> |
560 | 560 |
561 <para> | 561 <para> |
562 It should be kept in mind that this number includes all connections | 562 It should be kept in mind that this number includes all connections |
563 (e.g. connections with proxied servers, among other things), | 563 (e.g. connections with proxied servers, among others), |
564 not only connections with clients. | 564 not only connections with clients. |
565 Another consideration is that the actual number of simultaneous | 565 Another consideration is that the actual number of simultaneous |
566 connections may not exceed the current limit on | 566 connections can not exceed the current limit on |
567 the maximum number of open files that can be changed by | 567 the maximum number of open files, which can be changed by |
568 <link id="worker_rlimit_nofile"/>. | 568 <link id="worker_rlimit_nofile"/>. |
569 </para> | 569 </para> |
570 | 570 |
571 </directive> | 571 </directive> |
572 | 572 |
576 <default/> | 576 <default/> |
577 <context>main</context> | 577 <context>main</context> |
578 | 578 |
579 <para> | 579 <para> |
580 Binds worker processes to the sets of CPUs. | 580 Binds worker processes to the sets of CPUs. |
581 Each CPU set is represented by a bitmask of allowed to use CPUs. | 581 Each CPU set is represented by a bitmask of allowed CPUs. |
582 There should be a separate set defined for each of the worker processes. | 582 There should be a separate set defined for each of the worker processes. |
583 By default, worker processes are not bound to any specific CPUs. | 583 By default, worker processes are not bound to any specific CPUs. |
584 </para> | 584 </para> |
585 | 585 |
586 <para> | 586 <para> |
612 <syntax><value>number</value></syntax> | 612 <syntax><value>number</value></syntax> |
613 <default>0</default> | 613 <default>0</default> |
614 <context>main</context> | 614 <context>main</context> |
615 | 615 |
616 <para> | 616 <para> |
617 Defines a scheduling priority for worker processes like is | 617 Defines the scheduling priority for worker processes like it is |
618 done by the <command>nice</command> command: a negative | 618 done by the <command>nice</command> command: a negative |
619 <value>number</value> | 619 <value>number</value> |
620 means higher priority. | 620 means higher priority. |
621 Allowed range normally varies from -20 to 20. | 621 Allowed range normally varies from -20 to 20. |
622 </para> | 622 </para> |
642 | 642 |
643 <para> | 643 <para> |
644 The optimal value depends on many factors including (but not | 644 The optimal value depends on many factors including (but not |
645 limited to) the number of CPU cores, the number of hard disk | 645 limited to) the number of CPU cores, the number of hard disk |
646 drives that store data, and load pattern. | 646 drives that store data, and load pattern. |
647 When in doubt, setting it to the number of available CPU cores | 647 When one is in doubt, setting it to the number of available CPU cores |
648 would be a good start (the value “<literal>auto</literal>” | 648 would be a good start (the value “<literal>auto</literal>” |
649 will try to autodetect it). | 649 will try to autodetect it). |
650 <note> | 650 <note> |
651 The <literal>auto</literal> parameter is supported starting from | 651 The <literal>auto</literal> parameter is supported starting from |
652 versions 1.3.8 and 1.2.5. | 652 versions 1.3.8 and 1.2.5. |
704 <syntax><value>directory</value></syntax> | 704 <syntax><value>directory</value></syntax> |
705 <default/> | 705 <default/> |
706 <context>main</context> | 706 <context>main</context> |
707 | 707 |
708 <para> | 708 <para> |
709 Defines a current working directory for a worker process. | 709 Defines the current working directory for a worker process. |
710 It is primarily used when writing a core-file, in which case | 710 It is primarily used when writing a core-file, in which case |
711 a worker process should have write permission for the | 711 a worker process should have write permission for the |
712 specified directory. | 712 specified directory. |
713 </para> | 713 </para> |
714 | 714 |