当前位置:网站首页>Myrpc version 6
Myrpc version 6
2022-06-30 04:13:00 【Winter dream chaser】
RPC The concept of
Background knowledge
- RPC Basic concepts of , Core functions
common RPC frame
Duboo Basic function
- Telematics
- Transparent remote procedure call based on interface method
- Load balancing
- Service registry
RPC The process
client Call the remote method -> request serialize -> Protocol code -> Network transmission -> Server side -> Deserialization request -> Call the local method to get response -> serialize -> code ->……
Version iteration process
Catalog
from 0 At the beginning RPC Iterative process of :
- version0 edition : Complete a with less than 100 lines of code RPC Example
- version1 edition : Improve the common message format (request,response), The client's dynamic proxy completes the request Encapsulation of message formats
- version2 edition : Support the server to expose multiple service interfaces , Server program abstraction , Normalization
- version3 edition : Use a high-performance network framework netty The realization of network communication , And the refactoring of client code
- version4 edition : Custom message format , Support multiple serialization methods (java Native , json…)
- version5 edition : Implementation of server registration and discovery ,zookeeper As a registry
- version6 edition : Implementation of load balancing strategy
6.MyRPC edition 6
our RPC The overall framework already exists , Next, there are some modules that have expanded functions
Background knowledge
- Load balancing
Questions in this section
- If a service is supported by multiple providers , How to disperse the pressure of service providers
Upgrade process
- Load balancing interface
/** * Give the server address list , Choose one according to different load balancing strategies */
public interface LoadBalance {
String balance(List<String> addressList);
}
- Two ways of implementation
/** * Random load balancing */
public class RandomLoadBalance implements LoadBalance{
@Override
public String balance(List<String> addressList) {
Random random = new Random();
int choose = random.nextInt(addressList.size());
System.out.println(" Load balancing selects " + choose + " The server ");
return addressList.get(choose);
}
}
/** * Polling load balancing */
public class RoundLoadBalance implements LoadBalance{
private int choose = -1;
@Override
public String balance(List<String> addressList) {
choose++;
choose = choose%addressList.size();
return addressList.get(choose);
}
}
stay Service discovery methods Using load balancing in
List<String> strings = client.getChildren().forPath("/" + serviceName);
result
We started two service providers
It can be seen that the load balancing strategy has been successful
summary
In this version , We implement two strategies for load balancing : Random and polling .
In this version , A fully functional RPC Already appeared , Of course, there is still a lot of work to be done in terms of performance and code quality .
边栏推荐
- JS reflect
- dotnet-exec 0.5.0 released
- [image fusion] multi focus and multi spectral image fusion based on cross bilateral filter and weighted average with matlab code
- If you encounter problems when using spark for the first time, please ask for help
- Green new power and "zero" burden of computing power -- JASMINER X4 series is popular
- [summary of skimming questions] database questions are summarized by knowledge points (continuous update / simple and medium questions have been completed)
- How to analyze and solve the problem of easycvr kernel port error through process startup?
- 毕业设计EMS办公管理系统(B/S结构)+J2EE+SQLserver8.0
- 第九天 脚本与资源管理
- SQL server2005中SUM函数中条件筛选(IF)语法报错
猜你喜欢
The jupyter notebook kernel hangs up frequently and needs to be restarted
[Thesis reading | deep reading] role2vec:role based graph embeddings
You know AI, database and computer system
如何通过进程启动来分析和解决EasyCVR内核端口报错问题?
Slam mapping, automatic navigation and obstacle avoidance based on ROS (bingda robot)
A solution to the problem of "couldn't open file /mnt/repodata/repomd.xml"
Postman learning sharing
Technology sharing | broadcast function design in integrated dispatching
学校实训要做一个注册页面,要打开数据库把注册页面输入的内容存进数据库但是
Blue Bridge Cup: magic cube rotation [Vocational group]
随机推荐
解决navicat连接数据库遇到的问题
两个月拿到N个offer,什么难搞的面试官在我这里都不算事
Knowledge - how to build rapport in sales with 3 simple skills
学校实训要做一个注册页面,要打开数据库把注册页面输入的内容存进数据库但是
You know AI, database and computer system
SQLyog导入数据库时报错,求帮解决!
After the win10 system uses the browser to download, the content is moved or deleted without reason
When easycvr deploys a server cluster, what is the reason why one is online and the other is offline?
The jupyter notebook kernel hangs up frequently and needs to be restarted
Cloud native -- websocket of Web real-time communication technology
Unity 在编辑器中输入字符串时,转义字符的输入
Geometric objects in shapely
基于海康EhomeDemo工具排查公网部署出现的视频播放异常问题
使用IDEAL连接数据库,运行出来了 结果显示一些警告,这部分怎么处理
绿色新动力,算力“零”负担——JASMINER X4系列火爆热销中
mysql更新数组形式的json串
(04).NET MAUI实战 MVVM
Day 12 advanced programming techniques
base64.c
Simple theoretical derivation of SVM (notes)