教程:极客兔兔
RPC(Remote Procedure Call,远程过程调用)是一种计算机通信协议,允许调用不同进程
空间的程序。RPC 的客户端和服务器可以在一台机器上,也可以在不同的机器上
。使用时,就像调用本地程序一样,无需关注内部的实现细节。
与HTTP调用的区别
- HTTP 协议是基于文本的,一般具备更好的可读性。但是需要额外的代码来处理,而 RPC 调用则更接近于直接调用。
- 基于 HTTP 协议的 Restful 报文冗余,承载了过多的无效信息,而 RPC 通常使用自定义的协议格式,减少冗余报文。
- RPC 可以采用更高效的序列化协议,将文本转为二进制传输,获得更高的性能。
- 因为 RPC 的灵活性,所以更容易扩展和集成诸如注册中心、负载均衡等功能。