changeset 1230:6cc809881694

Upstream: added the "hash" directive.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 17 Jun 2014 17:05:37 +0400
parents 7dd620e507c3
children 270d59722694
files xml/en/docs/http/ngx_http_upstream_module.xml xml/ru/docs/http/ngx_http_upstream_module.xml
diffstat 2 files changed, 68 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_upstream_module.xml	Tue Jun 17 17:22:10 2014 +0400
+++ b/xml/en/docs/http/ngx_http_upstream_module.xml	Tue Jun 17 17:05:37 2014 +0400
@@ -10,7 +10,7 @@
 <module name="Module ngx_http_upstream_module"
         link="/en/docs/http/ngx_http_upstream_module.html"
         lang="en"
-        rev="23">
+        rev="24">
 
 <section id="summary">
 
@@ -298,6 +298,39 @@
 </directive>
 
 
+<directive name="hash">
+<syntax><value>key</value> [<literal>consistent</literal>]</syntax>
+<default/>
+<context>upstream</context>
+<appeared-in>1.7.2</appeared-in>
+
+<para>
+Specifies a load balancing method for a server group
+where client-server mapping is based on the hashed <value>key</value> value.
+The <value>key</value> can contain text, variables, and their combinations.
+Note that adding or removing a server from the group
+may result in remapping most of the keys to different servers.
+The method is compatible with the
+<link url="http://search.cpan.org/perldoc?Cache%3A%3AMemcached">Cache::Memcached</link>
+Perl library.
+</para>
+
+<para>
+The <literal>consistent</literal> parameter specifies that
+the <link url="http://www.last.fm/user/RJ/journal/2007/04/10/392555/">ketama</link>
+consistent hashing method should be used instead.
+The method ensures that only a few keys
+will be remapped to different servers
+when a server is added to or removed from the group.
+This helps to achieve a higher cache hit ratio for caching servers.
+The method is compatible with the
+<link url="http://search.cpan.org/perldoc?Cache%3A%3AMemcached%3A%3AFast">Cache::Memcached::Fast</link>
+Perl library with the <value>ketama_points</value> parameter is set to 160.
+</para>
+
+</directive>
+
+
 <directive name="ip_hash">
 <syntax/>
 <default/>
--- a/xml/ru/docs/http/ngx_http_upstream_module.xml	Tue Jun 17 17:22:10 2014 +0400
+++ b/xml/ru/docs/http/ngx_http_upstream_module.xml	Tue Jun 17 17:05:37 2014 +0400
@@ -243,6 +243,40 @@
 </directive>
 
 
+<directive name="hash">
+<syntax><value>ключ</value> [<literal>consistent</literal>]</syntax>
+<default/>
+<context>upstream</context>
+<appeared-in>1.7.2</appeared-in>
+
+<para>
+Задаёт метод балансировки нагрузки для группы, при котором
+соответствие клиента серверу определяется при помощи
+хэшированного значения <value>ключа</value>.
+В качестве <value>ключа</value> может использоваться
+текст, переменные и их комбинации.
+Следует отметить, что любое добавление или удаление серверов в группе
+может привести к перераспределению большинства ключей на другие серверы.
+Метод совместим с библиотекой Perl
+<link url="http://search.cpan.org/perldoc?Cache%3A%3AMemcached">Cache::Memcached</link>.
+</para>
+
+<para>
+Если задан параметр <literal>consistent</literal>, то вместо
+вышеописанного метода будет использоваться метод консистентного хэширования
+<link url="http://www.last.fm/user/RJ/journal/2007/04/10/392555/">ketama</link>.
+Метод гарантирует, что при добавлении сервера в группу или его удалении
+на другие серверы будет перераспределено минимальное число ключей.
+Применение метода для кэширующих серверов обеспечивает
+больший процент попаданий в кэш.
+Метод совместим с библиотекой Perl
+<link url="http://search.cpan.org/perldoc?Cache%3A%3AMemcached%3A%3AFast">Cache::Memcached::Fast</link>
+при значении параметра <value>ketama_points</value> равным 160.
+</para>
+
+</directive>
+
+
 <directive name="ip_hash">
 <syntax/>
 <default/>