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