Giter VIP home page Giter VIP logo

wangzhe's Introduction

RPC原理

简单介绍下RPC: RPC 即远程过程调用,主要是屏蔽了远程方法和本地方法的区别,像调用本地方法一样调用。隐藏了网络调用的复杂性,使我们只关注业务逻辑的实现。 RPC主要包括: 1、 网络层,主要使用tcp 2、序列化 因为网络传输需要使用二进制的数据进行传输,所以需要把对象进行序列化 3、网络协议 自定义协议 一般不使用http协议,是因为http协议内容比较大 2、 Http协议无状态 4、反序列化 5、执行

网络协议的设计: 协议头:协议版本号、数据大小,协议头大小、序列化版本 协议头扩展: 协议体:方法名、类名、key名等

序列化方式: JDK序列化: JSON序列化: 占用体积大 ,因为java没有支持的JSON类型,所以需要反射成已有的类型,所以慢 hession:压缩体积小、速度快,但是不支持LinkedHashMap/LinkedHashSet等特定类型 protoBuffer: 需要生命IDL ,使用IDL生成特定的序列化工具类。 protoStaffer: 很快,但是不支持一些类型。不支持null,不支持特定的List、Map对象。

wangzhe's People

Contributors

yake12333 avatar

Watchers

 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.