Distributed network communication framework (2) - RPC communication principle and technology selection

Project implementation function

insert image description here

Technology Selection

Yellow part : Design the packaging and parsing of rpc method parameters , that is, the serialization and deserialization of data, which are used protobuffor RPCserialization and deserialization of method calls.

Benefits of using protobuf:

protobufis binary storage, xmland jsonis text storage;

protobufThere is no need to store additional information; while jsonstorage key-value, key wastes space

Green part : network part, including finding rpcservice host, initiating rpccall request and responding rpccall result, using muduonetwork library and left zookeeperservice configuration center (service discovery)

Project code project directory

bin:executable file

build: project compilation file

lib: project library file

src:Source File

test: test code

example: framework code usage example

CMakeLists.txt: top-level cmake file

README.md: project readme

autobuild.sh: Compile the script with one click

Guess you like

Origin blog.csdn.net/qq_42120843/article/details/130914755