changeset 215:abb48e50ff7f

Translated the "Setting Up Hashes" article into English.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 30 Nov 2011 09:20:55 +0000
parents c99c8df86eb9
children 951c1810c00f
files xml/en/GNUmakefile xml/en/docs/hash.xml
diffstat 2 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/GNUmakefile
+++ b/xml/en/GNUmakefile
@@ -6,6 +6,7 @@ DOCS =									\
 		faq							\
 		windows							\
 		control							\
+		hash							\
 
 DOCS_XML =	$(foreach name, $(DOCS), xml/$(LANG)/docs/$(name).xml)
 DOCS_HTML =	$(foreach name, $(DOCS), $(OUT)/$(LANG)/docs/$(name).html)
new file mode 100644
--- /dev/null
+++ b/xml/en/docs/hash.xml
@@ -0,0 +1,42 @@
+<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
+
+<article name="Setting Up Hashes"
+         link="/en/docs/hash.html"
+         lang="en">
+
+<section>
+
+<para>
+To quickly process static sets of data such as server names,
+map directive's values, mime-types, names of request header strings,
+nginx uses hash tables.
+During the start and each re-configuration nginx picks out
+minimally possible sizes of hash tables such that the bucket size
+that stores keys with identical hash values does not exceed the
+configured parameter (hash bucket size).
+The size of the table is expressed in buckets.
+The adjustment is continued until the table size exceeds the
+hash max size parameter.
+Most hashes have the corresponding directives that allow to change
+these parameters, for example, for the server names hash they are
+<link doc="http/ngx_http_core_module.xml" id="server_names_hash_max_size"/>
+and <link doc="http/ngx_http_core_module.xml" id="server_names_hash_bucket_size"/>.
+</para>
+
+<para>
+The hash bucket size parameter is aligned to the size that is a
+multiple of the processor's cache line size.  This speeds up
+key search in a hash on modern processors by reducing the number
+of memory accesses.
+If hash bucket size is equal to one processor's cache line size
+then the number of memory accesses during the key search will be
+two in the worst case&mdash;first to compute the bucket address,
+and second during the key search inside the bucket.
+Therefore, if nginx emits the message requesting to increase
+either hash max size or hash bucket size then the first parameter
+should first be increased.
+</para>
+
+</section>
+
+</article>