Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand Google's open source general RPC framework based on HTTP/2 and ProtoBuf gRPC

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Google open source based on HTTP/2 and ProtoBuf general RPC framework gRPC how to understand, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.

GRPC is a high-performance, general-purpose open source RPC framework, which is mainly developed by Google for mobile applications and designed based on HTTP/2 protocol standards, based on ProtoBuf (Protocol Buffers) serialization protocol, and supports many development languages. GRPC provides a simple way to accurately define services and automatically generate reliable client-side libraries for iOS, Android, and background support services. Clients take full advantage of advanced streaming and linking capabilities to help save bandwidth, reduce the number of TCP links, save CPU usage, and battery life.

GRPC has the following important characteristics:

Powerful IDL features

GRPC uses ProtoBuf to define services, and ProtoBuf is a data serialization protocol developed by Google (similar to XML, JSON, hessian). ProtoBuf can serialize data and is widely used in data storage, communication protocols and so on. However, currently gRPC only supports Protobuf and does not support use in browsers. Because gRPC is designed to support multiple data formats, readers can easily support other data formats (such as XML, JSON, etc.).

The sample code for defining a service is as follows:

Message HelloRequest {string greeting = 1;} message HelloResponse {string reply = 1;} service HelloService {rpc SayHello (HelloRequest) returns (HelloResponse);}

Support for multiple languages

GRPC supports multiple languages and can automatically generate client-side and server-side libraries based on the language. At present, C version grpc, Java version grpc-java and Go version grpc-go are available on GitHub, and other language versions are under active development, of which grpc supports C, C++, Node.js, Python, Ruby, Objective-C, PHP and C #, and grpc-java already supports Android development.

Design based on HTTP/2 standard

Because gRPC is designed based on the HTTP/2 standard, gRPC brings more powerful functions than other RPC frameworks, such as two-way flow, header compression, multiplex requests and so on. These features bring significant benefits to mobile devices, such as saving bandwidth, reducing the number of TCP links, saving CPU usage, and extending battery life. At the same time, gRPC can also improve the performance of cloud services and Web applications. GRPC can be applied not only in the client side, but also in the server side, thus realizing the communication between the client side and the server side and simplifying the construction of the communication system in a transparent way.

GRPC has been used in Google's cloud services and external API. The main application scenarios are as follows:

Low latency, highly scalable, distributed system

Mobile application client that communicates with the CVM

Design a new protocol that is language independent, efficient and accurate

Hierarchical design that facilitates expansion in all aspects, such as authentication, load balancing, logging, monitoring, etc.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report