源码阅读流程图直通车:https://github.com/beardlessCat/code_images
beardlesscat / im Goto Github PK
View Code? Open in Web Editor NEW(1)基于netty集群开发Im,通过zookeeper作为注册中心。(2)服务集群连接支持多种负载均衡策略(3)集群间消息转发提供多种解决方案。
(1)基于netty集群开发Im,通过zookeeper作为注册中心。(2)服务集群连接支持多种负载均衡策略(3)集群间消息转发提供多种解决方案。
源码阅读流程图直通车:https://github.com/beardlessCat/code_images
1.集群情况下,其中的每一个server服务要别所有的server建立连接吧.集群项目启动的时候只能一个一个启动吧,如果同时启动会出现有的server和server之间的连接建立会漏掉.
2.横向扩容的时候也只能一台一台的扩容吧.
3.如果在消息发送的时候一台server突然挂掉了.那这个消息从client到server就失败了.消息就会丢掉.(这个可以从链路上做分段ack缓存失败的消息)
4.如果在消息发送的时候一台server突然挂掉了,已经到达当前server的消息就会丢失.
hi,master分支下面的随机选择节点有点疑问请教一下:
protected ServerNode doSelect(List<ServerNode> serverNodes) {
int size = serverNodes.size();
int[] weights = new int[size];
int total = 0 ;
for(int i=0;i<size;i++){
Integer weight = serverNodes.get(i).getWeight();
total+=weight;
weights[i] = total;
}
//类似于抽奖算法
int randomIndex = ThreadLocalRandom.current().nextInt(weights[size - 1]);
for(int index = 0;index<size;index++){
if(randomIndex < weights[index]){
return serverNodes.get(index);
}
}
return serverNodes.get(ThreadLocalRandom.current().nextInt(serverNodes.size()));
}
0客户端的时候启动2个服务节点,此时2个服务节点的权重weight是不是都是0?
如果是的话
int randomIndex = ThreadLocalRandom.current().nextInt(weights[size - 1]);
这个里面的nextInt一直时0,会报错吧?
无法加载maven依赖,项目无pom文件
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.