gRPC介绍
gRPC源自Google内部RPC项目Stubby。Stubby这个项目支撑了谷歌内部所有的应用和系统,Google云中全平台百亿次每秒的请求量,提供了C++,Java,Python和Go的API,但是因为和内部工具紧密结合所以并不适合开源。这个项目为后面的开源积累了伸缩性、性能和API经验。
gPRC的特点主要有:
- 跨语言跨平台框架
- gRPC提供了C、Java和Go版本的原生实现
- C++, C#, Node, ObjC, Python, Ruby, PHP通过封装C语言gRPC实现
- 支持 Linux, Android, iOS, MacOS, Windows 多个平台
- 通过HTTP/2 + TLS通信
- 撬动目前使用的网络协议和基础组件
- 通过多线程框架流式发送公用一个连接,高效使用TCP
- 原生支持加密双向流式通信
其中C/C++的实现主要目标是高通量、低延迟与可伸缩性,同时减小外部依赖。
Completion Queues enable notification of the completion of asynchronous actions.
Completion Queues and Threading in the Async API
Right now, the best performance trade-off is having numcpu’s threads and one completion queue per thread.