Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.5 负载均衡 #551

Open
backendTime-coder opened this issue Sep 18, 2021 · 1 comment
Open

6.5 负载均衡 #551

backendTime-coder opened this issue Sep 18, 2021 · 1 comment

Comments

@backendTime-coder
Copy link

提示:哪一章节的问题,建议如何修改

问题一: 每次请求 shuffle 方法,都会改变切片的值。
image

问题二: 每个节点都是0.34的概率,即使每次数组都是同一个序列,为啥是第一个元素选中概率大些,而不是其他元素。这个不是很懂,求大佬指点迷津

image

@cch123
Copy link
Collaborator

cch123 commented Sep 23, 2021

这个每次要保证传进去的 slice 是一致的,其实就是一个服务端的 endpoint 列表

因为这个洗牌算法的结果不均匀,所以计算的时候要算的是不不被交换的概率(因为这个算法每次都是用第一个,所以不被交换也就意味着这个节点被选中了)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants