gRPC vs REST vs GraphQL #systemdesign #software #backend #microservice #grpc #api #restapi #graphql

preview_player
Показать описание
Whats gRPC exactly ?? When to use gRPC ?

Whats gRPC ?

- gRPC is one of the popular 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵𝗲𝘀 𝘁𝗼 𝗯𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗔𝗣𝗜𝘀.
- Other approaches are REST, and GraphQL. Each have their own strengths and use cases.
- gRPC is an open-source Remote Procedure Call (RPC) framework developed by Google.

----------------------------

Whats RPC ?

Remote Procedure Call (RPC) is a general concept.
- The concept of RPC is based on the idea of calling a function or procedure in a remote process as if it were a local procedure call, hiding the complexities of network communication.
- It means that one program can request a service from a program located on another computer in a network.

----------------------------

How RPC works ?

RPC abstracts away many of the complexities of network communication, making remote calls appear as if they were local calls.

Step 1. Client Sends a Request: The client program invokes a procedure (function) on the local machine. This procedure call looks like a regular local function call.
Step 2. Serialization: Parameters of procedure call are converted into a format that can be transmitted over the network. T
Step 3. Request Transmission: Data is sent over network to the remote machine.
Step 4. Deserialization: On remote machine, the received data is converted back into data structures.
Step 5. Procedure Execution: The server then executes requested procedure with the provided parameters.
Step 6. The client receives the result and deserializes data, obtaining the final result .

----------------------------

gRPC (gRPC Remote Procedure Calls) . gRPC vs RPC ?
There are different RPC frameworks, and gRPC is one example of an RPC framework

- gRPC uses Protocol Buffers (Protobuf): This results in more compact and efficient data transfer compared to JSON-based formats.
- Language-agnostic API Definition:
- Known for its high performance due to features like binary serialization, multiplexing, and support for bidirectional streaming.

----------------------------

gRPC vs GraphQL vs REST: When to use what ?

Use gRPC when
- Performance-critical microservices
- If optimizing for network efficiency

Use REST when
- Want Simple and Easy to Use service:
- Creating Public APIs: REST is Well-established and widely used for building web services and public APIs.
- Performance overhead is acceptable

Use GraphQL when
- Need Flexibility and you have complex Query patterns
- Frontend Applications with specific requirements

--------------
Question : What other attributes/examples are worth highlighting about gRPC ?

-------------

Detailed article in comments

-------------

tldr:
gRPC is one of the popular 𝗮𝗽𝗽𝗿𝗼𝗮𝗰𝗵𝗲𝘀 𝘁𝗼 𝗯𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗔𝗣𝗜𝘀.
- Its based on the concept of RPC.
- Use gRPC when Performance-critical microservices

#backend #softwaredevelopment #microservice #systemdesign #grpc
#api #restapi
Рекомендации по теме
welcome to shbcf.ru