Coder Social home page Coder Social logo

mirpc's Introduction

mirpc简易的rpc框架

简单了解

mirpc是一个简易的rpc框架,现在也没什么大的亮点,只是实现的基本功能。主要目的自然是为了了解rpc的实现原理,以及netty的基本使用。希望小伙伴们一起加油吧,加入一下自己的想法,欧里给。

rpc的基本原理:

  • 服务提供者向服务注册中心注册服务
  • 服务调用者到注册中心获取服务提供者的地址
  • 服务调用者通过网络调用接口

image-20230130111458892

所以我们需要实现几个必要的东西

  • 服务注册中心
  • 客户端
  • 服务端
  • rpc协议
  • 负载均衡,当客户端发现有多个服务提供者,需要从中选一个
  • ......

具体实现

分包

image-20230130112211064

主要有这几个包

  • client:客户端
  • server:服务端
  • protocol:rpc协议实现
  • registry:服务注册和服务发现
  • loadbalance:负载均衡

流程图

这里用三个流程图来简单了解其工作过程,已经每个模块发挥的作用

客户端流程图:

image-20230128214712691

服务端流程图:

  1. 服务发布流程

​ 服务端需要先进行服务发布,向注册中心进行注册,分为本地注册和服务注册

image-20230128222103197

  1. 监听流程

image-20230128225910181

未来的工作

因为该rpc框架都是学别人写的,而且只是走了一遍流程。还需要有很多完善的地方。

  • 异常处理不够完善

  • 没有完整的单元测试,没有做性能测试

  • 使用起来非常蛋疼,没有灵活的配置

  • 没有监控服务健康状态

  • ......

mirpc's People

Contributors

leaf-dawn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.