annotate xml/en/docs/hash.xml @ 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
children a1071d0d0979
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
1 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
2
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
3 <article name="Setting Up Hashes"
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
4 link="/en/docs/hash.html"
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
5 lang="en">
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
6
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
7 <section>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
8
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
9 <para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
10 To quickly process static sets of data such as server names,
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
11 map directive's values, mime-types, names of request header strings,
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
12 nginx uses hash tables.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
13 During the start and each re-configuration nginx picks out
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14 minimally possible sizes of hash tables such that the bucket size
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15 that stores keys with identical hash values does not exceed the
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16 configured parameter (hash bucket size).
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
17 The size of the table is expressed in buckets.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
18 The adjustment is continued until the table size exceeds the
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
19 hash max size parameter.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
20 Most hashes have the corresponding directives that allow to change
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
21 these parameters, for example, for the server names hash they are
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
22 <link doc="http/ngx_http_core_module.xml" id="server_names_hash_max_size"/>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
23 and <link doc="http/ngx_http_core_module.xml" id="server_names_hash_bucket_size"/>.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
24 </para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
25
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
26 <para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
27 The hash bucket size parameter is aligned to the size that is a
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
28 multiple of the processor's cache line size. This speeds up
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
29 key search in a hash on modern processors by reducing the number
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
30 of memory accesses.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
31 If hash bucket size is equal to one processor's cache line size
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32 then the number of memory accesses during the key search will be
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
33 two in the worst case&mdash;first to compute the bucket address,
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 and second during the key search inside the bucket.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
35 Therefore, if nginx emits the message requesting to increase
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
36 either hash max size or hash bucket size then the first parameter
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
37 should first be increased.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
38 </para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
39
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
40 </section>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
42 </article>