This is a creation in Article, where the information may have evolved or changed.
What's wasting today is tomorrow to those who died yesterday; What's the future of hate now?
What you are wasting today is the tomorrow that the man who died yesterday expects, and what you dislike is now the future you will never go back to.
GRPC Introduction:
GRPC is a high-performance, open-source RPC framework, developed from Google, based on the PROTOBUF serialization protocol, supports multiple languages (Golang, Python, Java, etc.), and this article only describes the GRPC use of Golang. Because GRPC's support for the HTTP/2 protocol makes it a good prospect for the development of client backend services such as Android and IOS. GRPC provides an easy way to define services, while clients can take advantage of the HTTP/2 stream features to help conserve bandwidth, reduce TCP connections, save CPU usage, and more.
Installation:
1. Installation of GRPC:
go get -u google.golang.org/grpc
This link requires FQ, if not clear how to FQ, you can download the third party package and then install, provide a can be downloaded without FQ address:https://www.golangtc.com/download/package
- Specific installation method:
Download the third-party package, put it under $GOPATH/SRC, then go install xxx.com/xx (package name). Other third-party packages may be needed, so just go get them all you need.
2. Installation of Protobuf
Because GRPC is an interface serialization based on the PROTOBUF implementation, PROTOBUF is also installed.
- Install PROTOC:PROTOC download address, you can download the corresponding Protoc,windows users according to their own system Win32 version of the unified download.
- To configure PROTOC to the system environment variable, execute the following command to see if the installation was successful: Protoc
3. Installing the Protobuf-related Golang dependency Library
go get -u github.com/golang/protobuf/{protoc-gen-go,proto}// 可以分步执行go get -u github.com/golang/protobuf/protogo get -u github.com/golang/protobuf/protoc-gen-go
If the same cannot be downloaded, you can download the installation using the above mentioned method. After the installation is successful, look under $gopath/bin for Protoc-gen-go.exe (under Windows).
Even if the installation succeeds, the following can be a test phase immediately.
Summarize:
1. Q: Why do I have an HTTP request and why do I use RPC calls?
First HTTP is the Hypertext Transfer Protocol,
RPC is a remote procedure call, and its invocation protocol typically contains the transport protocol and the Encoding Protocol. Using the HTTP2 protocol, also like the TCP protocol for custom messages of the Dubbo class
Reference article:
https://www.zhihu.com/question/41609070?sort=created
2. The fittest for HTTP services and RPC services?
Because RPC is more efficient and HTTP service development iterations are faster and relatively simple, RPC is used for large enterprise
RPC Call flowchart