# HG changeset patch # User Ruslan Ermilov # Date 1322644855 0 # Node ID abb48e50ff7fe9807c137ec49faa0262de5573bf # Parent c99c8df86eb9dafe3ce4774cfd3dcd2a8e1bdfa7 Translated the "Setting Up Hashes" article into English. diff --git a/xml/en/GNUmakefile b/xml/en/GNUmakefile --- 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) diff --git a/xml/en/docs/hash.xml b/xml/en/docs/hash.xml new file mode 100644 --- /dev/null +++ b/xml/en/docs/hash.xml @@ -0,0 +1,42 @@ + + +
+ +
+ + +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 + +and . + + + +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—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. + + +
+ +