Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
go-etcd-grpc-load-balance
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ChenHongyu
go-etcd-grpc-load-balance
Commits
87e8240c
Commit
87e8240c
authored
Jun 01, 2021
by
ChenHongyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
README.md
parent
d560a1fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
5 deletions
+23
-5
README.md
README.md
+23
-5
image-20210601184042079.png
image/image-20210601184042079.png
+0
-0
image-20210601184546643.png
image/image-20210601184546643.png
+0
-0
No files found.
README.md
View file @
87e8240c
# 基于 Etcd 和 gRPC 的负载均衡
# 基于 Etcd 和 gRPC 的负载均衡
...
@@ -47,27 +49,43 @@ round-robin会对 address 去重, 所以要加一些信息
...
@@ -47,27 +49,43 @@ round-robin会对 address 去重, 所以要加一些信息
## roundrobin策略
## 基于roundrobin负载策略实现按权轮询
## lb_demo1 roundrobin策略
普通地轮询
## lb_demo2 基于roundrobin策略实现按权轮询
根据权重加入多个重复的 addr, 然后轮询, 实现带权轮询的效果
## lb_demo3 自定义负载策略实现按权轮询

## 自定义负载策略实现按权轮询
在构造
`resolver.Address`
时将
`weight`
作为
`*attributes.Attributes`
附加值代入

重构 Build 和 Pick 接口, 使用 Build 构造
[
]balancer.SubConn列表, 然后用 Pick 在列表中选出接收请求的通道
示例代码仓库
##
示例代码仓库
-
[
ChenHongyu / go-etcd-grpc-load-balance · GitLab (33.cn)
](
https://gitlab.33.cn/chy/go-etcd-grpc-load-balance
)
-
[
ChenHongyu / go-etcd-grpc-load-balance · GitLab (33.cn)
](
https://gitlab.33.cn/chy/go-etcd-grpc-load-balance
)
参考文档
##
参考文档
-
[
grpc-go基于etcd实现服务发现机制
](
http://morecrazy.github.io/2018/08/14/grpc-go%E5%9F%BA%E4%BA%8Eetcd%E5%AE%9E%E7%8E%B0%E6%9C%8D%E5%8A%A1%E5%8F%91%E7%8E%B0%E6%9C%BA%E5%88%B6
)
-
[
grpc-go基于etcd实现服务发现机制
](
http://morecrazy.github.io/2018/08/14/grpc-go%E5%9F%BA%E4%BA%8Eetcd%E5%AE%9E%E7%8E%B0%E6%9C%8D%E5%8A%A1%E5%8F%91%E7%8E%B0%E6%9C%BA%E5%88%B6
)
...
...
image/image-20210601184042079.png
0 → 100644
View file @
87e8240c
87.4 KB
image/image-20210601184546643.png
0 → 100644
View file @
87e8240c
119 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment