annotate xml/en/docs/stream/ngx_stream_split_clients_module.xml @ 1759:42d2806f5b28

Updated example in ngx_stream_split_clients_module with variables.
author Yaroslav Zhuravlev <yar@nginx.com>
date Wed, 03 Aug 2016 14:20:50 +0300
parents b4de612feff8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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) Nginx, Inc.
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 466
diff changeset
5 -->
be54c443235a Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents: 466
diff changeset
6
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
7 <!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
8
1752
b4de612feff8 Documented the split_clients module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 966
diff changeset
9 <module name="Module ngx_stream_split_clients_module"
b4de612feff8 Documented the split_clients module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 966
diff changeset
10 link="/en/docs/stream/ngx_stream_split_clients_module.html"
589
764fbac1b8b4 Added document revision.
Ruslan Ermilov <ru@nginx.com>
parents: 580
diff changeset
11 lang="en"
1759
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
12 rev="2">
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
13
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
14 <section id="summary">
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
15
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
16 <para>
1752
b4de612feff8 Documented the split_clients module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 966
diff changeset
17 The <literal>ngx_stream_split_clients_module</literal> module (1.11.3) creates
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
18 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
19 </para>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
20
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
21 </section>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
22
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 <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
25
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
26 <para>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
27 <example>
1752
b4de612feff8 Documented the split_clients module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 966
diff changeset
28 stream {
1759
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
29 ...
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
30 split_clients "${remote_addr}AAA" $upstream {
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
31 0.5% feature_test1;
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
32 2.0% feature_test2;
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
33 * production;
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
34 }
1759
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
35
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
36 server {
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
37 ...
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
38 proxy_pass $upstream;
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
39 }
42d2806f5b28 Updated example in ngx_stream_split_clients_module with variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 1752
diff changeset
40 }
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
41 </example>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
42 </para>
364
bb51d3e17dd0 Style fixed.
Ruslan Ermilov <ru@nginx.com>
parents: 348
diff changeset
43
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
44 </section>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
45
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 <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
48
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
49 <directive name="split_clients">
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
50 <syntax block="yes">
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
51 <value>string</value>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
52 <value>$variable</value></syntax>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
53 <default/>
1752
b4de612feff8 Documented the split_clients module in stream.
Yaroslav Zhuravlev <yar@nginx.com>
parents: 966
diff changeset
54 <context>stream</context>
348
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
55
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
56 <para>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
57 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
58 <example>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
59 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
60 0.5% .one;
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
61 2.0% .two;
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
62 * "";
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
63 }
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
64 </example>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
65 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
66 In the example given, hash values from 0 to 21474835 (0.5%)
966
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 775
diff changeset
67 correspond to the
95c3c3bbf1ce Text review.
Egor Nikitin <yegor.nikitin@gmail.com>
parents: 775
diff changeset
68 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
69 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
70 the value <literal>".two"</literal>,
466
74736c333906 Corrected boundaries of the example ranges.
Ruslan Ermilov <ru@nginx.com>
parents: 367
diff changeset
71 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
72 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
73 </para>
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 </directive>
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 </section>
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
78
5a848934a12d English translation of ngx_http_geoip_module, ngx_http_map_module,
Ruslan Ermilov <ru@nginx.com>
parents:
diff changeset
79 </module>