All Projects → yuyufeng1994 → my-rpc

yuyufeng1994 / my-rpc

Licence: other
自己编写RPC(动态代理+反射+zookeeper+netty通信),并结合Spring

Programming Languages

java
68154 projects - #9 most used programming language

Labels

Projects that are alternatives of or similar to my-rpc

core
Enterprise Grade #NodeJS Platform implementing Industry Standards & Patterns in order to provide Connectivity, Stability, High-Availability and High-Performance
Stars: ✭ 54 (+74.19%)
Mutual labels:  rpc
libcorpc
Libcorpc is a high performance coroutine base RPC framework
Stars: ✭ 20 (-35.48%)
Mutual labels:  rpc
preact-rpc
React Pre-Rendering via RPC
Stars: ✭ 28 (-9.68%)
Mutual labels:  rpc
cocolian-rpc
使用Apache Thrift作为容器,Google Protobuf作为协议的一个RPC框架。
Stars: ✭ 19 (-38.71%)
Mutual labels:  rpc
callosum
An RPC Transport Library for asyncio
Stars: ✭ 17 (-45.16%)
Mutual labels:  rpc
zbus-server
Small fast MQ and RPC
Stars: ✭ 73 (+135.48%)
Mutual labels:  rpc
nestjs-throttler-storage-redis
Redis storage provider for the nestjs-throttler package.
Stars: ✭ 56 (+80.65%)
Mutual labels:  rpc
sirdez
Glorious Binary Serialization and Deserialization for TypeScript.
Stars: ✭ 20 (-35.48%)
Mutual labels:  rpc
conan-grpc
[OBSOLETE] The recipe is now in https://github.com/conan-io/conan-center-index - Conan remote archive: https://bincrafters.jfrog.io/artifactory/api/conan/conan-legacy-inexorgame
Stars: ✭ 33 (+6.45%)
Mutual labels:  rpc
eth-contract-api
EthereumJ native API or how to call contracts easily and with type safety
Stars: ✭ 60 (+93.55%)
Mutual labels:  rpc
coreipc
WCF-like service model API for communication over named pipes and TCP. .NET and node.js clients.
Stars: ✭ 22 (-29.03%)
Mutual labels:  rpc
qtalk-go
versatile stream IO and RPC based IPC stack for Go
Stars: ✭ 29 (-6.45%)
Mutual labels:  rpc
http
Extension module of golang http service
Stars: ✭ 57 (+83.87%)
Mutual labels:  rpc
blockchain-rpc
JSON RPC client for Bitcoin, Ethereum and Omni
Stars: ✭ 26 (-16.13%)
Mutual labels:  rpc
rpc-bench
RPC Benchmark of gRPC, Aeron and KryoNet
Stars: ✭ 59 (+90.32%)
Mutual labels:  rpc
rpcx-rs
rpcx microservice framework in Rust
Stars: ✭ 95 (+206.45%)
Mutual labels:  rpc
WatsonWebsocket
A simple C# async websocket server and client for reliable transmission and receipt of data
Stars: ✭ 158 (+409.68%)
Mutual labels:  rpc
JsonRpc.Standard
An asynchronous .NET Standard library for JSON RPC client & server implementation.
Stars: ✭ 27 (-12.9%)
Mutual labels:  rpc
zcash
💵 Minimal Zcash library for Node.js
Stars: ✭ 18 (-41.94%)
Mutual labels:  rpc
metacom
RPC communication protocol for Metarhia stack 🔌
Stars: ✭ 42 (+35.48%)
Mutual labels:  rpc

my-rpc

了解RPC的一些原理后,尝试自己造个轮子,加深了解。 如果你对RPC的原理和运行机制还不够了解,我更希望你从最简单的版本开始了解。 https://github.com/yuyufeng1994/my-rpc/tree/v1

个人对rpc原理的见解

rpc是一种远程过程调用协议。rpc主要功能:异构分布式项目之间的通信,使消费者只需要知道接口,远程调用方法就像调用本地方法一样。 要使得消费层只通过接口调用远程实现方法,那么其之间的传输数据肯定是:类、方法、参数、返回值,以及一些其它传输的信息。 之间涉及到通信,肯定要发布服务供客户端请求。客户端要执行未知实现的方法,是通过动态代理实现的。 在了解动态代理的使用后,就会发现,在动态代理的方法执行过程中,可以不用去执行真实方法(invoke方法中),你可以获取到上面所需要的类、方法、参数、返回值等执行方法的参数。 那么把这些参数传输到远程去。在提供层接收到消费层方法的传参后,通过反射执行已经注册的类方法。(提供层要把暴露接口的实现类的方法注册到容器中,供查找)
自己编写rpc之前的所需的准备 -- 了解了常用rpc框架dubbo的流程。复习了动态代理。复习了java io通信。

模块说明

rpc-core

这个模块是rpc的核心部分包括网络通信,客户端动态代理,通信数据结构,Spring结合模块

rpc-service

这个模块rpc提供层暴露的接口

rpc-provider

这个模块是rpc的提供层

rpc-consumer

这个模块是rpc的消费层

依赖关系

rpc-consumer、rpc-provider为rpc使用方,所以他们两个都依赖 rpc-core 模块。 因为提供层要为消费层暴露接口,所以提取了公共接口,因此,它们两个都依赖rpc-service

启动调试

  • 使用HelloService接口进行调试。首先运行zookeeper服务,默认本地ip。
  • 启动提供层:在rpc-provider模块中运行top.yuyufeng.rpc.ServerApp.Main
  • 启动消费层:在rpc-consumer模块中运行top.yuyufeng.rpc.test.ClientApp.Main

启动调试(使用Spring)

  • 使用HelloService接口进行调试。首先运行zookeeper服务,默认本地ip。
  • 启动提供层:在rpc-provider模块中运行top.yuyufeng.rpc.ServerAppBySpring
  • 启动消费层:在rpc-consumer模块中运行top.yuyufeng.rpc.test.ClientAppSpring

缺陷

  • 消费降级等功能的有待实现
  • ...(细节有待实现)

版本说明

项目随着主干进行下去

  • master
  • v4 增加Cluster(负载)层,结合Spring启动
  • v3 使用Netty4来操作NIO通信,不再是原来的多线程BIO。改变了通信方式,结构变化较大
  • v2 在上个版本基础上,增加zookeeper注册发现,客户端服务端无需互相知道对方。增加Protostuff序列化(序列化效率高)
  • v1 原始版本(bio多线程通信 客户端服务端直连)

更新日志

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].