Mercurial > hg > nginx-site
annotate xml/en/docs/hash.xml @ 334:e2e081ddd7a7
New donor added.
author | Maxim Konovalov <maxim@nginx.com> |
---|---|
date | Fri, 20 Jan 2012 10:29:05 +0000 |
parents | a1071d0d0979 |
children | be54c443235a |
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, |
300
a1071d0d0979
Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents:
215
diff
changeset
|
11 <link doc="http/ngx_http_map_module.xml" id="map"/> directive's values, |
a1071d0d0979
Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents:
215
diff
changeset
|
12 MIME types, names of request header strings, |
215
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 nginx uses hash tables. |
300
a1071d0d0979
Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents:
215
diff
changeset
|
14 During the start and each re-configuration nginx selects the |
a1071d0d0979
Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents:
215
diff
changeset
|
15 minimum possible sizes of hash tables such that the bucket size |
215
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 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
|
17 configured parameter (hash bucket size). |
300
a1071d0d0979
Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents:
215
diff
changeset
|
18 The size of a table is expressed in buckets. |
215
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 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
|
20 hash max size parameter. |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 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
|
22 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
|
23 <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
|
24 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
|
25 </para> |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 <para> |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 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
|
29 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
|
30 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
|
31 of memory accesses. |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 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
|
33 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
|
34 two in the worst case—first to compute the bucket address, |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 should first be increased. |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 </para> |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 </section> |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 |
abb48e50ff7f
Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 </article> |