changeset 571:71d775bef043

Documented accept_mutex, accept_mutex_delay, multi_accept, and lock_file.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 05 Jul 2012 13:13:45 +0000
parents 9a5b1a63f654
children 17ceffcc7ffb
files xml/en/docs/ngx_core_module.xml xml/ru/docs/ngx_core_module.xml
diffstat 2 files changed, 156 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/ngx_core_module.xml
+++ b/xml/en/docs/ngx_core_module.xml
@@ -29,6 +29,42 @@ events {
 
 <section id="directives" name="Directives">
 
+<directive name="accept_mutex">
+<syntax><literal>on</literal> | <literal>off</literal></syntax>
+<default>on</default>
+<context>events</context>
+
+<para>
+If enabled,
+accepts of new connections by multiple worker processes will be serialized.
+Otherwise, all worker processes will be notified about new connections,
+and if volume of new connections is low, some of the worker processes
+may just waste system resources.
+<note>
+The use of <link doc="events.xml" id="rtsig"/>
+connection processing method
+requires <literal>accept_mutex</literal> to be enabled.
+</note>
+</para>
+
+</directive>
+
+
+<directive name="accept_mutex_delay">
+<syntax><value>time</value></syntax>
+<default>500ms</default>
+<context>events</context>
+
+<para>
+If <link id="accept_mutex"/> is enabled, specifies the maximum time
+during which a worker process will try to restart accepting new
+connections if another worker process is already doing this
+currently.
+</para>
+
+</directive>
+
+
 <directive name="daemon">
 <syntax><literal>on</literal> | <literal>off</literal></syntax>
 <default>on</default>
@@ -224,6 +260,23 @@ include vhosts/*.conf;
 </directive>
 
 
+<directive name="lock_file">
+<syntax><value>file</value></syntax>
+<default>logs/nginx.lock</default>
+<context>main</context>
+
+<para>
+nginx uses the locking mechanism to implement <link id="accept_mutex"/>
+and serialize accesses to shared memory.
+On most systems the locks are implemented using atomic operations,
+and this directive is ignored.
+On other systems the “lock file” mechanism is used.
+This directive specifies a prefix for the names of lock files.
+</para>
+
+</directive>
+
+
 <directive name="master_process">
 <syntax><literal>on</literal> | <literal>off</literal></syntax>
 <default>on</default>
@@ -237,6 +290,31 @@ This directive is intended for nginx dev
 </directive>
 
 
+<directive name="multi_accept">
+<syntax><literal>on</literal> | <literal>off</literal></syntax>
+<default>off</default>
+<context>events</context>
+
+<para>
+If disabled, a worker process
+will accept one new connection at a time.
+Otherwise, a worker process
+will accept all new connections at a time.
+<note>
+The directive is ignored if <link doc="events.xml" id="kqueue"/>
+connection processing method is used because it can report
+the number of new connections waiting to be accepted.
+</note>
+<note>
+The use of <link doc="events.xml" id="rtsig"/>
+connection processing method
+automatically enables <literal>multi_accept</literal>.
+</note>
+</para>
+
+</directive>
+
+
 <directive name="pcre_jit">
 <syntax><literal>on</literal> | <literal>off</literal></syntax>
 <default>off</default>
--- a/xml/ru/docs/ngx_core_module.xml
+++ b/xml/ru/docs/ngx_core_module.xml
@@ -29,6 +29,42 @@ events {
 
 <section id="directives" name="Директивы">
 
+<directive name="accept_mutex">
+<syntax><literal>on</literal> | <literal>off</literal></syntax>
+<default>on</default>
+<context>events</context>
+
+<para>
+Если <literal>accept_mutex</literal> включён,
+рабочие процессы будут принимать новые соединения по очереди.
+В противном случае о новых соединениях будет сообщаться сразу всем рабочим
+процессам, и при низкой интенсивности поступления новых соединений
+часть рабочих процессов может работать вхолостую.
+<note>
+Использование метода обработки соединений
+<link doc="events.xml" id="rtsig"/>
+требует обязательного включения <literal>accept_mutex</literal>.
+</note>
+</para>
+
+</directive>
+
+
+<directive name="accept_mutex_delay">
+<syntax><value>время</value></syntax>
+<default>500ms</default>
+<context>events</context>
+
+<para>
+При включённом <link id="accept_mutex"/> задаёт максимальное время,
+в течение которого рабочий процесс вновь попытается начать принимать
+новые соединения, если в настоящий момент этим уже занимается другой
+рабочий процесс.
+</para>
+
+</directive>
+
+
 <directive name="daemon">
 <syntax><literal>on</literal> | <literal>off</literal></syntax>
 <default>on</default>
@@ -220,6 +256,23 @@ include vhosts/*.conf;
 </directive>
 
 
+<directive name="lock_file">
+<syntax><value>файл</value></syntax>
+<default>logs/nginx.lock</default>
+<context>main</context>
+
+<para>
+Для реализации <link id="accept_mutex"/> и сериализации доступа к
+разделяемой памяти nginx использует механизм блокировок.
+На большинстве систем блокировки реализованы с помощью атомарных
+операций, и эта директива игнорируется.
+Для остальных систем применяется механизм файлов блокировок.
+Эта директива задаёт префикс имён файлов блокировок.
+</para>
+
+</directive>
+
+
 <directive name="master_process">
 <syntax><literal>on</literal> | <literal>off</literal></syntax>
 <default>on</default>
@@ -233,6 +286,31 @@ include vhosts/*.conf;
 </directive>
 
 
+<directive name="multi_accept">
+<syntax><literal>on</literal> | <literal>off</literal></syntax>
+<default>off</default>
+<context>events</context>
+
+<para>
+Если <literal>multi_accept</literal> выключен, рабочий процесс
+за один раз будет принимать только одно новое соединение.
+В противном случае рабочий процесс
+за один раз будет принимать сразу все новые соединения.
+<note>
+Директива игнорируется в случае использования метода обработки соединений
+<link doc="events.xml" id="kqueue"/>, т.к. данный метод сам сообщает
+число новых соединений, ожидающих приёма.
+</note>
+<note>
+Использование метода обработки соединений
+<link doc="events.xml" id="rtsig"/>
+автоматически включает <literal>multi_accept</literal>.
+</note>
+</para>
+
+</directive>
+
+
 <directive name="pcre_jit">
 <syntax><literal>on</literal> | <literal>off</literal></syntax>
 <default>off</default>