Mercurial > hg > nginx-site
annotate xml/en/docs/http/ngx_http_split_clients_module.xml @ 2778:9cafae0b7ef3
Minor fixes in njs examples.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 14 Oct 2021 18:53:16 +0100 |
parents | 95c3c3bbf1ce |
children |
rev | line source |
---|---|
348
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 |
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
466
diff
changeset
|
3 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
466
diff
changeset
|
4 Copyright (C) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
466
diff
changeset
|
5 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
466
diff
changeset
|
6 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
466
diff
changeset
|
7 |
348
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 <module name="Module ngx_http_split_clients_module" |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 link="/en/docs/http/ngx_http_split_clients_module.html" |
589 | 12 lang="en" |
775
813b8349cdbe
Expanded the literal empty strings into words.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
13 rev="2"> |
348
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 <section id="summary"> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 <para> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 The <literal>ngx_http_split_clients_module</literal> module creates |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 variables suitable for A/B testing, also known as split testing. |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 </para> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 </section> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 <section id="example" name="Example Configuration"> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 <para> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 <example> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 http { |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 split_clients "${remote_addr}AAA" $variant { |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 0.5% .one; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 2.0% .two; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 * ""; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 } |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 server { |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 location / { |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 index index${variant}.html; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 </example> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 </para> |
364 | 41 |
348
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 </section> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 <section id="directives" name="Directives"> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 <directive name="split_clients"> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 <syntax block="yes"> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 <value>string</value> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 <value>$variable</value></syntax> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 <default/> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 <context>http</context> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 <para> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 Creates a variable for A/B testing, for example: |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 <example> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 split_clients "${remote_addr}AAA" $variant { |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 0.5% .one; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 2.0% .two; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 * ""; |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 } |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 </example> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 The value of the original string is hashed using MurmurHash2. |
466
74736c333906
Corrected boundaries of the example ranges.
Ruslan Ermilov <ru@nginx.com>
parents:
367
diff
changeset
|
64 In the example given, hash values from 0 to 21474835 (0.5%) |
966 | 65 correspond to the |
66 value <literal>".one"</literal> of the <var>$variant</var> variable, | |
466
74736c333906
Corrected boundaries of the example ranges.
Ruslan Ermilov <ru@nginx.com>
parents:
367
diff
changeset
|
67 hash values from 21474836 to 107374180 (2%) correspond to |
348
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 the value <literal>".two"</literal>, |
466
74736c333906
Corrected boundaries of the example ranges.
Ruslan Ermilov <ru@nginx.com>
parents:
367
diff
changeset
|
69 and hash values from 107374181 to 4294967295 correspond to |
775
813b8349cdbe
Expanded the literal empty strings into words.
Ruslan Ermilov <ru@nginx.com>
parents:
589
diff
changeset
|
70 the value <literal>""</literal> (an empty string). |
348
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 </para> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 </directive> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 </section> |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 |
5a848934a12d
English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 </module> |