This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new 635286c8d7 [type:refactor] refactor ratelimiter-doc (#662)
635286c8d7 is described below
commit 635286c8d756b56d5836fbf6fcfaa28d61b319d6
Author: moremind <[email protected]>
AuthorDate: Sun Jul 31 17:27:07 2022 +0800
[type:refactor] refactor ratelimiter-doc (#662)
* [type:refactor] refactor ratelimiter-doc
* [type:refactor] refactor ratelimiter-doc
* Update
versioned_docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
Co-authored-by: Liming Deng <[email protected]>
---
.../fault-tolerance/rate-limiter-plugin.md | 140 ++++++++++++++++-----
.../fault-tolerance/rate-limiter-plugin.md | 140 +++++++++++++++++----
.../fault-tolerance/rate-limiter-plugin.md | 140 +++++++++++++++++----
.../fault-tolerance/rate-limiter-plugin.md | 140 +++++++++++++++++----
.../fault-tolerance/rate-limiter-plugin.md | 140 +++++++++++++++++----
.../fault-tolerance/rate-limiter-plugin.md | 140 +++++++++++++++++----
.../plugin/ratelimiter/jmeter-http-request.png | Bin 0 -> 100492 bytes
.../shenyu/plugin/ratelimiter/jmeter-result.png | Bin 0 -> 234659 bytes
.../plugin/ratelimiter/jmeter-thread-group.png | Bin 0 -> 96745 bytes
.../plugin/ratelimiter/ratelimiter-plugin-en.png | Bin 0 -> 152053 bytes
.../ratelimiter/ratelimiter-plugin-rule-en.png | Bin 0 -> 115467 bytes
.../ratelimiter/ratelimiter-plugin-rule-zh.png | Bin 0 -> 107001 bytes
.../plugin/ratelimiter/ratelimiter-plugin-zh.png | Bin 0 -> 141740 bytes
.../shenyu/plugin/ratelimiter/rule-example-en.png | Bin 0 -> 112046 bytes
.../shenyu/plugin/ratelimiter/rule-example-zh.png | Bin 0 -> 105495 bytes
.../fault-tolerance/rate-limiter-plugin.md | 140 ++++++++++++++++-----
.../fault-tolerance/rate-limiter-plugin.md | 140 ++++++++++++++++-----
.../fault-tolerance/rate-limiter-plugin.md | 140 ++++++++++++++++-----
.../fault-tolerance/rate-limiter-plugin.md | 140 ++++++++++++++++-----
19 files changed, 1125 insertions(+), 275 deletions(-)
diff --git a/docs/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/docs/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 6d41087e14..309f01df1b 100644
--- a/docs/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++ b/docs/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,20 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter plugin
---
-## Description
+# 1. Overview
-* `RateLimiter` is core implementation of gateway restrictions on network
traffic.
+## 1.1 Plugin Name
-* the Apache ShenYu gateway provides a variety of current limiting algorithms,
including `token bucket algorithm`, `concurrent token bucket algorithm`, `leaky
bucket algorithm` and `sliding time window algorithm`.
+* RateLimiter Plugin
-* The implementation of current limiting algorithm of Apache ShenYu gateway is
based on `redis`.
+## 1.2 Appropriate Scenario
+* traffic control in gateway cluster environment
+* rate limiting according to specific rules
* You can set to the interface level, or the parameter level. How to use it
depends on your traffic configuration.
+## 1.3 Plugin functionality
-## Technical Solution
+* use redis to control gateway traffic
-#### Using redis token bucket algorithm to limit traffic.
+## 1.4 Plugin code
+
+* Core Module `shenyu-plugin-ratelimiter`.
+
+* Core Class `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* Core Class `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 Added Since Which shenyu version
+
+* Since ShenYu 2.4.0
+
+## 1.6 Technical Solution
+
+### 1.6.1 Using redis token bucket algorithm to limit traffic.
- The system generates the token at a constant rate, and then puts the token
into the token bucket.
- The token bucket's capacity. When the bucket is full, the token put into it
will be discarded.
@@ -27,7 +43,7 @@ description: rateLimiter plugin

-#### Using redis leaky bucket algorithm to limit traffic.
+### 1.6.2 Using redis leaky bucket algorithm to limit traffic.
- water (request) go to the leaky bucket first. The leaky bucket goes out at a
fixed speed. When the flow speed is too fast, it will overflow directly (reject
service)
@@ -35,48 +51,59 @@ description: rateLimiter plugin

-#### Using redis sliding time window algorithm to limit traffic.
+### 1.6.3 Using redis sliding time window algorithm to limit traffic.
- The sliding time window maintains the count value of unit time. Whenever a
requests pass, the count value will be increased by 1. When the count value
exceeds the preset threshold, other requests in unit time will be rejected. If
the unit time has ended, clear the counter to zero and start the next round
counting.
* Flow Diagram:

+# 2. How to use plugin
-## Plugin Setting
+## 2.1 Plugin-use procedure
-* In `shenyu-admin`--> BasicConfig --> Plugin --> `rate_limiter` set to enable.
+
-* Configure redis in the plugin.
+## 2.2 Import pom
-* Currently, supporting redis patterns of single, sentinel, and cluster.
+* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
-* If it is a sentinel, cluster and other multi-node configuration in URL,
please use `;` for each instance; Division. For example, 192.168.1.1:6379;
192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
-* If the user don't use, please disable the plugin in the background.
+## 2.3 Enable plugin
-## Plugin Detail
+* In `shenyu-admin`--> BasicConfig --> Plugin --> `rateLimiter` set to enable.
-* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
+## 2.4 Config plugin
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 Plugin Config
+
+
-For more information on selectors and rules configuration, see [Selector And
Rule Config](../../user-guide/admin-usage/selector-and-rule) , only some of the
fields are covered here.
+* `mode`: the working mode of redis, the default is single-point mode:
`standalone`, in addition to cluster
+ mode: `cluster`, sentinel mode: `sentinel`.
+* `master`: default is master.
+* `url`: configure the IP and port of the redis database, configured by colon
connection, example: `192.168.1.1:6379`.
-* Rules Handler Details
+* `password`: the password of the redis database, if not, you can not
configure.
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en-1.png"
width="80%" height="80%" />
+### 2.4.2 Selector Config
+* Selectors and rules, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule)
+
+### 2.4.3 Rule Config
+
+
* TokenBucket/Concurrent
@@ -107,3 +134,60 @@ For more information on selectors and rules configuration,
see [Selector And Rul
* `burstCapacity`: The maximum number of requests in the time window (per
unit time).
* `keyResolverName`: `whole` indicates that the traffic is limited by
gateway per second, and `remoteAddress` indicates that the traffic is limited
by IP per second.
+
+## 2.5 Examples
+
+### 2.5.1 Limit traffic with `RateLimiter` plugin in gateway cluster
environment
+
+#### 2.5.1.1 Preparation
+
+- Start ShenYu Admin on `10.10.10.10:9095`
+- Start two ShenYu Bootstrap on `10.10.10.20:9195` and `10.10.10.30:9195`, and
config data sync center on `10.10.10.10:9095`
+- config nginx, for example:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 Plugin/Selector/Rule Configuration
+
+- config redis configuration with ratelimiter plugin
+
+- config selector
+
+- config rule
+
+
+
+replenishRate is 3, burstCapacity is 10
+
+#### 2.5.1.3 Send Request to `Ngin`x by `Apache Jmeter`
+
+* jmeter thread group configuration
+
+
+
+* jmeter http request configuration
+
+
+
+#### 2.5.1.4 Check Result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `rateLimiter` set Status
disable.
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 6a4f8e5a4c..a2dbcafe4a 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,21 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter插件
---
-## 说明
+# 1. 概述
-* 限流插件,是网关对流量管控限制核心的实现。
+## 1.1 插件名称
-* `Apache ShenYu` 网关提供了多种限流算法的实现,包括`令牌桶算法`、`并发的令牌桶算法`、`漏桶算法`、`滑动时间窗口算法`。
+* RateLimiter 插件
-* `Apache ShenYu` 网关的限流算法实现都是基于`redis`。
+## 1.2 适用场景
+* 在网关集群环境下进行流量控制
+* 根据特定规则进行流量控制
* 可以到接口级别,也可以到参数级别。
+## 1.3 插件功能
+* 基于redis进行流量控制
-## 技术方案
+## 1.4 插件代码
-#### 采用redis令牌桶算法进行限流
+* 核心模块 `shenyu-plugin-ratelimiter`.
+
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 添加自哪个shenyu版本
+
+* ShenYu 2.4.0
+
+## 1.6 技术方案
+
+### 1.6.1 采用redis令牌桶算法进行限流
- 系统以恒定的速率产⽣令牌,然后将令牌放⼊令牌桶中。
- 令牌桶有⼀个容量,当令牌桶满了的时候,再向其中放⼊的令牌就会被丢弃。
@@ -27,7 +42,7 @@ description: rateLimiter插件
* 流程图:

-#### 采用redis漏桶算法进行限流。
+### 1.6.2 采用redis漏桶算法进行限流。
- ⽔(请求)先进⼊到漏桶⾥,漏桶以⼀定的速度出⽔,当⽔流⼊速度过⼤会直接溢出(拒绝服务)
@@ -35,7 +50,7 @@ description: rateLimiter插件

-#### 基于redis实现的滑动窗口算法
+### 1.6.3 基于redis实现的滑动窗口算法
-
滑动时间窗口通过维护⼀个单位时间内的计数值,每当⼀个请求通过时,就将计数值加1,当计数值超过预先设定的阈值时,就拒绝单位时间内的其他请求。如果单位时间已经结束,则将计数器清零,开启下⼀轮的计数。
@@ -45,38 +60,51 @@ description: rateLimiter插件
* 流程图:

+# 2. 如何使用插件
-## 插件设置
+## 2.1 插件使用流程图
-* 在 基础配置 `-->` 插件管理 `-->` `rate_limiter`,设置为开启。 如果用户不使用,可以将其关闭。
+
-* 在插件中,对redis进行配置。
+## 2.2 导入pom
-* 目前支持redis的单机,哨兵,以及集群模式。
+* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
-* 如果是哨兵,集群等多节点的,在URL中的配置,请对每个实列使用 `;` 分割. 如 192.168.1.1:6379;192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
+## 2.3 启用插件
-## 在网关中引入 rateLimiter的支持
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为开启。
-* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
+## 2.4 配置插件
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
-
<artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 插件配置
+
+
+
+* `mode`:redis的工作模式,默认为单点模式:`standalone`,此外还有集群模式:`cluster`,哨兵模式:`sentinel`。
+
+* `master`:默认为master。
+
+* `url` :配置 redis 数据库的IP和端口,通过冒号连接配置,示例:`192.168.1.1:6379`。
-关于选择器和规则配置的更多说明,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule),
这里只对部分字段进行了介绍。
+* `password`: redis 数据库的密码,如果没有的话,可以不配置。
-* 规则详细说明
+### 2.4.2 选择器配置
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-rule.png" width="80%"
height="80%" />
+* 选择器和规则设置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+### 2.4.3 规则配置
+
+
* 令牌桶算法/并发令牌桶算法
@@ -107,3 +135,61 @@ description: rateLimiter插件
* `burstCapacity`(容量):时间窗口内(单位时间内)最大的请求数量。
* `keyResolverName`(限流依据):`whole`表示按网关每秒限流,`remoteAddress`表示按IP每秒限流。
+
+
+## 2.5 示例
+
+### 2.5.1 使用`RateLimiter`插件在网关集群环境中进行流量控制
+
+#### 2.5.1.1 准备工作
+
+- 在`10.10.10.10:9095`启动`ShenYu Admin`
+- 在`10.10.10.20:9195`和`10.10.10.30:9195`启动`ShenYu Bootstrap`, 配置`ShenYu
Bootstrap`配置同步`10.10.10.10:9095`
+- 配置nginx,例如:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 插件、选择器、规则配置
+
+- 配置ratelimiter插件的redis的配置
+
+- 配置插件的选择器
+
+- 配置规则
+
+
+
+replenishRate为3, burstCapacity为10
+
+#### 2.5.1.3 使用`Apache Jmeter`发送请求到Nginx
+
+* jmeter线程组配置
+
+
+
+* jmeter http request配置
+
+
+
+#### 2.5.1.4 验证结果
+
+
+
+# 3. 如何禁用插件
+
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为关闭。
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
index cc92288167..a2dbcafe4a 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,21 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter插件
---
-## 说明
+# 1. 概述
-* 限流插件,是网关对流量管控限制核心的实现。
+## 1.1 插件名称
-* `Apache ShenYu` 网关提供了多种限流算法的实现,包括`令牌桶算法`、`并发的令牌桶算法`、`漏桶算法`、`滑动时间窗口算法`。
+* RateLimiter 插件
-* `Apache ShenYu` 网关的限流算法实现都是基于`redis`。
+## 1.2 适用场景
+* 在网关集群环境下进行流量控制
+* 根据特定规则进行流量控制
* 可以到接口级别,也可以到参数级别。
+## 1.3 插件功能
+* 基于redis进行流量控制
-## 技术方案
+## 1.4 插件代码
-#### 采用redis令牌桶算法进行限流
+* 核心模块 `shenyu-plugin-ratelimiter`.
+
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 添加自哪个shenyu版本
+
+* ShenYu 2.4.0
+
+## 1.6 技术方案
+
+### 1.6.1 采用redis令牌桶算法进行限流
- 系统以恒定的速率产⽣令牌,然后将令牌放⼊令牌桶中。
- 令牌桶有⼀个容量,当令牌桶满了的时候,再向其中放⼊的令牌就会被丢弃。
@@ -27,7 +42,7 @@ description: rateLimiter插件
* 流程图:

-#### 采用redis漏桶算法进行限流。
+### 1.6.2 采用redis漏桶算法进行限流。
- ⽔(请求)先进⼊到漏桶⾥,漏桶以⼀定的速度出⽔,当⽔流⼊速度过⼤会直接溢出(拒绝服务)
@@ -35,7 +50,7 @@ description: rateLimiter插件

-#### 基于redis实现的滑动窗口算法
+### 1.6.3 基于redis实现的滑动窗口算法
-
滑动时间窗口通过维护⼀个单位时间内的计数值,每当⼀个请求通过时,就将计数值加1,当计数值超过预先设定的阈值时,就拒绝单位时间内的其他请求。如果单位时间已经结束,则将计数器清零,开启下⼀轮的计数。
@@ -45,38 +60,51 @@ description: rateLimiter插件
* 流程图:

+# 2. 如何使用插件
-## 插件设置
+## 2.1 插件使用流程图
-* 在 基础配置 `-->` 插件管理 `-->` `resilience4j`,设置为开启。 如果用户不使用,可以将其关闭。
+
-* 在插件中,对redis进行配置。
+## 2.2 导入pom
-* 目前支持redis的单机,哨兵,以及集群模式。
+* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
-* 如果是哨兵,集群等多节点的,在URL中的配置,请对每个实列使用 `;` 分割. 如 192.168.1.1:6379;192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
+## 2.3 启用插件
-## 在网关中引入 rateLimiter的支持
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为开启。
-* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
+## 2.4 配置插件
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
-
<artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 插件配置
+
+
+
+* `mode`:redis的工作模式,默认为单点模式:`standalone`,此外还有集群模式:`cluster`,哨兵模式:`sentinel`。
+
+* `master`:默认为master。
+
+* `url` :配置 redis 数据库的IP和端口,通过冒号连接配置,示例:`192.168.1.1:6379`。
-关于选择器和规则配置的更多说明,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule),
这里只对部分字段进行了介绍。
+* `password`: redis 数据库的密码,如果没有的话,可以不配置。
-* 规则详细说明
+### 2.4.2 选择器配置
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-rule.png" width="80%"
height="80%" />
+* 选择器和规则设置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+### 2.4.3 规则配置
+
+
* 令牌桶算法/并发令牌桶算法
@@ -107,3 +135,61 @@ description: rateLimiter插件
* `burstCapacity`(容量):时间窗口内(单位时间内)最大的请求数量。
* `keyResolverName`(限流依据):`whole`表示按网关每秒限流,`remoteAddress`表示按IP每秒限流。
+
+
+## 2.5 示例
+
+### 2.5.1 使用`RateLimiter`插件在网关集群环境中进行流量控制
+
+#### 2.5.1.1 准备工作
+
+- 在`10.10.10.10:9095`启动`ShenYu Admin`
+- 在`10.10.10.20:9195`和`10.10.10.30:9195`启动`ShenYu Bootstrap`, 配置`ShenYu
Bootstrap`配置同步`10.10.10.10:9095`
+- 配置nginx,例如:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 插件、选择器、规则配置
+
+- 配置ratelimiter插件的redis的配置
+
+- 配置插件的选择器
+
+- 配置规则
+
+
+
+replenishRate为3, burstCapacity为10
+
+#### 2.5.1.3 使用`Apache Jmeter`发送请求到Nginx
+
+* jmeter线程组配置
+
+
+
+* jmeter http request配置
+
+
+
+#### 2.5.1.4 验证结果
+
+
+
+# 3. 如何禁用插件
+
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为关闭。
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 6a4f8e5a4c..a2dbcafe4a 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,21 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter插件
---
-## 说明
+# 1. 概述
-* 限流插件,是网关对流量管控限制核心的实现。
+## 1.1 插件名称
-* `Apache ShenYu` 网关提供了多种限流算法的实现,包括`令牌桶算法`、`并发的令牌桶算法`、`漏桶算法`、`滑动时间窗口算法`。
+* RateLimiter 插件
-* `Apache ShenYu` 网关的限流算法实现都是基于`redis`。
+## 1.2 适用场景
+* 在网关集群环境下进行流量控制
+* 根据特定规则进行流量控制
* 可以到接口级别,也可以到参数级别。
+## 1.3 插件功能
+* 基于redis进行流量控制
-## 技术方案
+## 1.4 插件代码
-#### 采用redis令牌桶算法进行限流
+* 核心模块 `shenyu-plugin-ratelimiter`.
+
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 添加自哪个shenyu版本
+
+* ShenYu 2.4.0
+
+## 1.6 技术方案
+
+### 1.6.1 采用redis令牌桶算法进行限流
- 系统以恒定的速率产⽣令牌,然后将令牌放⼊令牌桶中。
- 令牌桶有⼀个容量,当令牌桶满了的时候,再向其中放⼊的令牌就会被丢弃。
@@ -27,7 +42,7 @@ description: rateLimiter插件
* 流程图:

-#### 采用redis漏桶算法进行限流。
+### 1.6.2 采用redis漏桶算法进行限流。
- ⽔(请求)先进⼊到漏桶⾥,漏桶以⼀定的速度出⽔,当⽔流⼊速度过⼤会直接溢出(拒绝服务)
@@ -35,7 +50,7 @@ description: rateLimiter插件

-#### 基于redis实现的滑动窗口算法
+### 1.6.3 基于redis实现的滑动窗口算法
-
滑动时间窗口通过维护⼀个单位时间内的计数值,每当⼀个请求通过时,就将计数值加1,当计数值超过预先设定的阈值时,就拒绝单位时间内的其他请求。如果单位时间已经结束,则将计数器清零,开启下⼀轮的计数。
@@ -45,38 +60,51 @@ description: rateLimiter插件
* 流程图:

+# 2. 如何使用插件
-## 插件设置
+## 2.1 插件使用流程图
-* 在 基础配置 `-->` 插件管理 `-->` `rate_limiter`,设置为开启。 如果用户不使用,可以将其关闭。
+
-* 在插件中,对redis进行配置。
+## 2.2 导入pom
-* 目前支持redis的单机,哨兵,以及集群模式。
+* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
-* 如果是哨兵,集群等多节点的,在URL中的配置,请对每个实列使用 `;` 分割. 如 192.168.1.1:6379;192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
+## 2.3 启用插件
-## 在网关中引入 rateLimiter的支持
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为开启。
-* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
+## 2.4 配置插件
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
-
<artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 插件配置
+
+
+
+* `mode`:redis的工作模式,默认为单点模式:`standalone`,此外还有集群模式:`cluster`,哨兵模式:`sentinel`。
+
+* `master`:默认为master。
+
+* `url` :配置 redis 数据库的IP和端口,通过冒号连接配置,示例:`192.168.1.1:6379`。
-关于选择器和规则配置的更多说明,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule),
这里只对部分字段进行了介绍。
+* `password`: redis 数据库的密码,如果没有的话,可以不配置。
-* 规则详细说明
+### 2.4.2 选择器配置
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-rule.png" width="80%"
height="80%" />
+* 选择器和规则设置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+### 2.4.3 规则配置
+
+
* 令牌桶算法/并发令牌桶算法
@@ -107,3 +135,61 @@ description: rateLimiter插件
* `burstCapacity`(容量):时间窗口内(单位时间内)最大的请求数量。
* `keyResolverName`(限流依据):`whole`表示按网关每秒限流,`remoteAddress`表示按IP每秒限流。
+
+
+## 2.5 示例
+
+### 2.5.1 使用`RateLimiter`插件在网关集群环境中进行流量控制
+
+#### 2.5.1.1 准备工作
+
+- 在`10.10.10.10:9095`启动`ShenYu Admin`
+- 在`10.10.10.20:9195`和`10.10.10.30:9195`启动`ShenYu Bootstrap`, 配置`ShenYu
Bootstrap`配置同步`10.10.10.10:9095`
+- 配置nginx,例如:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 插件、选择器、规则配置
+
+- 配置ratelimiter插件的redis的配置
+
+- 配置插件的选择器
+
+- 配置规则
+
+
+
+replenishRate为3, burstCapacity为10
+
+#### 2.5.1.3 使用`Apache Jmeter`发送请求到Nginx
+
+* jmeter线程组配置
+
+
+
+* jmeter http request配置
+
+
+
+#### 2.5.1.4 验证结果
+
+
+
+# 3. 如何禁用插件
+
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为关闭。
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 6a4f8e5a4c..a2dbcafe4a 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,21 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter插件
---
-## 说明
+# 1. 概述
-* 限流插件,是网关对流量管控限制核心的实现。
+## 1.1 插件名称
-* `Apache ShenYu` 网关提供了多种限流算法的实现,包括`令牌桶算法`、`并发的令牌桶算法`、`漏桶算法`、`滑动时间窗口算法`。
+* RateLimiter 插件
-* `Apache ShenYu` 网关的限流算法实现都是基于`redis`。
+## 1.2 适用场景
+* 在网关集群环境下进行流量控制
+* 根据特定规则进行流量控制
* 可以到接口级别,也可以到参数级别。
+## 1.3 插件功能
+* 基于redis进行流量控制
-## 技术方案
+## 1.4 插件代码
-#### 采用redis令牌桶算法进行限流
+* 核心模块 `shenyu-plugin-ratelimiter`.
+
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 添加自哪个shenyu版本
+
+* ShenYu 2.4.0
+
+## 1.6 技术方案
+
+### 1.6.1 采用redis令牌桶算法进行限流
- 系统以恒定的速率产⽣令牌,然后将令牌放⼊令牌桶中。
- 令牌桶有⼀个容量,当令牌桶满了的时候,再向其中放⼊的令牌就会被丢弃。
@@ -27,7 +42,7 @@ description: rateLimiter插件
* 流程图:

-#### 采用redis漏桶算法进行限流。
+### 1.6.2 采用redis漏桶算法进行限流。
- ⽔(请求)先进⼊到漏桶⾥,漏桶以⼀定的速度出⽔,当⽔流⼊速度过⼤会直接溢出(拒绝服务)
@@ -35,7 +50,7 @@ description: rateLimiter插件

-#### 基于redis实现的滑动窗口算法
+### 1.6.3 基于redis实现的滑动窗口算法
-
滑动时间窗口通过维护⼀个单位时间内的计数值,每当⼀个请求通过时,就将计数值加1,当计数值超过预先设定的阈值时,就拒绝单位时间内的其他请求。如果单位时间已经结束,则将计数器清零,开启下⼀轮的计数。
@@ -45,38 +60,51 @@ description: rateLimiter插件
* 流程图:

+# 2. 如何使用插件
-## 插件设置
+## 2.1 插件使用流程图
-* 在 基础配置 `-->` 插件管理 `-->` `rate_limiter`,设置为开启。 如果用户不使用,可以将其关闭。
+
-* 在插件中,对redis进行配置。
+## 2.2 导入pom
-* 目前支持redis的单机,哨兵,以及集群模式。
+* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
-* 如果是哨兵,集群等多节点的,在URL中的配置,请对每个实列使用 `;` 分割. 如 192.168.1.1:6379;192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
+## 2.3 启用插件
-## 在网关中引入 rateLimiter的支持
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为开启。
-* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
+## 2.4 配置插件
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
-
<artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 插件配置
+
+
+
+* `mode`:redis的工作模式,默认为单点模式:`standalone`,此外还有集群模式:`cluster`,哨兵模式:`sentinel`。
+
+* `master`:默认为master。
+
+* `url` :配置 redis 数据库的IP和端口,通过冒号连接配置,示例:`192.168.1.1:6379`。
-关于选择器和规则配置的更多说明,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule),
这里只对部分字段进行了介绍。
+* `password`: redis 数据库的密码,如果没有的话,可以不配置。
-* 规则详细说明
+### 2.4.2 选择器配置
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-rule.png" width="80%"
height="80%" />
+* 选择器和规则设置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+### 2.4.3 规则配置
+
+
* 令牌桶算法/并发令牌桶算法
@@ -107,3 +135,61 @@ description: rateLimiter插件
* `burstCapacity`(容量):时间窗口内(单位时间内)最大的请求数量。
* `keyResolverName`(限流依据):`whole`表示按网关每秒限流,`remoteAddress`表示按IP每秒限流。
+
+
+## 2.5 示例
+
+### 2.5.1 使用`RateLimiter`插件在网关集群环境中进行流量控制
+
+#### 2.5.1.1 准备工作
+
+- 在`10.10.10.10:9095`启动`ShenYu Admin`
+- 在`10.10.10.20:9195`和`10.10.10.30:9195`启动`ShenYu Bootstrap`, 配置`ShenYu
Bootstrap`配置同步`10.10.10.10:9095`
+- 配置nginx,例如:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 插件、选择器、规则配置
+
+- 配置ratelimiter插件的redis的配置
+
+- 配置插件的选择器
+
+- 配置规则
+
+
+
+replenishRate为3, burstCapacity为10
+
+#### 2.5.1.3 使用`Apache Jmeter`发送请求到Nginx
+
+* jmeter线程组配置
+
+
+
+* jmeter http request配置
+
+
+
+#### 2.5.1.4 验证结果
+
+
+
+# 3. 如何禁用插件
+
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为关闭。
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 6a4f8e5a4c..a2dbcafe4a 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,21 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter插件
---
-## 说明
+# 1. 概述
-* 限流插件,是网关对流量管控限制核心的实现。
+## 1.1 插件名称
-* `Apache ShenYu` 网关提供了多种限流算法的实现,包括`令牌桶算法`、`并发的令牌桶算法`、`漏桶算法`、`滑动时间窗口算法`。
+* RateLimiter 插件
-* `Apache ShenYu` 网关的限流算法实现都是基于`redis`。
+## 1.2 适用场景
+* 在网关集群环境下进行流量控制
+* 根据特定规则进行流量控制
* 可以到接口级别,也可以到参数级别。
+## 1.3 插件功能
+* 基于redis进行流量控制
-## 技术方案
+## 1.4 插件代码
-#### 采用redis令牌桶算法进行限流
+* 核心模块 `shenyu-plugin-ratelimiter`.
+
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* 核心类 `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 添加自哪个shenyu版本
+
+* ShenYu 2.4.0
+
+## 1.6 技术方案
+
+### 1.6.1 采用redis令牌桶算法进行限流
- 系统以恒定的速率产⽣令牌,然后将令牌放⼊令牌桶中。
- 令牌桶有⼀个容量,当令牌桶满了的时候,再向其中放⼊的令牌就会被丢弃。
@@ -27,7 +42,7 @@ description: rateLimiter插件
* 流程图:

-#### 采用redis漏桶算法进行限流。
+### 1.6.2 采用redis漏桶算法进行限流。
- ⽔(请求)先进⼊到漏桶⾥,漏桶以⼀定的速度出⽔,当⽔流⼊速度过⼤会直接溢出(拒绝服务)
@@ -35,7 +50,7 @@ description: rateLimiter插件

-#### 基于redis实现的滑动窗口算法
+### 1.6.3 基于redis实现的滑动窗口算法
-
滑动时间窗口通过维护⼀个单位时间内的计数值,每当⼀个请求通过时,就将计数值加1,当计数值超过预先设定的阈值时,就拒绝单位时间内的其他请求。如果单位时间已经结束,则将计数器清零,开启下⼀轮的计数。
@@ -45,38 +60,51 @@ description: rateLimiter插件
* 流程图:

+# 2. 如何使用插件
-## 插件设置
+## 2.1 插件使用流程图
-* 在 基础配置 `-->` 插件管理 `-->` `rate_limiter`,设置为开启。 如果用户不使用,可以将其关闭。
+
-* 在插件中,对redis进行配置。
+## 2.2 导入pom
-* 目前支持redis的单机,哨兵,以及集群模式。
+* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
-* 如果是哨兵,集群等多节点的,在URL中的配置,请对每个实列使用 `;` 分割. 如 192.168.1.1:6379;192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
+## 2.3 启用插件
-## 在网关中引入 rateLimiter的支持
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为开启。
-* 在网关的 `pom.xml` 文件中添加 `rateLimiter` 的依赖。
+## 2.4 配置插件
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
-
<artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 插件配置
+
+
+
+* `mode`:redis的工作模式,默认为单点模式:`standalone`,此外还有集群模式:`cluster`,哨兵模式:`sentinel`。
+
+* `master`:默认为master。
+
+* `url` :配置 redis 数据库的IP和端口,通过冒号连接配置,示例:`192.168.1.1:6379`。
-关于选择器和规则配置的更多说明,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule),
这里只对部分字段进行了介绍。
+* `password`: redis 数据库的密码,如果没有的话,可以不配置。
-* 规则详细说明
+### 2.4.2 选择器配置
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-rule.png" width="80%"
height="80%" />
+* 选择器和规则设置,请参考:[选择器和规则管理](../../user-guide/admin-usage/selector-and-rule)。
+### 2.4.3 规则配置
+
+
* 令牌桶算法/并发令牌桶算法
@@ -107,3 +135,61 @@ description: rateLimiter插件
* `burstCapacity`(容量):时间窗口内(单位时间内)最大的请求数量。
* `keyResolverName`(限流依据):`whole`表示按网关每秒限流,`remoteAddress`表示按IP每秒限流。
+
+
+## 2.5 示例
+
+### 2.5.1 使用`RateLimiter`插件在网关集群环境中进行流量控制
+
+#### 2.5.1.1 准备工作
+
+- 在`10.10.10.10:9095`启动`ShenYu Admin`
+- 在`10.10.10.20:9195`和`10.10.10.30:9195`启动`ShenYu Bootstrap`, 配置`ShenYu
Bootstrap`配置同步`10.10.10.10:9095`
+- 配置nginx,例如:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 插件、选择器、规则配置
+
+- 配置ratelimiter插件的redis的配置
+
+- 配置插件的选择器
+
+- 配置规则
+
+
+
+replenishRate为3, burstCapacity为10
+
+#### 2.5.1.3 使用`Apache Jmeter`发送请求到Nginx
+
+* jmeter线程组配置
+
+
+
+* jmeter http request配置
+
+
+
+#### 2.5.1.4 验证结果
+
+
+
+# 3. 如何禁用插件
+
+在 `shenyu-admin` --> 基础配置 --> 插件管理 --> `Cache` 设置为关闭。
diff --git a/static/img/shenyu/plugin/ratelimiter/jmeter-http-request.png
b/static/img/shenyu/plugin/ratelimiter/jmeter-http-request.png
new file mode 100644
index 0000000000..37ec2eeff4
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/jmeter-http-request.png differ
diff --git a/static/img/shenyu/plugin/ratelimiter/jmeter-result.png
b/static/img/shenyu/plugin/ratelimiter/jmeter-result.png
new file mode 100644
index 0000000000..54793e7250
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/jmeter-result.png differ
diff --git a/static/img/shenyu/plugin/ratelimiter/jmeter-thread-group.png
b/static/img/shenyu/plugin/ratelimiter/jmeter-thread-group.png
new file mode 100644
index 0000000000..87fc48b5d5
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/jmeter-thread-group.png differ
diff --git a/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en.png
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en.png
new file mode 100644
index 0000000000..a24ecf0d1a
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en.png differ
diff --git
a/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-rule-en.png
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-rule-en.png
new file mode 100644
index 0000000000..7bec15b940
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-rule-en.png differ
diff --git
a/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-rule-zh.png
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-rule-zh.png
new file mode 100644
index 0000000000..0610bae7d7
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-rule-zh.png differ
diff --git a/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-zh.png
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-zh.png
new file mode 100644
index 0000000000..ce71fadd9a
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-zh.png differ
diff --git a/static/img/shenyu/plugin/ratelimiter/rule-example-en.png
b/static/img/shenyu/plugin/ratelimiter/rule-example-en.png
new file mode 100644
index 0000000000..9b7058d5e1
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/rule-example-en.png differ
diff --git a/static/img/shenyu/plugin/ratelimiter/rule-example-zh.png
b/static/img/shenyu/plugin/ratelimiter/rule-example-zh.png
new file mode 100644
index 0000000000..52e44ffa13
Binary files /dev/null and
b/static/img/shenyu/plugin/ratelimiter/rule-example-zh.png differ
diff --git
a/versioned_docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/versioned_docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 54248d75cc..309f01df1b 100644
---
a/versioned_docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/versioned_docs/version-2.4.0/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,20 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter plugin
---
-## Description
+# 1. Overview
-* RateLimiter is core implementation of gateway restrictions on network
traffic.
+## 1.1 Plugin Name
-* the Apache ShenYu gateway provides a variety of current limiting algorithms,
including `token bucket algorithm`, `concurrent token bucket algorithm`, `leaky
bucket algorithm` and `sliding time window algorithm`.
+* RateLimiter Plugin
-* The implementation of current limiting algorithm of Apache ShenYu gateway is
based on `redis`.
+## 1.2 Appropriate Scenario
+* traffic control in gateway cluster environment
+* rate limiting according to specific rules
* You can set to the interface level, or the parameter level. How to use it
depends on your traffic configuration.
+## 1.3 Plugin functionality
-## Technical Solution
+* use redis to control gateway traffic
-### Using redis token bucket algorithm to limit traffic.
+## 1.4 Plugin code
+
+* Core Module `shenyu-plugin-ratelimiter`.
+
+* Core Class `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* Core Class `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 Added Since Which shenyu version
+
+* Since ShenYu 2.4.0
+
+## 1.6 Technical Solution
+
+### 1.6.1 Using redis token bucket algorithm to limit traffic.
- The system generates the token at a constant rate, and then puts the token
into the token bucket.
- The token bucket's capacity. When the bucket is full, the token put into it
will be discarded.
@@ -27,7 +43,7 @@ description: rateLimiter plugin

-### Using redis leaky bucket algorithm to limit traffic.
+### 1.6.2 Using redis leaky bucket algorithm to limit traffic.
- water (request) go to the leaky bucket first. The leaky bucket goes out at a
fixed speed. When the flow speed is too fast, it will overflow directly (reject
service)
@@ -35,48 +51,59 @@ description: rateLimiter plugin

-### Using redis sliding time window algorithm to limit traffic.
+### 1.6.3 Using redis sliding time window algorithm to limit traffic.
- The sliding time window maintains the count value of unit time. Whenever a
requests pass, the count value will be increased by 1. When the count value
exceeds the preset threshold, other requests in unit time will be rejected. If
the unit time has ended, clear the counter to zero and start the next round
counting.
* Flow Diagram:

+# 2. How to use plugin
-## Plugin Setting
+## 2.1 Plugin-use procedure
-* In `shenyu-admin`--> BasicConfig --> Plugin --> `rate_limiter` set to enable.
+
-* Configure redis in the plugin.
+## 2.2 Import pom
-* Currently, supporting redis patterns of single, sentinel, and cluster.
+* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
-* If it is a sentinel, cluster and other multi-node configuration in URL,
please use `;` for each instance; Division. For example, 192.168.1.1:6379;
192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
-* If the user don't use, please disable the plugin in the background.
+## 2.3 Enable plugin
-## Plugin Detail
+* In `shenyu-admin`--> BasicConfig --> Plugin --> `rateLimiter` set to enable.
-* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
+## 2.4 Config plugin
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 Plugin Config
+
+
-For more information on selectors and rules configuration, see [Selector And
Rule Config](../../user-guide/admin-usage/selector-and-rule) , only some of the
fields are covered here.
+* `mode`: the working mode of redis, the default is single-point mode:
`standalone`, in addition to cluster
+ mode: `cluster`, sentinel mode: `sentinel`.
+* `master`: default is master.
+* `url`: configure the IP and port of the redis database, configured by colon
connection, example: `192.168.1.1:6379`.
-* Rules Handler Details
+* `password`: the password of the redis database, if not, you can not
configure.
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en-1.png"
width="80%" height="80%" />
+### 2.4.2 Selector Config
+* Selectors and rules, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule)
+
+### 2.4.3 Rule Config
+
+
* TokenBucket/Concurrent
@@ -107,3 +134,60 @@ For more information on selectors and rules configuration,
see [Selector And Rul
* `burstCapacity`: The maximum number of requests in the time window (per
unit time).
* `keyResolverName`: `whole` indicates that the traffic is limited by
gateway per second, and `remoteAddress` indicates that the traffic is limited
by IP per second.
+
+## 2.5 Examples
+
+### 2.5.1 Limit traffic with `RateLimiter` plugin in gateway cluster
environment
+
+#### 2.5.1.1 Preparation
+
+- Start ShenYu Admin on `10.10.10.10:9095`
+- Start two ShenYu Bootstrap on `10.10.10.20:9195` and `10.10.10.30:9195`, and
config data sync center on `10.10.10.10:9095`
+- config nginx, for example:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 Plugin/Selector/Rule Configuration
+
+- config redis configuration with ratelimiter plugin
+
+- config selector
+
+- config rule
+
+
+
+replenishRate is 3, burstCapacity is 10
+
+#### 2.5.1.3 Send Request to `Ngin`x by `Apache Jmeter`
+
+* jmeter thread group configuration
+
+
+
+* jmeter http request configuration
+
+
+
+#### 2.5.1.4 Check Result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `rateLimiter` set Status
disable.
diff --git
a/versioned_docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/versioned_docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
index e9ca1bdfb9..309f01df1b 100644
---
a/versioned_docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/versioned_docs/version-2.4.1/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,20 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter plugin
---
-## Description
+# 1. Overview
-* RateLimiter is core implementation of gateway restrictions on network
traffic.
+## 1.1 Plugin Name
-* the Apache ShenYu gateway provides a variety of current limiting algorithms,
including `token bucket algorithm`, `concurrent token bucket algorithm`, `leaky
bucket algorithm` and `sliding time window algorithm`.
+* RateLimiter Plugin
-* The implementation of current limiting algorithm of Apache ShenYu gateway is
based on `redis`.
+## 1.2 Appropriate Scenario
+* traffic control in gateway cluster environment
+* rate limiting according to specific rules
* You can set to the interface level, or the parameter level. How to use it
depends on your traffic configuration.
+## 1.3 Plugin functionality
-## Technical Solution
+* use redis to control gateway traffic
-#### Using redis token bucket algorithm to limit traffic.
+## 1.4 Plugin code
+
+* Core Module `shenyu-plugin-ratelimiter`.
+
+* Core Class `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* Core Class `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 Added Since Which shenyu version
+
+* Since ShenYu 2.4.0
+
+## 1.6 Technical Solution
+
+### 1.6.1 Using redis token bucket algorithm to limit traffic.
- The system generates the token at a constant rate, and then puts the token
into the token bucket.
- The token bucket's capacity. When the bucket is full, the token put into it
will be discarded.
@@ -27,7 +43,7 @@ description: rateLimiter plugin

-#### Using redis leaky bucket algorithm to limit traffic.
+### 1.6.2 Using redis leaky bucket algorithm to limit traffic.
- water (request) go to the leaky bucket first. The leaky bucket goes out at a
fixed speed. When the flow speed is too fast, it will overflow directly (reject
service)
@@ -35,48 +51,59 @@ description: rateLimiter plugin

-#### Using redis sliding time window algorithm to limit traffic.
+### 1.6.3 Using redis sliding time window algorithm to limit traffic.
- The sliding time window maintains the count value of unit time. Whenever a
requests pass, the count value will be increased by 1. When the count value
exceeds the preset threshold, other requests in unit time will be rejected. If
the unit time has ended, clear the counter to zero and start the next round
counting.
* Flow Diagram:

+# 2. How to use plugin
-## Plugin Setting
+## 2.1 Plugin-use procedure
-* In `shenyu-admin`--> BasicConfig --> Plugin --> `rate_limiter` set to enable.
+
-* Configure redis in the plugin.
+## 2.2 Import pom
-* Currently, supporting redis patterns of single, sentinel, and cluster.
+* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
-* If it is a sentinel, cluster and other multi-node configuration in URL,
please use `;` for each instance; Division. For example, 192.168.1.1:6379;
192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
-* If the user don't use, please disable the plugin in the background.
+## 2.3 Enable plugin
-## Plugin Detail
+* In `shenyu-admin`--> BasicConfig --> Plugin --> `rateLimiter` set to enable.
-* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
+## 2.4 Config plugin
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 Plugin Config
+
+
-For more information on selectors and rules configuration, see [Selector And
Rule Config](../../user-guide/admin-usage/selector-and-rule) , only some of the
fields are covered here.
+* `mode`: the working mode of redis, the default is single-point mode:
`standalone`, in addition to cluster
+ mode: `cluster`, sentinel mode: `sentinel`.
+* `master`: default is master.
+* `url`: configure the IP and port of the redis database, configured by colon
connection, example: `192.168.1.1:6379`.
-* Rules Handler Details
+* `password`: the password of the redis database, if not, you can not
configure.
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en-1.png"
width="80%" height="80%" />
+### 2.4.2 Selector Config
+* Selectors and rules, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule)
+
+### 2.4.3 Rule Config
+
+
* TokenBucket/Concurrent
@@ -107,3 +134,60 @@ For more information on selectors and rules configuration,
see [Selector And Rul
* `burstCapacity`: The maximum number of requests in the time window (per
unit time).
* `keyResolverName`: `whole` indicates that the traffic is limited by
gateway per second, and `remoteAddress` indicates that the traffic is limited
by IP per second.
+
+## 2.5 Examples
+
+### 2.5.1 Limit traffic with `RateLimiter` plugin in gateway cluster
environment
+
+#### 2.5.1.1 Preparation
+
+- Start ShenYu Admin on `10.10.10.10:9095`
+- Start two ShenYu Bootstrap on `10.10.10.20:9195` and `10.10.10.30:9195`, and
config data sync center on `10.10.10.10:9095`
+- config nginx, for example:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 Plugin/Selector/Rule Configuration
+
+- config redis configuration with ratelimiter plugin
+
+- config selector
+
+- config rule
+
+
+
+replenishRate is 3, burstCapacity is 10
+
+#### 2.5.1.3 Send Request to `Ngin`x by `Apache Jmeter`
+
+* jmeter thread group configuration
+
+
+
+* jmeter http request configuration
+
+
+
+#### 2.5.1.4 Check Result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `rateLimiter` set Status
disable.
diff --git
a/versioned_docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/versioned_docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
index e9ca1bdfb9..309f01df1b 100644
---
a/versioned_docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/versioned_docs/version-2.4.2/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,20 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter plugin
---
-## Description
+# 1. Overview
-* RateLimiter is core implementation of gateway restrictions on network
traffic.
+## 1.1 Plugin Name
-* the Apache ShenYu gateway provides a variety of current limiting algorithms,
including `token bucket algorithm`, `concurrent token bucket algorithm`, `leaky
bucket algorithm` and `sliding time window algorithm`.
+* RateLimiter Plugin
-* The implementation of current limiting algorithm of Apache ShenYu gateway is
based on `redis`.
+## 1.2 Appropriate Scenario
+* traffic control in gateway cluster environment
+* rate limiting according to specific rules
* You can set to the interface level, or the parameter level. How to use it
depends on your traffic configuration.
+## 1.3 Plugin functionality
-## Technical Solution
+* use redis to control gateway traffic
-#### Using redis token bucket algorithm to limit traffic.
+## 1.4 Plugin code
+
+* Core Module `shenyu-plugin-ratelimiter`.
+
+* Core Class `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* Core Class `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 Added Since Which shenyu version
+
+* Since ShenYu 2.4.0
+
+## 1.6 Technical Solution
+
+### 1.6.1 Using redis token bucket algorithm to limit traffic.
- The system generates the token at a constant rate, and then puts the token
into the token bucket.
- The token bucket's capacity. When the bucket is full, the token put into it
will be discarded.
@@ -27,7 +43,7 @@ description: rateLimiter plugin

-#### Using redis leaky bucket algorithm to limit traffic.
+### 1.6.2 Using redis leaky bucket algorithm to limit traffic.
- water (request) go to the leaky bucket first. The leaky bucket goes out at a
fixed speed. When the flow speed is too fast, it will overflow directly (reject
service)
@@ -35,48 +51,59 @@ description: rateLimiter plugin

-#### Using redis sliding time window algorithm to limit traffic.
+### 1.6.3 Using redis sliding time window algorithm to limit traffic.
- The sliding time window maintains the count value of unit time. Whenever a
requests pass, the count value will be increased by 1. When the count value
exceeds the preset threshold, other requests in unit time will be rejected. If
the unit time has ended, clear the counter to zero and start the next round
counting.
* Flow Diagram:

+# 2. How to use plugin
-## Plugin Setting
+## 2.1 Plugin-use procedure
-* In `shenyu-admin`--> BasicConfig --> Plugin --> `rate_limiter` set to enable.
+
-* Configure redis in the plugin.
+## 2.2 Import pom
-* Currently, supporting redis patterns of single, sentinel, and cluster.
+* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
-* If it is a sentinel, cluster and other multi-node configuration in URL,
please use `;` for each instance; Division. For example, 192.168.1.1:6379;
192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
-* If the user don't use, please disable the plugin in the background.
+## 2.3 Enable plugin
-## Plugin Detail
+* In `shenyu-admin`--> BasicConfig --> Plugin --> `rateLimiter` set to enable.
-* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
+## 2.4 Config plugin
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 Plugin Config
+
+
-For more information on selectors and rules configuration, see [Selector And
Rule Config](../../user-guide/admin-usage/selector-and-rule) , only some of the
fields are covered here.
+* `mode`: the working mode of redis, the default is single-point mode:
`standalone`, in addition to cluster
+ mode: `cluster`, sentinel mode: `sentinel`.
+* `master`: default is master.
+* `url`: configure the IP and port of the redis database, configured by colon
connection, example: `192.168.1.1:6379`.
-* Rules Handler Details
+* `password`: the password of the redis database, if not, you can not
configure.
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en-1.png"
width="80%" height="80%" />
+### 2.4.2 Selector Config
+* Selectors and rules, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule)
+
+### 2.4.3 Rule Config
+
+
* TokenBucket/Concurrent
@@ -107,3 +134,60 @@ For more information on selectors and rules configuration,
see [Selector And Rul
* `burstCapacity`: The maximum number of requests in the time window (per
unit time).
* `keyResolverName`: `whole` indicates that the traffic is limited by
gateway per second, and `remoteAddress` indicates that the traffic is limited
by IP per second.
+
+## 2.5 Examples
+
+### 2.5.1 Limit traffic with `RateLimiter` plugin in gateway cluster
environment
+
+#### 2.5.1.1 Preparation
+
+- Start ShenYu Admin on `10.10.10.10:9095`
+- Start two ShenYu Bootstrap on `10.10.10.20:9195` and `10.10.10.30:9195`, and
config data sync center on `10.10.10.10:9095`
+- config nginx, for example:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 Plugin/Selector/Rule Configuration
+
+- config redis configuration with ratelimiter plugin
+
+- config selector
+
+- config rule
+
+
+
+replenishRate is 3, burstCapacity is 10
+
+#### 2.5.1.3 Send Request to `Ngin`x by `Apache Jmeter`
+
+* jmeter thread group configuration
+
+
+
+* jmeter http request configuration
+
+
+
+#### 2.5.1.4 Check Result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `rateLimiter` set Status
disable.
diff --git
a/versioned_docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
b/versioned_docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
index 6d41087e14..d8503332bc 100644
---
a/versioned_docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
+++
b/versioned_docs/version-2.4.3/plugin-center/fault-tolerance/rate-limiter-plugin.md
@@ -4,20 +4,36 @@ keywords: ["rateLimiter"]
description: rateLimiter plugin
---
-## Description
+# 1. Overview
-* `RateLimiter` is core implementation of gateway restrictions on network
traffic.
+## 1.1 Plugin Name
-* the Apache ShenYu gateway provides a variety of current limiting algorithms,
including `token bucket algorithm`, `concurrent token bucket algorithm`, `leaky
bucket algorithm` and `sliding time window algorithm`.
+* RateLimiter Plugin
-* The implementation of current limiting algorithm of Apache ShenYu gateway is
based on `redis`.
+## 1.2 Appropriate Scenario
+* traffic control in gateway cluster environment
+* rate limiting according to specific rules
* You can set to the interface level, or the parameter level. How to use it
depends on your traffic configuration.
+## 1.3 Plugin functionality
-## Technical Solution
+* use redis to control gateway traffic
-#### Using redis token bucket algorithm to limit traffic.
+## 1.4 Plugin code
+
+* Core Module `shenyu-plugin-ratelimiter`.
+
+* Core Class `org.apache.shenyu.plugin.ratelimiter.RateLimiterPlugin`
+* Core Class `org.apache.shenyu.plugin.ratelimiter.executor.RedisRateLimiter`
+
+## 1.5 Added Since Which shenyu version
+
+* Since ShenYu 2.4.0
+
+## 1.6 Technical Solution
+
+### 1.6.1 Using redis token bucket algorithm to limit traffic.
- The system generates the token at a constant rate, and then puts the token
into the token bucket.
- The token bucket's capacity. When the bucket is full, the token put into it
will be discarded.
@@ -27,7 +43,7 @@ description: rateLimiter plugin

-#### Using redis leaky bucket algorithm to limit traffic.
+### 1.6.2 Using redis leaky bucket algorithm to limit traffic.
- water (request) go to the leaky bucket first. The leaky bucket goes out at a
fixed speed. When the flow speed is too fast, it will overflow directly (reject
service)
@@ -35,48 +51,59 @@ description: rateLimiter plugin

-#### Using redis sliding time window algorithm to limit traffic.
+### 1.6.3 Using redis sliding time window algorithm to limit traffic.
- The sliding time window maintains the count value of unit time. Whenever a
requests pass, the count value will be increased by 1. When the count value
exceeds the preset threshold, other requests in unit time will be rejected. If
the unit time has ended, clear the counter to zero and start the next round
counting.
* Flow Diagram:

+# 2. How to use plugin
-## Plugin Setting
+## 2.1 Plugin-use procedure
-* In `shenyu-admin`--> BasicConfig --> Plugin --> `rate_limiter` set to enable.
+
-* Configure redis in the plugin.
+## 2.2 Import pom
-* Currently, supporting redis patterns of single, sentinel, and cluster.
+* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
-* If it is a sentinel, cluster and other multi-node configuration in URL,
please use `;` for each instance; Division. For example, 192.168.1.1:6379;
192.168.1.2:6379。
+```xml
+<!-- apache shenyu ratelimiter plugin start-->
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
+ <version>${project.version}</version>
+</dependency>
+<!-- apache shenyu ratelimiter plugin end-->
+```
-* If the user don't use, please disable the plugin in the background.
+## 2.3 Enable plugin
-## Plugin Detail
+* In `shenyu-admin`--> BasicConfig --> Plugin --> `rateLimiter` set to enable.
-* Add `rateLimiter` dependency in `pom.xml` file of the gateway.
+## 2.4 Config plugin
-```xml
- <!-- apache shenyu ratelimiter plugin start-->
- <dependency>
- <groupId>org.apache.shenyu</groupId>
- <artifactId>shenyu-spring-boot-starter-plugin-ratelimiter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- apache shenyu ratelimiter plugin end-->
-```
+### 2.4.1 Plugin Config
+
+
-For more information on selectors and rules configuration, see [Selector And
Rule Config](../../user-guide/admin-usage/selector-and-rule) , only some of the
fields are covered here.
+* `mode`: the working mode of redis, the default is single-point mode:
`standalone`, in addition to cluster
+ mode: `cluster`, sentinel mode: `sentinel`.
+* `master`: default is master.
+* `url`: configure the IP and port of the redis database, configured by colon
connection, example: `192.168.1.1:6379`.
-* Rules Handler Details
+* `password`: the password of the redis database, if not, you can not
configure.
-<img src="/img/shenyu/plugin/ratelimiter/ratelimiter-plugin-en-1.png"
width="80%" height="80%" />
+### 2.4.2 Selector Config
+* Selectors and rules, please refer to: [Selector And Rule
Config](../../user-guide/admin-usage/selector-and-rule)
+
+### 2.4.3 Rule Config
+
+
* TokenBucket/Concurrent
@@ -107,3 +134,60 @@ For more information on selectors and rules configuration,
see [Selector And Rul
* `burstCapacity`: The maximum number of requests in the time window (per
unit time).
* `keyResolverName`: `whole` indicates that the traffic is limited by
gateway per second, and `remoteAddress` indicates that the traffic is limited
by IP per second.
+
+## 2.5 Examples
+
+### 2.5.1 Limit traffic with `RateLimiter` plugin in gateway cluster
environment
+
+#### 2.5.1.1 Preparation
+
+- Start ShenYu Admin on `10.10.10.10:9095`
+- Start two ShenYu Bootstrap on `10.10.10.20:9195` and `10.10.10.30:9195`, and
config data sync center on `10.10.10.10:9095`
+- config nginx, for example:
+
+```conf
+upstream shenyu_gateway_cluster {
+ ip_hash;
+ server 10.1.1.1:9195 max_fails=3 fail_timeout=10s weight=50;
+ server 10.1.1.2:9195 max_fails=3 fail_timeout=10s weight=50;
+}
+
+server {
+ location / {
+ proxy_pass http://shenyu_gateway_cluster;
+ proxy_set_header HOST $host;
+ proxy_read_timeout 10s;
+ proxy_connect_timeout 10s;
+ }
+}
+```
+
+#### 2.5.1.2 Plugin/Selector/Rule Configuration
+
+- config redis configuration with ratelimiter plugin
+
+- config selector
+
+- config rule
+
+
+
+replenishRate is 3, burstCapacity is 10
+
+#### 2.5.1.3 Send Request to `Nginx` by `Apache Jmeter`
+
+* jmeter thread group configuration
+
+
+
+* jmeter http request configuration
+
+
+
+#### 2.5.1.4 Check Result
+
+
+
+# 3. How to disable plugin
+
+- In `shenyu-admin` --> BasicConfig --> Plugin --> `rateLimiter` set Status
disable.