# HG changeset patch # User Yaroslav Zhuravlev # Date 1449589995 -10800 # Node ID 9e8ec9c67cf3fd82939164efbabd2b001b8a4319 # Parent a1531068d4367d0b263a88863284ee412711c0a1 Documented ngx_http_slice_module. diff --git a/xml/en/GNUmakefile b/xml/en/GNUmakefile --- a/xml/en/GNUmakefile +++ b/xml/en/GNUmakefile @@ -71,6 +71,7 @@ REFS = \ http/ngx_http_rewrite_module \ http/ngx_http_scgi_module \ http/ngx_http_secure_link_module \ + http/ngx_http_slice_module \ http/ngx_http_spdy_module \ http/ngx_http_session_log_module \ http/ngx_http_split_clients_module \ diff --git a/xml/en/docs/http/ngx_http_slice_module.xml b/xml/en/docs/http/ngx_http_slice_module.xml new file mode 100644 --- /dev/null +++ b/xml/en/docs/http/ngx_http_slice_module.xml @@ -0,0 +1,108 @@ + + + + + + + + +
+ + +The ngx_http_slice_module module (1.9.8) is a filter +that splits a request into subrequests, +each returning a certain range of response. +The filter provides more effective caching of big responses. + + + +This module is not built by default, it should be enabled with the +--with-http_slice_module +configuration parameter. + + +
+ + +
+ + + +location / { + slice 1m; + proxy_cache cache; + proxy_cache_key $uri$is_args$args$slice_range; + proxy_set_header Range $slice_range; + proxy_cache_valid 200 206 1h; + proxy_pass http://localhost:8000; +} + +In this example, +the response is split into 1-megabyte cacheable slices. + + +
+ + +
+ + + +size +0 +http +server +location + + +Sets the size of the slice. +The zero value disables splitting responses into slices. +Note that a too low value may result in excessive memory usage +and a large number of file descriptors. + + + +In order for a subrequest to return the required range, +the $slice_range variable should be +passed to +the proxied server as the Range request header field. +If +caching +is enabled, $slice_range should be added to the +cache key +and caching of responses with 206 status code should be +enabled. + + + + +
+ + +
+ + +The ngx_http_slice_module module +supports the following embedded variables: + + +$slice_range + +the current slice range in +HTTP +byte range format, +for example, bytes=0-1048575. + + + + + + +
+ +
diff --git a/xml/en/docs/index.xml b/xml/en/docs/index.xml --- a/xml/en/docs/index.xml +++ b/xml/en/docs/index.xml @@ -8,7 +8,7 @@
@@ -365,6 +365,11 @@ ngx_http_session_log_module + +ngx_http_slice_module + + + ngx_http_spdy_module diff --git a/xml/ru/GNUmakefile b/xml/ru/GNUmakefile --- a/xml/ru/GNUmakefile +++ b/xml/ru/GNUmakefile @@ -62,6 +62,7 @@ REFS = \ http/ngx_http_rewrite_module \ http/ngx_http_scgi_module \ http/ngx_http_secure_link_module \ + http/ngx_http_slice_module \ http/ngx_http_spdy_module \ http/ngx_http_split_clients_module \ http/ngx_http_ssi_module \ diff --git a/xml/ru/docs/http/ngx_http_slice_module.xml b/xml/ru/docs/http/ngx_http_slice_module.xml new file mode 100644 --- /dev/null +++ b/xml/ru/docs/http/ngx_http_slice_module.xml @@ -0,0 +1,107 @@ + + + + + + + + +
+ + +Модуль ngx_http_slice_module (1.9.8) — это фильтр, +который разбивает запрос на подзапросы, +каждый из которых возвращает определённый диапазон ответа. +Фильтр обеспечивает более эффективное кэширование больших ответов. + + + +По умолчанию этот модуль не собирается, его сборку необходимо +разрешить с помощью конфигурационного параметра +--with-http_slice_module. + + +
+ + +
+ + + +location / { + slice 1m; + proxy_cache cache; + proxy_cache_key $uri$is_args$args$slice_range; + proxy_set_header Range $slice_range; + proxy_cache_valid 200 206 1h; + proxy_pass http://localhost:8000; +} + +В данном примере +ответ разбивается на кэшируемые фрагменты размером в 1 мегабайт. + +
+ + +
+ + +размер +0 +http +server +location + + +Задаёт размер фрагмента. +Нулевое значение запрещает разбиение ответов на фрагменты. +Обратите внимание, что слишком низкое значение может привести +к излишнему потреблению памяти +и открытию большого количества открытых файловых дескрипторов. + + + +Для того, чтобы подзапрос вернул необходимый диапазон, +переменная $slice_range должна быть +передана на +проксируемый сервер в качестве поля Range заголовка запроса. +Если включено +кэширование, +то необходимо добавить $slice_range в +ключ +кэширования +и включить +кэширование ответов с кодом 206. + + + + +
+ + +
+ + +Модуль ngx_http_slice_module +поддерживает следующие встроенные переменные: + + +$slice_range + +текущий диапазон фрагмента в формате +HTTP +byte range, +например bytes=0-1048575. + + + + + +
+ +
diff --git a/xml/ru/docs/index.xml b/xml/ru/docs/index.xml --- a/xml/ru/docs/index.xml +++ b/xml/ru/docs/index.xml @@ -8,7 +8,7 @@
@@ -369,6 +369,11 @@ ngx_http_session_log_module [en] + +ngx_http_slice_module + + + ngx_http_spdy_module