Mercurial > hg > nginx-site
changeset 1430:0eb8e261f349
AIO: clarified the use of both AIO and sendfile on Linux.
While here, commented out a note about using AIO module on
older versions of FreeBSD.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 05 Mar 2015 18:56:18 +0300 |
parents | 06322891b4e3 |
children | c4ca69d3e552 |
files | xml/en/docs/http/ngx_http_core_module.xml xml/ru/docs/http/ngx_http_core_module.xml |
diffstat | 2 files changed, 40 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_core_module.xml Sat Feb 28 00:31:18 2015 +0300 +++ b/xml/en/docs/http/ngx_http_core_module.xml Thu Mar 05 18:56:18 2015 +0300 @@ -10,7 +10,7 @@ <module name="Module ngx_http_core_module" link="/en/docs/http/ngx_http_core_module.html" lang="en" - rev="36"> + rev="37"> <section id="directives" name="Directives"> @@ -42,6 +42,7 @@ </example> </para> +<!-- <para> In FreeBSD versions 5 and 6, enabling AIO statically, or dynamically when booting the kernel, will cause the entire networking subsystem @@ -69,15 +70,16 @@ However, since nginx uses AIO only for disk I/O, no problems should arise. </note> </para> +--> <para> -For AIO to work, +For AIO to work on FreeBSD, <link id="sendfile"/> needs to be disabled: <example> location /video/ { + aio on; sendfile off; - aio on; output_buffers 1 64k; } </example> @@ -126,11 +128,21 @@ The same holds true for byte range requests and for FLV requests not from the beginning of a file: reading of unaligned data at the beginning and end of a file will be blocking. -There is no need to turn off -<link id="sendfile"/> -explicitly, as it is turned off automatically when -<link id="directio"/> -is used. +</para> + +<para> +When both AIO and <link id="sendfile"/> are enabled on Linux, +AIO is used for files that are larger than or equal to +the size specified in the <link id="directio"/> directive, +while <link id="sendfile"/> is used for files of smaller sizes +or when <link id="directio"/> is disabled. +<example> +location /video/ { + sendfile on; + aio on; + directio 8m; +} +</example> </para> </directive>
--- a/xml/ru/docs/http/ngx_http_core_module.xml Sat Feb 28 00:31:18 2015 +0300 +++ b/xml/ru/docs/http/ngx_http_core_module.xml Thu Mar 05 18:56:18 2015 +0300 @@ -10,7 +10,7 @@ <module name="Модуль ngx_http_core_module" link="/ru/docs/http/ngx_http_core_module.html" lang="ru" - rev="36"> + rev="37"> <section id="directives" name="Директивы"> @@ -42,6 +42,7 @@ </example> </para> +<!-- <para> В версиях FreeBSD 5 и 6 включение AIO статически или динамически на стадии загрузки ядра приводит к тому, что вся сетевая подсистема @@ -69,14 +70,15 @@ то проблем не возникает. </note> </para> +--> <para> -Для работы AIO нужно выключить +Для работы AIO на FreeBSD нужно выключить <link id="sendfile"/>: <example> location /video/ { + aio on; sendfile off; - aio on; output_buffers 1 64k; } </example> @@ -125,11 +127,21 @@ То же относится к запросам с указанием диапазона запрашиваемых байт (byte-range requests) и к запросам FLV не с начала файла: чтение невыравненных начала и конца ответа будет блокирующимся. -Явно выключать -<link id="sendfile"/> -не нужно, так как при использовании -<link id="directio"/> -он выключается автоматически. +</para> + +<para> +При одновременном включении AIO и <link id="sendfile"/> в Linux +для файлов, размер которых больше либо равен указанному +в директиве <link id="directio"/>, будет использоваться AIO, +а для файлов меньшего размера +или при выключенном <link id="directio"/> — <link id="sendfile"/>: +<example> +location /video/ { + sendfile on; + aio on; + directio 8m; +} +</example> </para> </directive>