annotate xml/en/docs/hash.xml @ 3030:cd1d5312e47c

Updated with Netcraft December 2023 Web Server Survey stats.
author Yaroslav Zhuravlev <yar@nginx.com>
date Wed, 20 Dec 2023 10:42:01 +0000
parents ac131944d349
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
580
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 300
diff changeset
1 <!--
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 300
diff changeset
2 Copyright (C) Igor Sysoev
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 300
diff changeset
3 Copyright (C) Nginx, Inc.
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 300
diff changeset
4 -->
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 300
diff changeset
5
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
6 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd">
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
7
853
d1446e47d17d Unified on the look of titles.
Ruslan Ermilov <ru@nginx.com>
parents: 625
diff changeset
8 <article name="Setting up hashes"
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
9 link="/en/docs/hash.html"
589
764fbac1b8b4 Added document revision.
Ruslan Ermilov <ru@nginx.com>
parents: 580
diff changeset
10 lang="en"
764fbac1b8b4 Added document revision.
Ruslan Ermilov <ru@nginx.com>
parents: 580
diff changeset
11 rev="1">
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
12
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
13 <section>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15 <para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16 To quickly process static sets of data such as server names,
625
af3f38e349eb Removed terminal whitespace and fixed apostrophes used.
Ruslan Ermilov <ru@nginx.com>
parents: 589
diff changeset
17 <link doc="http/ngx_http_map_module.xml" id="map"/> directive’s values,
300
a1071d0d0979 Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents: 215
diff changeset
18 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
19 nginx uses hash tables.
300
a1071d0d0979 Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents: 215
diff changeset
20 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
21 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
22 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
23 configured parameter (hash bucket size).
300
a1071d0d0979 Slight markup and wording fixes.
Ruslan Ermilov <ru@nginx.com>
parents: 215
diff changeset
24 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
25 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
26 hash max size parameter.
1144
ac131944d349 Changed infinitive to gerund after "allow".
Yaroslav Zhuravlev <yar@nginx.com>
parents: 853
diff changeset
27 Most hashes have the corresponding directives that allow changing
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
28 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
29 <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
30 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
31 </para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
32
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
33 <para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 The hash bucket size parameter is aligned to the size that is a
625
af3f38e349eb Removed terminal whitespace and fixed apostrophes used.
Ruslan Ermilov <ru@nginx.com>
parents: 589
diff changeset
35 multiple of the processor’s cache line size. This speeds up
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
36 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
37 of memory accesses.
625
af3f38e349eb Removed terminal whitespace and fixed apostrophes used.
Ruslan Ermilov <ru@nginx.com>
parents: 589
diff changeset
38 If hash bucket size is equal to one processor’s cache line size
215
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
39 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
40 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
41 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
42 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
43 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
44 should first be increased.
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
45 </para>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
46
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
47 </section>
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
48
abb48e50ff7f Translated the "Setting Up Hashes" article into English.
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
49 </article>