You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/09/05 05:40:14 UTC

[shardingsphere] branch master updated: Modify load balance algorithm (#20786)

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

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new b8722bdb6c5 Modify load balance algorithm (#20786)
b8722bdb6c5 is described below

commit b8722bdb6c5be2a231798f759da848ccaace1ca8
Author: ZhangCheng <fl...@outlook.com>
AuthorDate: Mon Sep 5 13:40:07 2022 +0800

    Modify load balance algorithm (#20786)
---
 .../builtin-algorithm/load-balance.cn.md           | 103 ++++++++++++++++++---
 .../builtin-algorithm/load-balance.en.md           | 103 ++++++++++++++++++---
 2 files changed, 182 insertions(+), 24 deletions(-)

diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md
index c7e570d37bc..f4e8ce064b7 100644
--- a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md
+++ b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.cn.md
@@ -9,18 +9,97 @@ ShardingSphere 内置提供了多种负载均衡算法,具体包括了轮询
 
 ## 参数解释
 
-|    *Type*   | *Describe* | *Limitations* |
-| -------- | ------------- | ------------ |
-| ROUND_ROBIN  | 事务内,读请求路由到 primary,事务外,采用轮询策略路由到 replica | |
-| RANDOM    |事务内,读请求路由到 primary,事务外,采用随机策略路由到 replica| |
-| WEIGHT    | 事务内,读请求路由到 primary,事务外,采用权重策略路由到 replica| 需配置属性,属性名:${replica-name},数据类型:double, 属性名字使用读库名字,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。|
-| TRANSACTION_RANDOM  |显示/非显示开启事务,读请求采用随机策略路由到多个 replica| |
-| TRANSACTION_ROUND_ROBIN  |显示/非显示开启事务,读请求采用轮询策略路由到多个 replica| |
-| TRANSACTION_WEIGHT  |显示/非显示开启事务,读请求采用权重策略路由到多个 replica| 需配置属性,属性名:${replica-name},数据类型:double, 属性名字使用读库名字,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
-| FIXED_REPLICA_RANDOM  |显示开启事务,读请求采用随机策略路由到一个固定 replica;不开事务,每次读流量使用随机策略路由到不同的 replica| |
-| FIXED_REPLICA_ROUND_ROBIN  |显示开启事务,读请求采用轮询策略路由到一个固定 replica;不开事务,每次读流量使用轮询策略路由到不同的 replica| |
-| FIXED_REPLICA_WEIGHT  |显示开启事务,读请求采用权重策略路由到一个固定 replica;不开事务,每次读流量使用权重策略路由到不同的 replica| 需配置属性,属性名:${replica-name},数据类型:double, 属性名字使用读库名字,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
-| FIXED_PRIMARY  |读请求全部路由到 primary|
+### 轮询负载均衡算法
+
+类型:ROUND_ROBIN
+
+说明:事务内,读请求路由到 primary,事务外,采用轮询策略路由到 replica。
+
+可配置属性:无
+
+### 随机负载均衡算法
+
+类型:RANDOM
+
+说明:事务内,读请求路由到 primary,事务外,采用随机策略路由到 replica。
+
+可配置属性:无
+
+### 权重负载均衡算法
+
+类型:WEIGHT
+
+说明:事务内,读请求路由到 primary,事务外,采用权重策略路由到 replica。
+
+可配置属性:
+
+| *属性名称*      | *数据类型* | *说明*                                                         |
+| -------------- | -------- |--------------------------------------------------------------|
+| ${replica-name} |   double    | 属性名使用读库名称,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
+
+### 事务随机负载均衡算法
+
+类型:TRANSACTION_RANDOM
+
+说明:显示/非显示开启事务,读请求采用随机策略路由到多个 replica。
+
+可配置属性:无
+
+### 事务轮询负载均衡算法
+
+类型:TRANSACTION_ROUND_ROBIN
+
+说明:显示/非显示开启事务,读请求采用轮询策略路由到多个 replica。
+
+可配置属性:无
+
+### 事务权重负载均衡算法
+
+类型:TRANSACTION_WEIGHT
+
+说明:显示/非显示开启事务,读请求采用权重策略路由到多个 replica。
+
+可配置属性:
+
+| *属性名称*      | *数据类型* | *说明*                                                         |
+| -------------- | -------- |--------------------------------------------------------------|
+| ${replica-name} |   double    | 属性名使用读库名称,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
+
+### 固定副本随机负载均衡算法
+
+类型:FIXED_REPLICA_RANDOM
+
+说明:显示开启事务,读请求采用随机策略路由到一个固定 replica;不开事务,每次读流量使用随机策略路由到不同的 replica。
+
+可配置属性:无
+
+### 固定副本轮询负载均衡算法
+
+类型:FIXED_REPLICA_ROUND_ROBIN
+
+说明:显示开启事务,读请求采用轮询策略路由到一个固定 replica;不开事务,每次读流量使用轮询策略路由到不同的 replica。
+
+可配置属性:无
+
+### 固定副本权重负载均衡算法
+
+类型:FIXED_REPLICA_WEIGHT
+
+说明:显示开启事务,读请求采用权重策略路由到一个固定 replica;不开事务,每次读流量使用权重策略路由到不同的 replica。
+
+可配置属性:
+
+| *属性名称*      | *数据类型* | *说明*                                                         |
+| -------------- | -------- |--------------------------------------------------------------|
+| ${replica-name} |   double    | 属性名使用读库名称,参数填写读库对应的权重值。权重参数范围最小值 > 0,合计 <= Double.MAX_VALUE。 |
+
+### 固定主库负载均衡算法
+
+类型:FIXED_PRIMARY
+
+说明:读请求全部路由到 primary
+
+可配置属性:无
 
 ## 操作步骤
 
diff --git a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md
index f5c5a597a9b..d0aabb61ce6 100644
--- a/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md
+++ b/docs/document/content/user-manual/common-config/builtin-algorithm/load-balance.en.md
@@ -11,18 +11,97 @@ Moreover, considering the complexity of the business scenario, the built-in algo
 
 ## Parameters
 
-|    *Type*   | *Describe* | *Limitations* |
-| -------- | ------------- | ------------ |
-| ROUND_ROBIN  | Within the transaction, read query are routed to the primary, and outside the transaction, the round-robin strategy is used to route to the replica | |
-| RANDOM    |Within the transaction, read query are routed to the primary, and outside the transaction, the random strategy is used to route to the replica| |
-| WEIGHT    | Within the transaction, read query are routed to the primary, and outside the transaction, the weight strategy is used to route to the replica| Attributes need to be configured, attribute name: ${replica-name}, data type: double, attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE.|
-| TRANSACTION_RANDOM  |Display/non-display open transaction, read query are routed to multiple replicas using random strategy| |
-| TRANSACTION_ROUND_ROBIN  |Display/non-display open transaction, read query are routed to multiple replicas using round-robin strategy| |
-| TRANSACTION_WEIGHT  |Display/non-display open transaction, read query are routed to multiple replicas using weight strategy| Attributes need to be configured, attribute name: ${replica-name}, data type: double, attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE.|
-| FIXED_REPLICA_RANDOM  |Open transaction displayed, and the read query is routed to a fixed replica using random strategy; otherwise, each read traffic is routed to a different replica using random strategy| |
-| FIXED_REPLICA_ROUND_ROBIN  |Open transaction displayed, and the read query is routed to a fixed replica using round-robin strategy; otherwise, each read traffic is routed to a different replica using round-robin strategy| |
-| FIXED_REPLICA_WEIGHT  |Open transaction displayed, and the read query is routed to a fixed replica using weight strategy; otherwise, each read traffic is routed to a different replica using weight strategy| Attributes need to be configured, attribute name: ${replica-name}, data type: double, attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE. |
-| FIXED_PRIMARY  |All read query are routed to the primary|
+### Round-robin Load Balance Algorithm
+
+Type: ROUND_ROBIN
+
+Description: Within the transaction, read query are routed to the primary, and outside the transaction, the round-robin strategy is used to route to the replica.
+
+Attributes: None
+
+### Random Load Balance Algorithm
+
+Type: RANDOM
+
+Description: Within the transaction, read query are routed to the primary, and outside the transaction, the random strategy is used to route to the replica.
+
+Attributes: None
+
+### Weight Load Balance Algorithm
+
+Type: WEIGHT
+
+Description: Within the transaction, read query are routed to the primary, and outside the transaction, the weight strategy is used to route to the replica.
+
+Attributes: 
+
+| *Name*         | *DataType* | *Description*                                                                                                                                                                     |
+| -------------- |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| ${replica-name} | double     | Attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE. |
+
+### Transaction Random Load Balance Algorithm
+
+Type: TRANSACTION_RANDOM
+
+Description: Display/non-display open transaction, read query are routed to multiple replicas using random strategy.
+
+Attributes: None
+
+### Transaction Round-robin Load Balance Algorithm
+
+Type: TRANSACTION_ROUND_ROBIN
+
+Description: Display/non-display open transaction, read query are routed to multiple replicas using round-robin strategy.
+
+Attributes: None
+
+### Transaction Weight Load Balance Algorithm
+
+Type: TRANSACTION_WEIGHT
+
+Description: Display/non-display open transaction, read query are routed to multiple replicas using weight strategy.
+
+Attributes: 
+
+| *Name*         | *DataType* | *Description*                                                                                                                                                                     |
+| -------------- |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| ${replica-name} | double     | Attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE. |
+
+### Fixed Replica Random Load Balance Algorithm
+
+Type: FIXED_REPLICA_RANDOM
+
+Description: Open transaction displayed, and the read query is routed to a fixed replica using random strategy; otherwise, each read traffic is routed to a different replica using random strategy.
+
+Attributes: None
+
+### Fixed Replica Round-robin Load Balance Algorithm
+
+Type: FIXED_REPLICA_ROUND_ROBIN
+
+Description: Open transaction displayed, and the read query is routed to a fixed replica using round-robin strategy; otherwise, each read traffic is routed to a different replica using round-robin strategy.
+
+Attributes: None
+
+### Fixed Replica Weight Load Balance Algorithm
+
+Type: FIXED_REPLICA_WEIGHT
+
+Description: Open transaction displayed, and the read query is routed to a fixed replica using weight strategy; otherwise, each read traffic is routed to a different replica using weight strategy.
+
+Attributes: 
+
+| *Name*         | *DataType* | *Description*                                                                                                                                                                     |
+| -------------- |------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| ${replica-name} | double     | Attribute name uses the name of the replica, and the parameter fills in the weight value corresponding to the replica. Weight parameter range min > 0, total <= Double.MAX_VALUE. |
+
+### Fixed Primary Load Balance Algorithm
+
+Type: FIXED_PRIMARY
+
+Description: All read query are routed to the primary.
+
+Attributes: None
 
 ## Procedure