This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 98a2702  Deploy to GitHub pages
98a2702 is described below

commit 98a270287daf15725f4d9853da304df67ff6a5d1
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Dec 25 09:10:21 2020 +0000

    Deploy to GitHub pages
---
 apisix/README.html                            |   1 +
 apisix/README/index.html                      |   1 +
 apisix/plugins/prometheus.html                |   9 +
 apisix/plugins/prometheus/index.html          |   9 +
 apisix/plugins/traffic-split.html             | 432 +++++++++++++++++++++++++
 apisix/plugins/traffic-split/index.html       | 432 +++++++++++++++++++++++++
 apisix/zh-cn/README.html                      |   1 +
 apisix/zh-cn/README/index.html                |   1 +
 apisix/zh-cn/plugins/prometheus.html          |  11 +-
 apisix/zh-cn/plugins/prometheus/index.html    |  11 +-
 apisix/zh-cn/plugins/traffic-split.html       | 434 ++++++++++++++++++++++++++
 apisix/zh-cn/plugins/traffic-split/index.html | 434 ++++++++++++++++++++++++++
 sitemap.xml                                   |   2 +-
 13 files changed, 1775 insertions(+), 3 deletions(-)

diff --git a/apisix/README.html b/apisix/README.html
index 01cfe94..2aabee5 100644
--- a/apisix/README.html
+++ b/apisix/README.html
@@ -86,6 +86,7 @@
 <li><a href="/apisix/plugins/request-validation">request-validation</a>: 
Validates requests before forwarding to upstream.</li>
 <li><a href="/apisix/plugins/proxy-mirror">proxy-mirror</a>: Provides the 
ability to mirror client requests.</li>
 <li><a href="/apisix/plugins/api-breaker">api-breaker</a>: Circuit Breaker for 
API that stops requests forwarding to upstream in case of unhealthy state.</li>
+<li><a href="/apisix/plugins/traffic-split">traffic-split</a>: Allows users to 
incrementally direct percentages of traffic between various upstreams.</li>
 </ul>
 <h3><a class="anchor" aria-hidden="true" id="monitoring"></a><a 
href="#monitoring" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 
[...]
 <ul>
diff --git a/apisix/README/index.html b/apisix/README/index.html
index 01cfe94..2aabee5 100644
--- a/apisix/README/index.html
+++ b/apisix/README/index.html
@@ -86,6 +86,7 @@
 <li><a href="/apisix/plugins/request-validation">request-validation</a>: 
Validates requests before forwarding to upstream.</li>
 <li><a href="/apisix/plugins/proxy-mirror">proxy-mirror</a>: Provides the 
ability to mirror client requests.</li>
 <li><a href="/apisix/plugins/api-breaker">api-breaker</a>: Circuit Breaker for 
API that stops requests forwarding to upstream in case of unhealthy state.</li>
+<li><a href="/apisix/plugins/traffic-split">traffic-split</a>: Allows users to 
incrementally direct percentages of traffic between various upstreams.</li>
 </ul>
 <h3><a class="anchor" aria-hidden="true" id="monitoring"></a><a 
href="#monitoring" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 
[...]
 <ul>
diff --git a/apisix/plugins/prometheus.html b/apisix/plugins/prometheus.html
index 28c8e95..650d77e 100644
--- a/apisix/plugins/prometheus.html
+++ b/apisix/plugins/prometheus.html
@@ -98,6 +98,7 @@ these metric data.</p>
 <li><code>Bandwidth</code>: Total Bandwidth (egress/ingress) flowing through 
apisix. This metric is available per service and as a sum across all 
services.</li>
 <li><code>etcd reachability</code>: A gauge type with a value of 0 or 1, 
representing if etcd can be reached by a apisix or not.</li>
 <li><code>Connections</code>: Various Nginx connection metrics like active, 
reading, writing, and number of accepted connections.</li>
+<li><code>Batch process entries</code>: A gauge type, when we use plugins and 
the plugin used batch process to send data, such as: sys logger, http logger, 
sls logger, tcp logger, udp logger and zipkin, then the entries which hasn't 
been sent in batch process will be counted in the metrics.</li>
 </ul>
 <p>Here is the original metric data of apisix:</p>
 <pre><code class="hljs">$ curl http://<span 
class="hljs-number">127.0</span>.<span class="hljs-number">0.2</span>:<span 
class="hljs-number">9080</span>/apisix/prometheus/metrics
@@ -109,6 +110,14 @@ apisix_bandwidth{type=<span 
class="hljs-string">"egress"</span>,service=<span cl
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"127.0.0.2"</span>} <span class="hljs-number">83</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"bar.com"</span>} <span class="hljs-number">76</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"foo.com"</span>} <span class="hljs-number">988</span>
+<span class="hljs-comment"># HELP apisix_batch_process_entries batch process 
remaining entries</span>
+<span class="hljs-comment"># TYPE apisix_batch_process_entries gauge</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"http-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sls-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"tcp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"udp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sys-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"zipkin_report"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
 <span class="hljs-comment"># HELP apisix_etcd_reachable Config server etcd 
reachable from Apisix, 0 is unreachable</span>
 <span class="hljs-comment"># TYPE apisix_etcd_reachable gauge</span>
 apisix_etcd_reachable <span class="hljs-number">1</span>
diff --git a/apisix/plugins/prometheus/index.html 
b/apisix/plugins/prometheus/index.html
index 28c8e95..650d77e 100644
--- a/apisix/plugins/prometheus/index.html
+++ b/apisix/plugins/prometheus/index.html
@@ -98,6 +98,7 @@ these metric data.</p>
 <li><code>Bandwidth</code>: Total Bandwidth (egress/ingress) flowing through 
apisix. This metric is available per service and as a sum across all 
services.</li>
 <li><code>etcd reachability</code>: A gauge type with a value of 0 or 1, 
representing if etcd can be reached by a apisix or not.</li>
 <li><code>Connections</code>: Various Nginx connection metrics like active, 
reading, writing, and number of accepted connections.</li>
+<li><code>Batch process entries</code>: A gauge type, when we use plugins and 
the plugin used batch process to send data, such as: sys logger, http logger, 
sls logger, tcp logger, udp logger and zipkin, then the entries which hasn't 
been sent in batch process will be counted in the metrics.</li>
 </ul>
 <p>Here is the original metric data of apisix:</p>
 <pre><code class="hljs">$ curl http://<span 
class="hljs-number">127.0</span>.<span class="hljs-number">0.2</span>:<span 
class="hljs-number">9080</span>/apisix/prometheus/metrics
@@ -109,6 +110,14 @@ apisix_bandwidth{type=<span 
class="hljs-string">"egress"</span>,service=<span cl
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"127.0.0.2"</span>} <span class="hljs-number">83</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"bar.com"</span>} <span class="hljs-number">76</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"foo.com"</span>} <span class="hljs-number">988</span>
+<span class="hljs-comment"># HELP apisix_batch_process_entries batch process 
remaining entries</span>
+<span class="hljs-comment"># TYPE apisix_batch_process_entries gauge</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"http-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sls-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"tcp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"udp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sys-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"zipkin_report"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
 <span class="hljs-comment"># HELP apisix_etcd_reachable Config server etcd 
reachable from Apisix, 0 is unreachable</span>
 <span class="hljs-comment"># TYPE apisix_etcd_reachable gauge</span>
 apisix_etcd_reachable <span class="hljs-number">1</span>
diff --git a/apisix/plugins/traffic-split.html 
b/apisix/plugins/traffic-split.html
new file mode 100644
index 0000000..e548a97
--- /dev/null
+++ b/apisix/plugins/traffic-split.html
@@ -0,0 +1,432 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta 
http-equiv="X-UA-Compatible" 
content="IE=edge"/><title>apisix/plugins/traffic-split · Apache 
APISIX™</title><meta name="viewport" content="width=device-width"/><meta 
name="generator" content="Docusaurus"/><meta name="description" 
content="&lt;!--"/><meta name="docsearch:language" content="en"/><meta 
property="og:title" content="apisix/plugins/traffic-split · Apache 
APISIX™"/><meta property="og:type" content="website"/><met [...]
+        document.addEventListener('DOMContentLoaded', function() {
+          addBackToTop(
+            {"zIndex":100}
+          )
+        });
+        </script><script src="/js/scrollSpy.js"></script><link 
rel="stylesheet" href="/css/main.css"/><script 
src="/js/codetabs.js"></script></head><body class="sideNavVisible 
separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper 
wrapper"><header><a href="/"><img class="logo" src="/img/logo.png" alt="Apache 
APISIX™"/><h2 class="headerTitleWithLogo">Apache APISIX™</h2></a><div 
class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul 
class="nav-site n [...]
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+<ul>
+<li><a href="/apisix/zh-cn/plugins/traffic-split">中文</a></li>
+</ul>
+<h1><a class="anchor" aria-hidden="true" id="summary"></a><a href="#summary" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<ul>
+<li><a href="#name"><strong>Name</strong></a></li>
+<li><a href="#attributes"><strong>Attributes</strong></a></li>
+<li><a href="#how-to-enable"><strong>How To Enable</strong></a></li>
+<li><a href="#example"><strong>Example</strong></a>
+<ul>
+<li><a href="#grayscale-release"><strong>Grayscale Release</strong></a></li>
+<li><a href="#blue-green-release"><strong>Blue-green Release</strong></a></li>
+<li><a href="#custom-release"><strong>Custom Release</strong></a></li>
+</ul></li>
+<li><a href="#disable-plugin"><strong>Disable Plugin</strong></a></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="name"></a><a href="#name" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>The traffic split plugin allows users to incrementally direct percentages 
of traffic between various upstreams.</p>
+<p>Note: The ratio between each upstream may not so accurate since the 
drawback of weighted round robin algorithm (especially when the wrr state is 
reset).</p>
+<h2><a class="anchor" aria-hidden="true" id="attributes"></a><a 
href="#attributes" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 
[...]
+<table>
+<thead>
+<tr><th>Name</th><th>Type</th><th>Requirement</th><th>Default</th><th>Valid</th><th>Description</th></tr>
+</thead>
+<tbody>
+<tr><td>rules.match</td><td>array[object]</td><td>optional</td><td></td><td></td><td>List
 of matching rules.</td></tr>
+<tr><td>rules.match.vars</td><td>array[array]</td><td>optional</td><td></td><td></td><td>A
 list consisting of one or more {var, operator, val} elements, like this: 
{{var, operator, val}, {var, operator, val}, ...}}. For example: 
{&quot;arg_name&quot;, &quot;==&quot;, &quot;json&quot;}, which means that the 
current request parameter name is json. The var here is consistent with the 
naming of Nginx internal variables, so request_uri, host, etc. can also be 
used; for the operator part, the  [...]
+<tr><td>rules.weighted_upstreams</td><td>array[object]</td><td>optional</td><td></td><td></td><td>List
 of upstream configuration rules.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream_id</td><td>string or 
integer</td><td>optional</td><td></td><td></td><td>The upstream id is bound to 
the corresponding upstream(not currently supported).</td></tr>
+<tr><td>rules.weighted_upstreams.upstream</td><td>object</td><td>optional</td><td></td><td></td><td>Upstream
 configuration information.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.type</td><td>enum</td><td>optional</td><td>roundrobin</td><td>[roundrobin,
 chash]</td><td>roundrobin supports weighted load, chash consistent hashing, 
the two are alternatives.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.nodes</td><td>object</td><td>optional</td><td></td><td></td><td>In
 the hash table, the key of the internal element is the list of upstream 
machine addresses, in the format of address + Port, where the address part can 
be an IP or a domain name, such as 192.168.1.100:80, foo.com:80, etc. value is 
the weight of the node. In particular, when the weight value is 0, it has 
special meaning, which usually means that the upstream node is invalid and neve 
[...]
+<tr><td>rules.weighted_upstreams.upstream.timeout</td><td>object</td><td>optional</td><td>15</td><td></td><td>Set
 the timeout period for connecting, sending and receiving messages (time unit: 
second, all default to 15 seconds).</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.pass_host</td><td>enum</td><td>optional</td><td>&quot;pass&quot;</td><td>[&quot;pass&quot;,
 &quot;node&quot;, &quot;rewrite&quot;]</td><td>pass: pass the host requested 
by the client, node: pass the host requested by the client; use the host 
configured with the upstream node, rewrite: rewrite the host with the value 
configured by the upstream_host.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.name</td><td>string</td><td>optional</td><td></td><td></td><td>Identify
 the upstream service name, usage scenario, etc.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.upstream_host</td><td>string</td><td>optional</td><td></td><td></td><td>Only
 valid when pass_host is configured as rewrite.</td></tr>
+<tr><td>rules.weighted_upstreams.weight</td><td>integer</td><td>optional</td><td>weight
 = 1</td><td></td><td>The traffic is divided according to the 
<code>weight</code> value, and the roundrobin algorithm is used to divide 
multiple <code>weight</code>.</td></tr>
+</tbody>
+</table>
+<p>The traffic-split plugin is mainly composed of two parts: 
<code>match</code> and <code>weighted_upstreams</code>. <code>match</code> is a 
custom conditional rule, and <code>weighted_upstreams</code> is upstream 
configuration information. If you configure <code>match</code> and 
<code>weighted_upstreams</code> information, then after the <code>match</code> 
rule is verified, it will be based on the <code>weight</code> value in 
<code>weighted_upstreams</code>; the ratio of traffic between [...]
+<blockquote>
+<p>Note: 1. In <code>match</code>, the expression in vars is the relationship 
of <code>and</code>, and the relationship between multiple <code>vars</code> is 
the relationship of <code>or</code>.  2. There is only a <code>weight</code> 
value in the weighted_upstreams of the plug-in, which means reaching the 
upstream traffic weight value configured on <code>route</code> or 
<code>service</code>. Such as:</p>
+</blockquote>
+<pre><code class="hljs css language-json">{
+    <span class="hljs-attr">"weight"</span>: <span class="hljs-number">2</span>
+}
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="how-to-enable"></a><a 
href="#how-to-enable" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>Create a route and enable the <code>traffic-split</code> plugin:</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 1
+                        },
+                        {
+                            "weight": 1
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="example"></a><a href="#example" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<h3><a class="anchor" aria-hidden="true" id="grayscale-release"></a><a 
href="#grayscale-release" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>The <code>match</code> rule part is missing, and the traffic is split 
according to the <code>weight</code> value configured by the 
<code>weighted_upstreams</code> in the plugin. Divide <code>plug-in 
upstream</code> and <code>route's upstream</code> according to the traffic 
ratio of 3:2, of which 60% of the traffic reaches the upstream of the 
<code>1981</code> port in the plugin, and 40% of the traffic reaches the 
default <code>1980</code> port on the route Upstream.</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>Test plugin:</strong></p>
+<p>There are 5 requests, 3 requests hit the upstream of port 1981 of the 
plug-in, and 2 requests hit the upstream of port 1980 of <code>route</code>.</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+hello 1980
+<span class="hljs-meta">
+$</span><span class="bash"> curl http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+world 1981
+
+......
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="blue-green-release"></a><a 
href="#blue-green-release" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
+<p>Get the <code>match</code> rule parameter through the request header (you 
can also get it through the request parameter or NGINX variable). After the 
<code>match</code> rule is matched, it means that all requests hit the upstream 
configured by the plugin, otherwise the request only hits the 
<code>route</code> configured upstream.</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["http_release","==","new_release"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            }
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>Test plugin:</strong></p>
+<p>The rule of <code>match</code> is matched, and all requests hit the 
upstream port 1981 configured by the plugin:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: new_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p>The <code>match</code> rule fails to match, and all requests hit the 1980 
port upstream configured on the <code>route</code>:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: old_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="custom-release"></a><a 
href="#custom-release" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>Multiple <code>vars</code> rules can be set in <code>match</code>. Multiple 
expressions in <code>vars</code> have an <code>add</code> relationship, and 
multiple <code>vars</code> rules have an <code>or</code> relationship; as long 
as one of the vars is required If the rule passes, the entire 
<code>match</code> passes.</p>
+<p><strong>Example 1: Only one <code>vars</code> rule is configured, and 
multiple expressions in <code>vars</code> are in the relationship of 
<code>add</code>. In <code>weighted_upstreams</code>, the traffic is divided 
into 3:2 according to the value of <code>weight</code>, of which only the part 
of the <code>weight</code> value represents the proportion of upstream on the 
<code>route</code>. When <code>match</code> fails to pass, all traffic will 
only hit the upstream on the route.</str [...]
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>The plugin sets the requested <code>match</code> rule and upstream with 
port <code>1981</code>, and the route has upstream with port 
<code>1980</code>.</p>
+<p><strong>Test plugin:</strong></p>
+<blockquote>
+<ol>
+<li>After the verification of the <code>match</code> rule is passed, 60% of 
the requests hit the upstream of the plug-in port 1981, and 40% of the requests 
hit the upstream of the 1980 port of the <code>route</code>.</li>
+</ol>
+</blockquote>
+<p>The match rule is successfully verified, and the upstream port of 
<code>1981</code> is hit.</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p>The match rule fails to verify, and it hits the upstream of the default 
port of <code>1980</code>.</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>After 5 requests, the service of port <code>1981</code> was hit 3 times, 
and the service of port <code>1980</code> was hit 2 times.</p>
+<p><strong>Example 2: Configure multiple <code>vars</code> rules. Multiple 
expressions in <code>vars</code> are <code>add</code> relationships, and 
multiple <code>vars</code> are <code>and</code> relationships. According to the 
<code>weight</code> value in <code>weighted_upstreams</code>, the traffic is 
divided into 3:2, where only the part of the <code>weight</code> value 
represents the proportion of upstream on the route. When <code>match</code> 
fails to pass, all traffic will only hit [...]
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ],
+                            "vars": [
+                                ["arg_name2","==","rose"],
+                                ["http_user-id2","!","&gt;","33"],
+                                ["http_apisix-key2","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>The plugin sets the requested <code>match</code> rule and the upstream port 
of <code>1981</code>, and the route has upstream port of <code>1980</code>.</p>
+<p><strong>Test plugin:</strong></p>
+<blockquote>
+<ol>
+<li>The expressions of the two <code>vars</code> are matched successfully. 
After the <code>match</code> rule is verified, 60% of the requests hit the 1981 
port upstream of the plugin, and 40% of the requests hit the 1980 port upstream 
of the <code>route</code>.</li>
+</ol>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>After 5 requests, the service of port <code>1981</code> was hit 3 times, 
and the service of port <code>1980</code> was hit 2 times.</p>
+<blockquote>
+<ol start="2">
+<li>The second expression of <code>vars</code> failed to match (missing the 
<code>name2</code> request parameter). After the <code>match</code> rule was 
verified, 60% of the requests hit the plug-in's 1981 port upstream, and 40% of 
the request traffic hits Go upstream to the 1980 port of 
<code>route</code>.</li>
+</ol>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>After 5 requests, the service of port <code>1981</code> was hit 3 times, 
and the service of port <code>1980</code> was hit 2 times.</p>
+<blockquote>
+<ol start="3">
+<li>The expression verification of two <code>vars</code> failed (missing the 
request parameters of <code>name</code> and <code>name2</code>), the 
<code>match</code> rule verification failed, and the response is the upstream 
data <code>hello 1980</code> of the default <code>route</code>.</li>
+</ol>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="disable-plugin"></a><a 
href="#disable-plugin" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>When you want to remove the traffic-split plugin, it's very simple, just 
delete the corresponding json configuration in the plugin configuration, no 
need to restart the service, it will take effect immediately:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H <span 
class="hljs-string">'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'</span> -X PUT 
-d <span class="hljs-string">'</span></span>
+{
+    "uri": "/index.html",
+    "plugins": {},
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav 
class="onPageNav"><ul class="toc-headings"><li><a 
href="#name">Name</a></li><li><a href="#attributes">Attributes</a></li><li><a 
href="#how-to-enable">How To Enable</a></li><li><a 
href="#example">Example</a><ul class="toc-headings"><li><a 
href="#grayscale-release">Grayscale Release</a></li><li><a 
href="#blue-green-release">Blue-green Release</a></li><li><a 
href="#custom-release">Custom Release</a></li></ul></li [...]
+                document.addEventListener('keyup', function(e) {
+                  if (e.target !== document.body) {
+                    return;
+                  }
+                  // keyCode for '/' (slash)
+                  if (e.keyCode === 191) {
+                    const search = 
document.getElementById('search_input_react');
+                    search && search.focus();
+                  }
+                });
+              </script><script>
+              var search = docsearch({
+                appId: 'ZHVP417Y1Y',
+                apiKey: '79e72fedcf3719ba85c552f710ade8a3',
+                indexName: 'apache-apisix-website',
+                inputSelector: '#search_input_react'
+              });
+            </script></body></html>
\ No newline at end of file
diff --git a/apisix/plugins/traffic-split/index.html 
b/apisix/plugins/traffic-split/index.html
new file mode 100644
index 0000000..e548a97
--- /dev/null
+++ b/apisix/plugins/traffic-split/index.html
@@ -0,0 +1,432 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta 
http-equiv="X-UA-Compatible" 
content="IE=edge"/><title>apisix/plugins/traffic-split · Apache 
APISIX™</title><meta name="viewport" content="width=device-width"/><meta 
name="generator" content="Docusaurus"/><meta name="description" 
content="&lt;!--"/><meta name="docsearch:language" content="en"/><meta 
property="og:title" content="apisix/plugins/traffic-split · Apache 
APISIX™"/><meta property="og:type" content="website"/><met [...]
+        document.addEventListener('DOMContentLoaded', function() {
+          addBackToTop(
+            {"zIndex":100}
+          )
+        });
+        </script><script src="/js/scrollSpy.js"></script><link 
rel="stylesheet" href="/css/main.css"/><script 
src="/js/codetabs.js"></script></head><body class="sideNavVisible 
separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper 
wrapper"><header><a href="/"><img class="logo" src="/img/logo.png" alt="Apache 
APISIX™"/><h2 class="headerTitleWithLogo">Apache APISIX™</h2></a><div 
class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul 
class="nav-site n [...]
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+<ul>
+<li><a href="/apisix/zh-cn/plugins/traffic-split">中文</a></li>
+</ul>
+<h1><a class="anchor" aria-hidden="true" id="summary"></a><a href="#summary" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<ul>
+<li><a href="#name"><strong>Name</strong></a></li>
+<li><a href="#attributes"><strong>Attributes</strong></a></li>
+<li><a href="#how-to-enable"><strong>How To Enable</strong></a></li>
+<li><a href="#example"><strong>Example</strong></a>
+<ul>
+<li><a href="#grayscale-release"><strong>Grayscale Release</strong></a></li>
+<li><a href="#blue-green-release"><strong>Blue-green Release</strong></a></li>
+<li><a href="#custom-release"><strong>Custom Release</strong></a></li>
+</ul></li>
+<li><a href="#disable-plugin"><strong>Disable Plugin</strong></a></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="name"></a><a href="#name" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>The traffic split plugin allows users to incrementally direct percentages 
of traffic between various upstreams.</p>
+<p>Note: The ratio between each upstream may not so accurate since the 
drawback of weighted round robin algorithm (especially when the wrr state is 
reset).</p>
+<h2><a class="anchor" aria-hidden="true" id="attributes"></a><a 
href="#attributes" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 
[...]
+<table>
+<thead>
+<tr><th>Name</th><th>Type</th><th>Requirement</th><th>Default</th><th>Valid</th><th>Description</th></tr>
+</thead>
+<tbody>
+<tr><td>rules.match</td><td>array[object]</td><td>optional</td><td></td><td></td><td>List
 of matching rules.</td></tr>
+<tr><td>rules.match.vars</td><td>array[array]</td><td>optional</td><td></td><td></td><td>A
 list consisting of one or more {var, operator, val} elements, like this: 
{{var, operator, val}, {var, operator, val}, ...}}. For example: 
{&quot;arg_name&quot;, &quot;==&quot;, &quot;json&quot;}, which means that the 
current request parameter name is json. The var here is consistent with the 
naming of Nginx internal variables, so request_uri, host, etc. can also be 
used; for the operator part, the  [...]
+<tr><td>rules.weighted_upstreams</td><td>array[object]</td><td>optional</td><td></td><td></td><td>List
 of upstream configuration rules.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream_id</td><td>string or 
integer</td><td>optional</td><td></td><td></td><td>The upstream id is bound to 
the corresponding upstream(not currently supported).</td></tr>
+<tr><td>rules.weighted_upstreams.upstream</td><td>object</td><td>optional</td><td></td><td></td><td>Upstream
 configuration information.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.type</td><td>enum</td><td>optional</td><td>roundrobin</td><td>[roundrobin,
 chash]</td><td>roundrobin supports weighted load, chash consistent hashing, 
the two are alternatives.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.nodes</td><td>object</td><td>optional</td><td></td><td></td><td>In
 the hash table, the key of the internal element is the list of upstream 
machine addresses, in the format of address + Port, where the address part can 
be an IP or a domain name, such as 192.168.1.100:80, foo.com:80, etc. value is 
the weight of the node. In particular, when the weight value is 0, it has 
special meaning, which usually means that the upstream node is invalid and neve 
[...]
+<tr><td>rules.weighted_upstreams.upstream.timeout</td><td>object</td><td>optional</td><td>15</td><td></td><td>Set
 the timeout period for connecting, sending and receiving messages (time unit: 
second, all default to 15 seconds).</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.pass_host</td><td>enum</td><td>optional</td><td>&quot;pass&quot;</td><td>[&quot;pass&quot;,
 &quot;node&quot;, &quot;rewrite&quot;]</td><td>pass: pass the host requested 
by the client, node: pass the host requested by the client; use the host 
configured with the upstream node, rewrite: rewrite the host with the value 
configured by the upstream_host.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.name</td><td>string</td><td>optional</td><td></td><td></td><td>Identify
 the upstream service name, usage scenario, etc.</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.upstream_host</td><td>string</td><td>optional</td><td></td><td></td><td>Only
 valid when pass_host is configured as rewrite.</td></tr>
+<tr><td>rules.weighted_upstreams.weight</td><td>integer</td><td>optional</td><td>weight
 = 1</td><td></td><td>The traffic is divided according to the 
<code>weight</code> value, and the roundrobin algorithm is used to divide 
multiple <code>weight</code>.</td></tr>
+</tbody>
+</table>
+<p>The traffic-split plugin is mainly composed of two parts: 
<code>match</code> and <code>weighted_upstreams</code>. <code>match</code> is a 
custom conditional rule, and <code>weighted_upstreams</code> is upstream 
configuration information. If you configure <code>match</code> and 
<code>weighted_upstreams</code> information, then after the <code>match</code> 
rule is verified, it will be based on the <code>weight</code> value in 
<code>weighted_upstreams</code>; the ratio of traffic between [...]
+<blockquote>
+<p>Note: 1. In <code>match</code>, the expression in vars is the relationship 
of <code>and</code>, and the relationship between multiple <code>vars</code> is 
the relationship of <code>or</code>.  2. There is only a <code>weight</code> 
value in the weighted_upstreams of the plug-in, which means reaching the 
upstream traffic weight value configured on <code>route</code> or 
<code>service</code>. Such as:</p>
+</blockquote>
+<pre><code class="hljs css language-json">{
+    <span class="hljs-attr">"weight"</span>: <span class="hljs-number">2</span>
+}
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="how-to-enable"></a><a 
href="#how-to-enable" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.8 [...]
+<p>Create a route and enable the <code>traffic-split</code> plugin:</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 1
+                        },
+                        {
+                            "weight": 1
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="example"></a><a href="#example" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1- [...]
+<h3><a class="anchor" aria-hidden="true" id="grayscale-release"></a><a 
href="#grayscale-release" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2- [...]
+<p>The <code>match</code> rule part is missing, and the traffic is split 
according to the <code>weight</code> value configured by the 
<code>weighted_upstreams</code> in the plugin. Divide <code>plug-in 
upstream</code> and <code>route's upstream</code> according to the traffic 
ratio of 3:2, of which 60% of the traffic reaches the upstream of the 
<code>1981</code> port in the plugin, and 40% of the traffic reaches the 
default <code>1980</code> port on the route Upstream.</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>Test plugin:</strong></p>
+<p>There are 5 requests, 3 requests hit the upstream of port 1981 of the 
plug-in, and 2 requests hit the upstream of port 1980 of <code>route</code>.</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+hello 1980
+<span class="hljs-meta">
+$</span><span class="bash"> curl http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+world 1981
+
+......
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="blue-green-release"></a><a 
href="#blue-green-release" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22- [...]
+<p>Get the <code>match</code> rule parameter through the request header (you 
can also get it through the request parameter or NGINX variable). After the 
<code>match</code> rule is matched, it means that all requests hit the upstream 
configured by the plugin, otherwise the request only hits the 
<code>route</code> configured upstream.</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["http_release","==","new_release"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            }
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>Test plugin:</strong></p>
+<p>The rule of <code>match</code> is matched, and all requests hit the 
upstream port 1981 configured by the plugin:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: new_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p>The <code>match</code> rule fails to match, and all requests hit the 1980 
port upstream configured on the <code>route</code>:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: old_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="custom-release"></a><a 
href="#custom-release" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>Multiple <code>vars</code> rules can be set in <code>match</code>. Multiple 
expressions in <code>vars</code> have an <code>add</code> relationship, and 
multiple <code>vars</code> rules have an <code>or</code> relationship; as long 
as one of the vars is required If the rule passes, the entire 
<code>match</code> passes.</p>
+<p><strong>Example 1: Only one <code>vars</code> rule is configured, and 
multiple expressions in <code>vars</code> are in the relationship of 
<code>add</code>. In <code>weighted_upstreams</code>, the traffic is divided 
into 3:2 according to the value of <code>weight</code>, of which only the part 
of the <code>weight</code> value represents the proportion of upstream on the 
<code>route</code>. When <code>match</code> fails to pass, all traffic will 
only hit the upstream on the route.</str [...]
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>The plugin sets the requested <code>match</code> rule and upstream with 
port <code>1981</code>, and the route has upstream with port 
<code>1980</code>.</p>
+<p><strong>Test plugin:</strong></p>
+<blockquote>
+<ol>
+<li>After the verification of the <code>match</code> rule is passed, 60% of 
the requests hit the upstream of the plug-in port 1981, and 40% of the requests 
hit the upstream of the 1980 port of the <code>route</code>.</li>
+</ol>
+</blockquote>
+<p>The match rule is successfully verified, and the upstream port of 
<code>1981</code> is hit.</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p>The match rule fails to verify, and it hits the upstream of the default 
port of <code>1980</code>.</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>After 5 requests, the service of port <code>1981</code> was hit 3 times, 
and the service of port <code>1980</code> was hit 2 times.</p>
+<p><strong>Example 2: Configure multiple <code>vars</code> rules. Multiple 
expressions in <code>vars</code> are <code>add</code> relationships, and 
multiple <code>vars</code> are <code>and</code> relationships. According to the 
<code>weight</code> value in <code>weighted_upstreams</code>, the traffic is 
divided into 3:2, where only the part of the <code>weight</code> value 
represents the proportion of upstream on the route. When <code>match</code> 
fails to pass, all traffic will only hit [...]
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ],
+                            "vars": [
+                                ["arg_name2","==","rose"],
+                                ["http_user-id2","!","&gt;","33"],
+                                ["http_apisix-key2","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>The plugin sets the requested <code>match</code> rule and the upstream port 
of <code>1981</code>, and the route has upstream port of <code>1980</code>.</p>
+<p><strong>Test plugin:</strong></p>
+<blockquote>
+<ol>
+<li>The expressions of the two <code>vars</code> are matched successfully. 
After the <code>match</code> rule is verified, 60% of the requests hit the 1981 
port upstream of the plugin, and 40% of the requests hit the 1980 port upstream 
of the <code>route</code>.</li>
+</ol>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>After 5 requests, the service of port <code>1981</code> was hit 3 times, 
and the service of port <code>1980</code> was hit 2 times.</p>
+<blockquote>
+<ol start="2">
+<li>The second expression of <code>vars</code> failed to match (missing the 
<code>name2</code> request parameter). After the <code>match</code> rule was 
verified, 60% of the requests hit the plug-in's 1981 port upstream, and 40% of 
the request traffic hits Go upstream to the 1980 port of 
<code>route</code>.</li>
+</ol>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>After 5 requests, the service of port <code>1981</code> was hit 3 times, 
and the service of port <code>1980</code> was hit 2 times.</p>
+<blockquote>
+<ol start="3">
+<li>The expression verification of two <code>vars</code> failed (missing the 
request parameters of <code>name</code> and <code>name2</code>), the 
<code>match</code> rule verification failed, and the response is the upstream 
data <code>hello 1980</code> of the default <code>route</code>.</li>
+</ol>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="disable-plugin"></a><a 
href="#disable-plugin" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0- [...]
+<p>When you want to remove the traffic-split plugin, it's very simple, just 
delete the corresponding json configuration in the plugin configuration, no 
need to restart the service, it will take effect immediately:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H <span 
class="hljs-string">'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'</span> -X PUT 
-d <span class="hljs-string">'</span></span>
+{
+    "uri": "/index.html",
+    "plugins": {},
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav 
class="onPageNav"><ul class="toc-headings"><li><a 
href="#name">Name</a></li><li><a href="#attributes">Attributes</a></li><li><a 
href="#how-to-enable">How To Enable</a></li><li><a 
href="#example">Example</a><ul class="toc-headings"><li><a 
href="#grayscale-release">Grayscale Release</a></li><li><a 
href="#blue-green-release">Blue-green Release</a></li><li><a 
href="#custom-release">Custom Release</a></li></ul></li [...]
+                document.addEventListener('keyup', function(e) {
+                  if (e.target !== document.body) {
+                    return;
+                  }
+                  // keyCode for '/' (slash)
+                  if (e.keyCode === 191) {
+                    const search = 
document.getElementById('search_input_react');
+                    search && search.focus();
+                  }
+                });
+              </script><script>
+              var search = docsearch({
+                appId: 'ZHVP417Y1Y',
+                apiKey: '79e72fedcf3719ba85c552f710ade8a3',
+                indexName: 'apache-apisix-website',
+                inputSelector: '#search_input_react'
+              });
+            </script></body></html>
\ No newline at end of file
diff --git a/apisix/zh-cn/README.html b/apisix/zh-cn/README.html
index ee890aa..96b430d 100644
--- a/apisix/zh-cn/README.html
+++ b/apisix/zh-cn/README.html
@@ -85,6 +85,7 @@
 <li><a href="/apisix/zh-cn/plugins/request-validation">request-validation</a>: 
请求验证。</li>
 <li><a 
href="/apisix/zh-cn/plugins/proxy-mirror">proxy-mirror</a>:代理镜像插件提供镜像客户端请求的能力。</li>
 <li><a href="/apisix/zh-cn/plugins/api-breaker">api-breaker</a>: 
API的断路器,在状态不正常的情况下停止将请求转发到上游。</li>
+<li><a 
href="/apisix/zh-cn/plugins/traffic-split">traffic-split</a>:允许用户逐步控制各个上游之间的流量百分比。</li>
 </ul>
 <h3><a class="anchor" aria-hidden="true" id="monitoring"></a><a 
href="#monitoring" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 
[...]
 <ul>
diff --git a/apisix/zh-cn/README/index.html b/apisix/zh-cn/README/index.html
index ee890aa..96b430d 100644
--- a/apisix/zh-cn/README/index.html
+++ b/apisix/zh-cn/README/index.html
@@ -85,6 +85,7 @@
 <li><a href="/apisix/zh-cn/plugins/request-validation">request-validation</a>: 
请求验证。</li>
 <li><a 
href="/apisix/zh-cn/plugins/proxy-mirror">proxy-mirror</a>:代理镜像插件提供镜像客户端请求的能力。</li>
 <li><a href="/apisix/zh-cn/plugins/api-breaker">api-breaker</a>: 
API的断路器,在状态不正常的情况下停止将请求转发到上游。</li>
+<li><a 
href="/apisix/zh-cn/plugins/traffic-split">traffic-split</a>:允许用户逐步控制各个上游之间的流量百分比。</li>
 </ul>
 <h3><a class="anchor" aria-hidden="true" id="monitoring"></a><a 
href="#monitoring" aria-hidden="true" class="hash-link"><svg 
class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 
0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 
0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 
3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 
9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1 
[...]
 <ul>
diff --git a/apisix/zh-cn/plugins/prometheus.html 
b/apisix/zh-cn/plugins/prometheus.html
index d95436c..a243fb9 100644
--- a/apisix/zh-cn/plugins/prometheus.html
+++ b/apisix/zh-cn/plugins/prometheus.html
@@ -96,8 +96,9 @@
 <li><code>Bandwidth</code>: 流经apisix的总带宽(可分出口带宽和入口带宽). 
每个服务指标或者是所有服务指标的总和都可以统计到。</li>
 <li><code>etcd reachability</code>: apisix 连接 etcd 的可用性,用 0 和 1来表示。</li>
 <li><code>Connections</code>: 各种的 Nginx 连接指标,如 active(正处理的活动连接数),reading(nginx 
读取到客户端的 Header 信息数),writing(nginx 返回给客户端的 Header 信息数),已建立的连接数。.</li>
+<li><code>Batch process entries</code>: 批处理未发送数据计数器,当你使用了批处理发送插件,比如:sys 
logger, http logger, sls logger, tcp logger, udp logger and zipkin, 
那么你将会在此指标中看到批处理当前尚未发送的数据的数量。
+这里是apisix的原始的指标数据集:</li>
 </ul>
-<p>这里是apisix的原始的指标数据集:</p>
 <pre><code class="hljs">$ curl http://<span 
class="hljs-number">127.0</span>.<span class="hljs-number">0.2</span>:<span 
class="hljs-number">9080</span>/apisix/prometheus/metrics
 <span class="hljs-comment"># HELP apisix_bandwidth Total bandwidth in bytes 
consumed per service in Apisix</span>
 <span class="hljs-comment"># TYPE apisix_bandwidth counter</span>
@@ -107,6 +108,14 @@ apisix_bandwidth{type=<span 
class="hljs-string">"egress"</span>,service=<span cl
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"127.0.0.2"</span>} <span class="hljs-number">83</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"bar.com"</span>} <span class="hljs-number">76</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"foo.com"</span>} <span class="hljs-number">988</span>
+<span class="hljs-comment"># HELP apisix_batch_process_entries batch process 
remaining entries</span>
+<span class="hljs-comment"># TYPE apisix_batch_process_entries gauge</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"http-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sls-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"tcp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"udp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sys-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"zipkin_report"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
 <span class="hljs-comment"># HELP apisix_etcd_reachable Config server etcd 
reachable from Apisix, 0 is unreachable</span>
 <span class="hljs-comment"># TYPE apisix_etcd_reachable gauge</span>
 apisix_etcd_reachable <span class="hljs-number">1</span>
diff --git a/apisix/zh-cn/plugins/prometheus/index.html 
b/apisix/zh-cn/plugins/prometheus/index.html
index d95436c..a243fb9 100644
--- a/apisix/zh-cn/plugins/prometheus/index.html
+++ b/apisix/zh-cn/plugins/prometheus/index.html
@@ -96,8 +96,9 @@
 <li><code>Bandwidth</code>: 流经apisix的总带宽(可分出口带宽和入口带宽). 
每个服务指标或者是所有服务指标的总和都可以统计到。</li>
 <li><code>etcd reachability</code>: apisix 连接 etcd 的可用性,用 0 和 1来表示。</li>
 <li><code>Connections</code>: 各种的 Nginx 连接指标,如 active(正处理的活动连接数),reading(nginx 
读取到客户端的 Header 信息数),writing(nginx 返回给客户端的 Header 信息数),已建立的连接数。.</li>
+<li><code>Batch process entries</code>: 批处理未发送数据计数器,当你使用了批处理发送插件,比如:sys 
logger, http logger, sls logger, tcp logger, udp logger and zipkin, 
那么你将会在此指标中看到批处理当前尚未发送的数据的数量。
+这里是apisix的原始的指标数据集:</li>
 </ul>
-<p>这里是apisix的原始的指标数据集:</p>
 <pre><code class="hljs">$ curl http://<span 
class="hljs-number">127.0</span>.<span class="hljs-number">0.2</span>:<span 
class="hljs-number">9080</span>/apisix/prometheus/metrics
 <span class="hljs-comment"># HELP apisix_bandwidth Total bandwidth in bytes 
consumed per service in Apisix</span>
 <span class="hljs-comment"># TYPE apisix_bandwidth counter</span>
@@ -107,6 +108,14 @@ apisix_bandwidth{type=<span 
class="hljs-string">"egress"</span>,service=<span cl
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"127.0.0.2"</span>} <span class="hljs-number">83</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"bar.com"</span>} <span class="hljs-number">76</span>
 apisix_bandwidth{type=<span class="hljs-string">"ingress"</span>,service=<span 
class="hljs-string">"foo.com"</span>} <span class="hljs-number">988</span>
+<span class="hljs-comment"># HELP apisix_batch_process_entries batch process 
remaining entries</span>
+<span class="hljs-comment"># TYPE apisix_batch_process_entries gauge</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"http-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sls-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"tcp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"udp-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"sys-logger"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
+apisix_batch_process_entries{name=<span 
class="hljs-string">"zipkin_report"</span>,route_id=<span 
class="hljs-string">"9"</span>,server_addr=<span 
class="hljs-string">"127.0.0.1"</span>} <span class="hljs-number">1</span>
 <span class="hljs-comment"># HELP apisix_etcd_reachable Config server etcd 
reachable from Apisix, 0 is unreachable</span>
 <span class="hljs-comment"># TYPE apisix_etcd_reachable gauge</span>
 apisix_etcd_reachable <span class="hljs-number">1</span>
diff --git a/apisix/zh-cn/plugins/traffic-split.html 
b/apisix/zh-cn/plugins/traffic-split.html
new file mode 100644
index 0000000..5ee2a75
--- /dev/null
+++ b/apisix/zh-cn/plugins/traffic-split.html
@@ -0,0 +1,434 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta 
http-equiv="X-UA-Compatible" 
content="IE=edge"/><title>apisix/zh-cn/plugins/traffic-split · Apache 
APISIX™</title><meta name="viewport" content="width=device-width"/><meta 
name="generator" content="Docusaurus"/><meta name="description" 
content="&lt;!--"/><meta name="docsearch:language" content="en"/><meta 
property="og:title" content="apisix/zh-cn/plugins/traffic-split · Apache 
APISIX™"/><meta property="og:type" content="we [...]
+        document.addEventListener('DOMContentLoaded', function() {
+          addBackToTop(
+            {"zIndex":100}
+          )
+        });
+        </script><script src="/js/scrollSpy.js"></script><link 
rel="stylesheet" href="/css/main.css"/><script 
src="/js/codetabs.js"></script></head><body class="sideNavVisible 
separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper 
wrapper"><header><a href="/"><img class="logo" src="/img/logo.png" alt="Apache 
APISIX™"/><h2 class="headerTitleWithLogo">Apache APISIX™</h2></a><div 
class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul 
class="nav-site n [...]
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+<ul>
+<li><a href="/apisix/plugins/traffic-split">English</a></li>
+</ul>
+<h1><a class="anchor" aria-hidden="true" id="目录"></a><a href="#目录" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<ul>
+<li><a href="#名字">名字</a></li>
+<li><a href="#属性">属性</a></li>
+<li><a href="#如何启用">如何启用</a></li>
+<li><a href="#示例">示例</a>
+<ul>
+<li><a href="#灰度发布">灰度发布</a></li>
+<li><a href="#蓝绿发布">蓝绿发布</a></li>
+<li><a href="#自定义发布">自定义发布</a></li>
+</ul></li>
+<li><a href="#禁用插件">禁用插件</a></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="名字"></a><a href="#名字" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>traffic-split 插件使用户可以逐步引导各个上游之间的流量百分比。</p>
+<p>注:由于加权循环算法(特别是在重置wrr状态时)的缺点,因此每个上游之间的比率可能不太准确。</p>
+<h2><a class="anchor" aria-hidden="true" id="属性"></a><a href="#属性" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<table>
+<thead>
+<tr><th>参数名</th><th>类型</th><th>可选项</th><th>默认值</th><th>有效值</th><th>描述</th></tr>
+</thead>
+<tbody>
+<tr><td>rules.match</td><td>array[object]</td><td>可选</td><td></td><td></td><td>匹配规则列表</td></tr>
+<tr><td>rules.match.vars</td><td>array[array]</td><td>可选</td><td></td><td></td><td>由一个或多个{var,
 operator, val}元素组成的列表,类似这样:{{var, operator, val}, {var, operator, val}, 
...}}。例如:{&quot;arg_name&quot;, &quot;==&quot;, &quot;json&quot;},表示当前请求参数 name 
是 json。这里的 var 与 Nginx 内部自身变量命名是保持一致,所以也可以使用 request_uri、host 等;对于 operator 
部分,目前已支持的运算符有 ==、~=、~~、&gt;、&lt;、in、has 和 ! 。操作符的具体用法请看 <a 
href="https://github.com/api7/lua-resty-expr#operator-list";>lua-resty-expr</a> 
的 <code>operator-list</code> 部分 [...]
+<tr><td>rules.weighted_upstreams</td><td>array[object]</td><td>可选</td><td></td><td></td><td>上游配置规则列表。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream_id</td><td>string or 
integer</td><td>可选</td><td></td><td></td><td>通过上游 id 绑定对应上游(暂不支持)。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream</td><td>object</td><td>可选</td><td></td><td></td><td>上游配置信息。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.type</td><td>enum</td><td>可选</td><td>roundrobin</td><td>[roundrobin,
 chash]</td><td>roundrobin 支持权重的负载,chash 一致性哈希,两者是二选一的(目前只支持 
<code>roundrobin</code>)。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.nodes</td><td>object</td><td>可选</td><td></td><td></td><td>哈希表,内部元素的
 key 是上游机器地址 列表,格式为地址 + Port,其中地址部 分可以是 IP 也可以是域名,⽐如 
192.168.1.100:80、foo.com:80等。 value 则是节点的权重,特别的,当权重 值为 0 有特殊含义,通常代表该上游节点 
失效,永远不希望被选中。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.timeout</td><td>object</td><td>可选</td><td>15</td><td></td><td>设置连接、发送消息、接收消息的超时时间(时间单位:秒,都默认为
 15 秒)。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.pass_host</td><td>enum</td><td>可选</td><td>&quot;pass&quot;</td><td>[&quot;pass&quot;,
 &quot;node&quot;, &quot;rewrite&quot;]</td><td>pass: 透传客户端请求的 host, node: 
不透传客户端请求的 host; 使用 upstream node 配置的 host, rewrite: 使用 upstream_host 配置的值重写 
host 。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.name</td><td>string</td><td>可选</td><td></td><td></td><td>标识上游服务名称、使⽤场景等。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.upstream_host</td><td>string</td><td>可选</td><td></td><td></td><td>只在
 pass_host 配置为 rewrite 时有效。</td></tr>
+<tr><td>rules.weighted_upstreams.weight</td><td>integer</td><td>可选</td><td>weight
 = 1</td><td></td><td>根据 <code>weight</code> 值做流量划分,多个 weight 之间使用 roundrobin 
算法划分。</td></tr>
+</tbody>
+</table>
+<p>traffic-split 插件主要由 <code>match</code> 和 <code>weighted_upstreams</code> 
两部分组成,<code>match</code> 是自定义的条件规则,<code>weighted_upstreams</code> 是 upstream 
的配置信息。如果配置 <code>match</code> 和 <code>weighted_upstreams</code> 信息,那么在 
<code>match</code> 规则校验通过后,会根据 <code>weighted_upstreams</code> 中的 
<code>weight</code> 值;引导插件中各个 upstream 之间的流量比例,否则,所有流量直接到达 <code>route</code> 或 
<code>service</code> 上配置的 <code>upstream</code>。当然你也可以只配置 
<code>weighted_upstreams</code> 部分,这样会直接根据 <code>weighted_upstr [...]
+<blockquote>
+<p>注:1、在 <code>match</code> 里,vars 中的表达式是 <code>and</code> 的关系,多个 
<code>vars</code> 之间是 <code>or</code> 的关系。2、在插件的 weighted_upstreams 中只有 
<code>weight</code> 值,表示到达 <code>route</code> 或 <code>service</code> 上配置的 
upstream 流量权重值。如:</p>
+</blockquote>
+<pre><code class="hljs css language-json">{
+    <span class="hljs-attr">"weight"</span>: <span class="hljs-number">2</span>
+}
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="如何启用"></a><a href="#如何启用" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>创建一个路由并启用 <code>traffic-split</code> 插件:</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 1
+                        },
+                        {
+                            "weight": 1
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="灰度发布"></a><a href="#灰度发布" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>缺少 <code>match</code> 规则部分,根据插件中 <code>weighted_upstreams</code> 配置的 
<code>weight</code> 值做流量分流。将 <code>插件的 upstream</code> 与 <code>route 的 
upstream</code> 按 3:2 的流量比例进行划分,其中 60% 的流量到达插件中的 <code>1981</code> 端口的 
upstream, 40% 的流量到达 route 上默认 <code>1980</code> 端口的 upstream。</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>插件测试:</strong></p>
+<p>请求5次,3次请求命中插件1981端口的 upstream, 2次请求命中 <code>route</code> 的1980端口 
upstream。</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+hello 1980
+<span class="hljs-meta">
+$</span><span class="bash"> curl http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+world 1981
+
+......
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="蓝绿发布"></a><a href="#蓝绿发布" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>通过请求头获取 <code>match</code> 规则参数(也可以通过请求参数获取或NGINX变量),在 <code>match</code> 
规则匹配通过后,表示所有请求都命中到插件配置的 upstream ,否则所以请求只命中 <code>route</code> 上配置的 upstream 
。</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["http_release","==","new_release"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            }
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>插件测试:</strong></p>
+<p><code>match</code> 规则匹配通过,所有请求都命中插件配置的1981端口 upstream :</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: new_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p><code>match</code> 规则匹配失败,所有请求都命中 <code>route</code> 上配置的 1980端口 upstream 
:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: old_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="自定义发布"></a><a href="#自定义发布" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p><code>match</code> 中可以设置多个 <code>vars</code> 规则,<code>vars</code> 
中的多个表达式之间是 <code>add</code> 的关系, 多个 <code>vars</code> 规则之间是 <code>or</code> 
的关系;只要其中一个 vars 规则通过,则整个 <code>match</code> 通过。</p>
+<p><strong>示例1:只配置了一个 <code>vars</code> 规则, <code>vars</code> 中的多个表达式是 
<code>add</code> 的关系。在 <code>weighted_upstreams</code> 中根据 <code>weight</code> 
值将流量按 3:2 划分,其中只有 <code>weight</code> 值的部分表示 <code>route</code> 上的 upstream 
所占的比例。 当 <code>match</code> 匹配不通过时,所有的流量只会命中 route 上的 upstream 。</strong></p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>插件设置了请求的 <code>match</code> 规则及端口为<code>1981</code>的 upstream,route 
上具有端口为<code>1980</code>的 upstream。</p>
+<p><strong>插件测试:</strong></p>
+<blockquote>
+<p>1、在 <code>match</code> 规则校验通过后, 60% 的请求命中到插件的1981端口的 upstream, 40% 的请求命中到 
<code>route</code> 的1980端口的 upstream。</p>
+</blockquote>
+<p>match 规则校验成功, 命中端口为<code>1981</code>的 upstream。</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p>match 规则校验失败,,命中默认端口为<code>1980</code>的 upstream。</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>在请求5次后,3次命中 <code>1981</code> 端口的服务,2次命中 <code>1980</code> 端口的服务。</p>
+<blockquote>
+<p>2、<code>match</code> 规则校验失败(缺少请求头 <code>apisix-key</code> ), 响应都为默认 
upstream 的数据 <code>hello 1980</code>。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p><strong>示例2:配置多个 <code>vars</code> 规则, <code>vars</code> 中的多个表达式是 
<code>add</code> 的关系, 多个 <code>vars</code> 之间是 <code>and</code> 的关系。根据 
<code>weighted_upstreams</code> 中的 <code>weight</code> 值将流量按 3:2 划分,其中只有 
<code>weight</code> 值的部分表示 route 上的 upstream 所占的比例。 当 <code>match</code> 
匹配不通过时,所有的流量只会命中 route 上的 upstream 。</strong></p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ],
+                            "vars": [
+                                ["arg_name2","==","rose"],
+                                ["http_user-id2","!","&gt;","33"],
+                                ["http_apisix-key2","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>插件设置了请求的 <code>match</code> 规则及端口为<code>1981</code>的 upstream,route 
上具有端口为<code>1980</code>的 upstream 。</p>
+<p><strong>测试插件:</strong></p>
+<blockquote>
+<p>1、两个 <code>vars</code> 的表达式匹配成功, <code>match</code> 规则校验通过后, 60% 
的请求命中到插件的1981端口 upstream, 40% 的请求命中到 <code>route</code> 的1980端口upstream。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>在请求5次后,3次命中 <code>1981</code> 端口的服务,2次命中 <code>1980</code> 端口的服务。</p>
+<blockquote>
+<p>2、第二个 <code>vars</code> 的表达式匹配失败(缺少 <code>name2</code> 
请求参数),<code>match</code> 规则校验通过后, 60% 的请求命中到插件的1981端口 upstream, 40% 的请求流量命中到 
<code>route</code> 的1980端口 upstream。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>在请求5次后,3次命中 <code>1981</code> 端口的服务,2次命中 <code>1980</code> 端口的服务。</p>
+<blockquote>
+<p>3、两个 <code>vars</code> 的表达式校验失败(缺少 <code>name</code> 和 <code>name2</code> 
请求参数),<code>match</code> 规则校验失败, 响应都为默认 <code>route</code> 的 upstream 数据 
<code>hello 1980</code>。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="禁用插件"></a><a href="#禁用插件" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>当你想去掉 traffic-split 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H <span 
class="hljs-string">'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'</span> -X PUT 
-d <span class="hljs-string">'</span></span>
+{
+    "uri": "/index.html",
+    "plugins": {},
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav 
class="onPageNav"><ul class="toc-headings"><li><a href="#名字">名字</a></li><li><a 
href="#属性">属性</a></li><li><a href="#如何启用">如何启用</a></li><li><a 
href="#示例">示例</a><ul class="toc-headings"><li><a 
href="#灰度发布">灰度发布</a></li><li><a href="#蓝绿发布">蓝绿发布</a></li><li><a 
href="#自定义发布">自定义发布</a></li></ul></li><li><a 
href="#禁用插件">禁用插件</a></li></ul></nav></div><footer class="nav-footer" 
id="footer"><section class="sitemap"><a hr [...]
+                document.addEventListener('keyup', function(e) {
+                  if (e.target !== document.body) {
+                    return;
+                  }
+                  // keyCode for '/' (slash)
+                  if (e.keyCode === 191) {
+                    const search = 
document.getElementById('search_input_react');
+                    search && search.focus();
+                  }
+                });
+              </script><script>
+              var search = docsearch({
+                appId: 'ZHVP417Y1Y',
+                apiKey: '79e72fedcf3719ba85c552f710ade8a3',
+                indexName: 'apache-apisix-website',
+                inputSelector: '#search_input_react'
+              });
+            </script></body></html>
\ No newline at end of file
diff --git a/apisix/zh-cn/plugins/traffic-split/index.html 
b/apisix/zh-cn/plugins/traffic-split/index.html
new file mode 100644
index 0000000..5ee2a75
--- /dev/null
+++ b/apisix/zh-cn/plugins/traffic-split/index.html
@@ -0,0 +1,434 @@
+<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta 
http-equiv="X-UA-Compatible" 
content="IE=edge"/><title>apisix/zh-cn/plugins/traffic-split · Apache 
APISIX™</title><meta name="viewport" content="width=device-width"/><meta 
name="generator" content="Docusaurus"/><meta name="description" 
content="&lt;!--"/><meta name="docsearch:language" content="en"/><meta 
property="og:title" content="apisix/zh-cn/plugins/traffic-split · Apache 
APISIX™"/><meta property="og:type" content="we [...]
+        document.addEventListener('DOMContentLoaded', function() {
+          addBackToTop(
+            {"zIndex":100}
+          )
+        });
+        </script><script src="/js/scrollSpy.js"></script><link 
rel="stylesheet" href="/css/main.css"/><script 
src="/js/codetabs.js"></script></head><body class="sideNavVisible 
separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper 
wrapper"><header><a href="/"><img class="logo" src="/img/logo.png" alt="Apache 
APISIX™"/><h2 class="headerTitleWithLogo">Apache APISIX™</h2></a><div 
class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul 
class="nav-site n [...]
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+<ul>
+<li><a href="/apisix/plugins/traffic-split">English</a></li>
+</ul>
+<h1><a class="anchor" aria-hidden="true" id="目录"></a><a href="#目录" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<ul>
+<li><a href="#名字">名字</a></li>
+<li><a href="#属性">属性</a></li>
+<li><a href="#如何启用">如何启用</a></li>
+<li><a href="#示例">示例</a>
+<ul>
+<li><a href="#灰度发布">灰度发布</a></li>
+<li><a href="#蓝绿发布">蓝绿发布</a></li>
+<li><a href="#自定义发布">自定义发布</a></li>
+</ul></li>
+<li><a href="#禁用插件">禁用插件</a></li>
+</ul>
+<h2><a class="anchor" aria-hidden="true" id="名字"></a><a href="#名字" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<p>traffic-split 插件使用户可以逐步引导各个上游之间的流量百分比。</p>
+<p>注:由于加权循环算法(特别是在重置wrr状态时)的缺点,因此每个上游之间的比率可能不太准确。</p>
+<h2><a class="anchor" aria-hidden="true" id="属性"></a><a href="#属性" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<table>
+<thead>
+<tr><th>参数名</th><th>类型</th><th>可选项</th><th>默认值</th><th>有效值</th><th>描述</th></tr>
+</thead>
+<tbody>
+<tr><td>rules.match</td><td>array[object]</td><td>可选</td><td></td><td></td><td>匹配规则列表</td></tr>
+<tr><td>rules.match.vars</td><td>array[array]</td><td>可选</td><td></td><td></td><td>由一个或多个{var,
 operator, val}元素组成的列表,类似这样:{{var, operator, val}, {var, operator, val}, 
...}}。例如:{&quot;arg_name&quot;, &quot;==&quot;, &quot;json&quot;},表示当前请求参数 name 
是 json。这里的 var 与 Nginx 内部自身变量命名是保持一致,所以也可以使用 request_uri、host 等;对于 operator 
部分,目前已支持的运算符有 ==、~=、~~、&gt;、&lt;、in、has 和 ! 。操作符的具体用法请看 <a 
href="https://github.com/api7/lua-resty-expr#operator-list";>lua-resty-expr</a> 
的 <code>operator-list</code> 部分 [...]
+<tr><td>rules.weighted_upstreams</td><td>array[object]</td><td>可选</td><td></td><td></td><td>上游配置规则列表。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream_id</td><td>string or 
integer</td><td>可选</td><td></td><td></td><td>通过上游 id 绑定对应上游(暂不支持)。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream</td><td>object</td><td>可选</td><td></td><td></td><td>上游配置信息。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.type</td><td>enum</td><td>可选</td><td>roundrobin</td><td>[roundrobin,
 chash]</td><td>roundrobin 支持权重的负载,chash 一致性哈希,两者是二选一的(目前只支持 
<code>roundrobin</code>)。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.nodes</td><td>object</td><td>可选</td><td></td><td></td><td>哈希表,内部元素的
 key 是上游机器地址 列表,格式为地址 + Port,其中地址部 分可以是 IP 也可以是域名,⽐如 
192.168.1.100:80、foo.com:80等。 value 则是节点的权重,特别的,当权重 值为 0 有特殊含义,通常代表该上游节点 
失效,永远不希望被选中。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.timeout</td><td>object</td><td>可选</td><td>15</td><td></td><td>设置连接、发送消息、接收消息的超时时间(时间单位:秒,都默认为
 15 秒)。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.pass_host</td><td>enum</td><td>可选</td><td>&quot;pass&quot;</td><td>[&quot;pass&quot;,
 &quot;node&quot;, &quot;rewrite&quot;]</td><td>pass: 透传客户端请求的 host, node: 
不透传客户端请求的 host; 使用 upstream node 配置的 host, rewrite: 使用 upstream_host 配置的值重写 
host 。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.name</td><td>string</td><td>可选</td><td></td><td></td><td>标识上游服务名称、使⽤场景等。</td></tr>
+<tr><td>rules.weighted_upstreams.upstream.upstream_host</td><td>string</td><td>可选</td><td></td><td></td><td>只在
 pass_host 配置为 rewrite 时有效。</td></tr>
+<tr><td>rules.weighted_upstreams.weight</td><td>integer</td><td>可选</td><td>weight
 = 1</td><td></td><td>根据 <code>weight</code> 值做流量划分,多个 weight 之间使用 roundrobin 
算法划分。</td></tr>
+</tbody>
+</table>
+<p>traffic-split 插件主要由 <code>match</code> 和 <code>weighted_upstreams</code> 
两部分组成,<code>match</code> 是自定义的条件规则,<code>weighted_upstreams</code> 是 upstream 
的配置信息。如果配置 <code>match</code> 和 <code>weighted_upstreams</code> 信息,那么在 
<code>match</code> 规则校验通过后,会根据 <code>weighted_upstreams</code> 中的 
<code>weight</code> 值;引导插件中各个 upstream 之间的流量比例,否则,所有流量直接到达 <code>route</code> 或 
<code>service</code> 上配置的 <code>upstream</code>。当然你也可以只配置 
<code>weighted_upstreams</code> 部分,这样会直接根据 <code>weighted_upstr [...]
+<blockquote>
+<p>注:1、在 <code>match</code> 里,vars 中的表达式是 <code>and</code> 的关系,多个 
<code>vars</code> 之间是 <code>or</code> 的关系。2、在插件的 weighted_upstreams 中只有 
<code>weight</code> 值,表示到达 <code>route</code> 或 <code>service</code> 上配置的 
upstream 流量权重值。如:</p>
+</blockquote>
+<pre><code class="hljs css language-json">{
+    <span class="hljs-attr">"weight"</span>: <span class="hljs-number">2</span>
+}
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="如何启用"></a><a href="#如何启用" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>创建一个路由并启用 <code>traffic-split</code> 插件:</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 1
+                        },
+                        {
+                            "weight": 1
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="示例"></a><a href="#示例" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c [...]
+<h3><a class="anchor" aria-hidden="true" id="灰度发布"></a><a href="#灰度发布" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>缺少 <code>match</code> 规则部分,根据插件中 <code>weighted_upstreams</code> 配置的 
<code>weight</code> 值做流量分流。将 <code>插件的 upstream</code> 与 <code>route 的 
upstream</code> 按 3:2 的流量比例进行划分,其中 60% 的流量到达插件中的 <code>1981</code> 端口的 
upstream, 40% 的流量到达 route 上默认 <code>1980</code> 端口的 upstream。</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                },
+                                "timeout": {
+                                    "connect": 15,
+                                    "send": 15,
+                                    "read": 15
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>插件测试:</strong></p>
+<p>请求5次,3次请求命中插件1981端口的 upstream, 2次请求命中 <code>route</code> 的1980端口 
upstream。</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+hello 1980
+<span class="hljs-meta">
+$</span><span class="bash"> curl http://127.0.0.1:9080/index.html -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+
+world 1981
+
+......
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="蓝绿发布"></a><a href="#蓝绿发布" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>通过请求头获取 <code>match</code> 规则参数(也可以通过请求参数获取或NGINX变量),在 <code>match</code> 
规则匹配通过后,表示所有请求都命中到插件配置的 upstream ,否则所以请求只命中 <code>route</code> 上配置的 upstream 
。</p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["http_release","==","new_release"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            }
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p><strong>插件测试:</strong></p>
+<p><code>match</code> 规则匹配通过,所有请求都命中插件配置的1981端口 upstream :</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: new_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p><code>match</code> 规则匹配失败,所有请求都命中 <code>route</code> 上配置的 1980端口 upstream 
:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'release: old_release'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<h3><a class="anchor" aria-hidden="true" id="自定义发布"></a><a href="#自定义发布" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09 [...]
+<p><code>match</code> 中可以设置多个 <code>vars</code> 规则,<code>vars</code> 
中的多个表达式之间是 <code>add</code> 的关系, 多个 <code>vars</code> 规则之间是 <code>or</code> 
的关系;只要其中一个 vars 规则通过,则整个 <code>match</code> 通过。</p>
+<p><strong>示例1:只配置了一个 <code>vars</code> 规则, <code>vars</code> 中的多个表达式是 
<code>add</code> 的关系。在 <code>weighted_upstreams</code> 中根据 <code>weight</code> 
值将流量按 3:2 划分,其中只有 <code>weight</code> 值的部分表示 <code>route</code> 上的 upstream 
所占的比例。 当 <code>match</code> 匹配不通过时,所有的流量只会命中 route 上的 upstream 。</strong></p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>插件设置了请求的 <code>match</code> 规则及端口为<code>1981</code>的 upstream,route 
上具有端口为<code>1980</code>的 upstream。</p>
+<p><strong>插件测试:</strong></p>
+<blockquote>
+<p>1、在 <code>match</code> 规则校验通过后, 60% 的请求命中到插件的1981端口的 upstream, 40% 的请求命中到 
<code>route</code> 的1980端口的 upstream。</p>
+</blockquote>
+<p>match 规则校验成功, 命中端口为<code>1981</code>的 upstream。</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<p>match 规则校验失败,,命中默认端口为<code>1980</code>的 upstream。</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>在请求5次后,3次命中 <code>1981</code> 端口的服务,2次命中 <code>1980</code> 端口的服务。</p>
+<blockquote>
+<p>2、<code>match</code> 规则校验失败(缺少请求头 <code>apisix-key</code> ), 响应都为默认 
upstream 的数据 <code>hello 1980</code>。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p><strong>示例2:配置多个 <code>vars</code> 规则, <code>vars</code> 中的多个表达式是 
<code>add</code> 的关系, 多个 <code>vars</code> 之间是 <code>and</code> 的关系。根据 
<code>weighted_upstreams</code> 中的 <code>weight</code> 值将流量按 3:2 划分,其中只有 
<code>weight</code> 值的部分表示 route 上的 upstream 所占的比例。 当 <code>match</code> 
匹配不通过时,所有的流量只会命中 route 上的 upstream 。</strong></p>
+<pre><code class="hljs css language-shell">curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "uri": "/index.html",
+    "plugins": {
+        "traffic-split": {
+            "rules": [
+                {
+                    "match": [
+                        {
+                            "vars": [
+                                ["arg_name","==","jack"],
+                                ["http_user-id","&gt;","23"],
+                                ["http_apisix-key","~~","[a-z]+"]
+                            ],
+                            "vars": [
+                                ["arg_name2","==","rose"],
+                                ["http_user-id2","!","&gt;","33"],
+                                ["http_apisix-key2","~~","[a-z]+"]
+                            ]
+                        }
+                    ],
+                    "weighted_upstreams": [
+                        {
+                            "upstream": {
+                                "name": "upstream_A",
+                                "type": "roundrobin",
+                                "nodes": {
+                                    "127.0.0.1:1981":10
+                                }
+                            },
+                            "weight": 3
+                        },
+                        {
+                            "weight": 2
+                        }
+                    ]
+                }
+            ]
+        }
+    },
+    "upstream": {
+            "type": "roundrobin",
+            "nodes": {
+                "127.0.0.1:1980": 1
+            }
+    }
+}'
+</code></pre>
+<p>插件设置了请求的 <code>match</code> 规则及端口为<code>1981</code>的 upstream,route 
上具有端口为<code>1980</code>的 upstream 。</p>
+<p><strong>测试插件:</strong></p>
+<blockquote>
+<p>1、两个 <code>vars</code> 的表达式匹配成功, <code>match</code> 规则校验通过后, 60% 
的请求命中到插件的1981端口 upstream, 40% 的请求命中到 <code>route</code> 的1980端口upstream。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack&amp;name2=rose'</span>
 -H <span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>在请求5次后,3次命中 <code>1981</code> 端口的服务,2次命中 <code>1980</code> 端口的服务。</p>
+<blockquote>
+<p>2、第二个 <code>vars</code> 的表达式匹配失败(缺少 <code>name2</code> 
请求参数),<code>match</code> 规则校验通过后, 60% 的请求命中到插件的1981端口 upstream, 40% 的请求流量命中到 
<code>route</code> 的1980端口 upstream。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+world 1981
+</code></pre>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -H <span 
class="hljs-string">'user-id2:22'</span> -H <span 
class="hljs-string">'apisix-key: hello'</span> -H <span 
class="hljs-string">'apisix-key2: world'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<p>在请求5次后,3次命中 <code>1981</code> 端口的服务,2次命中 <code>1980</code> 端口的服务。</p>
+<blockquote>
+<p>3、两个 <code>vars</code> 的表达式校验失败(缺少 <code>name</code> 和 <code>name2</code> 
请求参数),<code>match</code> 规则校验失败, 响应都为默认 <code>route</code> 的 upstream 数据 
<code>hello 1980</code>。</p>
+</blockquote>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl <span 
class="hljs-string">'http://127.0.0.1:9080/index.html?name=jack'</span> -H 
<span class="hljs-string">'user-id:30'</span> -i</span>
+HTTP/1.1 200 OK
+Content-Type: text/html; charset=utf-8
+......
+
+hello 1980
+</code></pre>
+<h2><a class="anchor" aria-hidden="true" id="禁用插件"></a><a href="#禁用插件" 
aria-hidden="true" class="hash-link"><svg class="hash-link-icon" 
aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" 
width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 
5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 
2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6 [...]
+<p>当你想去掉 traffic-split 插件的时候,很简单,在插件的配置中把对应的 json 配置删除即可,无须重启服务,即刻生效:</p>
+<pre><code class="hljs css language-shell"><span 
class="hljs-meta">$</span><span class="bash"> curl 
http://127.0.0.1:9080/apisix/admin/routes/1 -H <span 
class="hljs-string">'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'</span> -X PUT 
-d <span class="hljs-string">'</span></span>
+{
+    "uri": "/index.html",
+    "plugins": {},
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+</code></pre>
+</span></div></article></div><div class="docs-prevnext"></div></div></div><nav 
class="onPageNav"><ul class="toc-headings"><li><a href="#名字">名字</a></li><li><a 
href="#属性">属性</a></li><li><a href="#如何启用">如何启用</a></li><li><a 
href="#示例">示例</a><ul class="toc-headings"><li><a 
href="#灰度发布">灰度发布</a></li><li><a href="#蓝绿发布">蓝绿发布</a></li><li><a 
href="#自定义发布">自定义发布</a></li></ul></li><li><a 
href="#禁用插件">禁用插件</a></li></ul></nav></div><footer class="nav-footer" 
id="footer"><section class="sitemap"><a hr [...]
+                document.addEventListener('keyup', function(e) {
+                  if (e.target !== document.body) {
+                    return;
+                  }
+                  // keyCode for '/' (slash)
+                  if (e.keyCode === 191) {
+                    const search = 
document.getElementById('search_input_react');
+                    search && search.focus();
+                  }
+                });
+              </script><script>
+              var search = docsearch({
+                appId: 'ZHVP417Y1Y',
+                apiKey: '79e72fedcf3719ba85c552f710ade8a3',
+                indexName: 'apache-apisix-website',
+                inputSelector: '#search_input_react'
+              });
+            </script></body></html>
\ No newline at end of file
diff --git a/sitemap.xml b/sitemap.xml
index 6964e9d..68f0ea1 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><urlset 
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"; 
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"; 
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"; 
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1";><url><loc>https://apisix.apache.org/help</loc><changefreq>weekly</changefreq><priority>0.5</priority><x
 [...]
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><urlset 
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"; 
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0"; 
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"; 
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1";><url><loc>https://apisix.apache.org/help</loc><changefreq>weekly</changefreq><priority>0.5</priority><x
 [...]
\ No newline at end of file

Reply via email to