当前位置:网站首页>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 .
边栏推荐
- NER中BiLSTM-CRF解读score_sentence
- 【模糊神经网络预测】基于模糊神经网络实现水质预测含Matlab源码
- Find the interface and add parameters to the form
- . Net 7 JWT configuration is too convenient!
- Day 12 advanced programming techniques
- idea灰屏问题
- How to analyze and solve the problem of easycvr kernel port error through process startup?
- 声网自研传输层协议 AUT 的落地实践丨Dev for Dev 专栏
- Es2018 key summary
- Pytorch Profiler+ Tensorboard + VS Code
猜你喜欢

Machine learning notes
![[Thesis reading | deep reading] role2vec:role based graph embeddings](/img/69/c94700fbbbda20df4e54803c703b48.png)
[Thesis reading | deep reading] role2vec:role based graph embeddings

Geometric objects in shapely

Radiant energy, irradiance and radiance

第十二天 进阶编程技术

Troubleshoot abnormal video playback problems in public network deployment based on Haikang ehomedemo tool

MySQL DDL change

DBT product initial experience

dotnet-exec 0.5.0 released

Node red series (28): communication with Siemens PLC based on OPC UA node
随机推荐
Project safety and quality
win10系统使用浏览器下载后,内容无故移动或删除
Do280 private warehouse persistent storage and chapter experiment
管道实现进程间通信之命名管道
Es2018 key summary
base64.c
[Thesis reading | deep reading] role2vec:role based graph embeddings
Concatenation of Languages(UVA10887)
Slam mapping, automatic navigation and obstacle avoidance based on ROS (bingda robot)
Pytorch Profiler+ Tensorboard + VS Code
An error occurs when sqlyog imports the database. Please help solve it!
NER中BiLSTM-CRF解读score_sentence
Titanic(POJ2361)
JS static method
Graduation project EMS office management system (b/s structure) +j2ee+sqlserver8.0
Linear interpolation of spectral response function
基于ROS的SLAM建图、自动导航、避障(冰达机器人)
matplotlib. pyplot. Hist parameter introduction
Magical Union
You know AI, database and computer system