2

学习笔记-如何自己实现一个RPC框架

 1 year ago
source link: https://mikeygithub.github.io/2022/07/01/yuque/vo9v5t/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

image.png

image.png

什么是 RPC

Remote Procedure Call(RPC)远程过程调用

1656917684956-807c36c7-436d-4260-9c5b-e75b6553f118.jpeg

Java 的 RMI 指的是 Remote Method Invocation,一种实现远程过程调用(RPC)的 API,能直接传输序列化后的 Java 对象。它的实现依赖于 JVM,因此它能支撑一个 JVM 到另外一个 JVM 的调用。

常见 RPC 框架

  • dubbo

    “dubbo 底层是基于 socket 通信,特点是全双工方式,多个客户端多个服务端同时通信,socketID 可以保证结果的唯一性。

  • “关于 gRPC 大部分 RPC 都是基于 socket 实现的,可以比 http 请求来的高效。gRPC 是谷歌开发并开源的一款实现 RPC 服务的高性能框架,它是基于 http2.0 协议的,目前已经支持 C、C++、Java、Node.js、Python、Ruby、Objective-C、PHP 和 C#等等语言。要将方法调用以及调用参数,响应参数等在两个服务器之间进行传输,就需要将这些参数序列化,gRPC 采用的是 protocol buffer 的语法

  • spring cloud

    Spring Cloud 利用 Spring Boot 特性整合了开源行业中优秀的组件,整体对外提供了一套在微服务架构中服务治理的解决方案。只支持 Java 语言平台。

  • 序列化/反序列化
  • 服务发现/服务注册
  • 序列化/反序列化

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK