Google Professional Cloud Developer Question 44
Single answerGoogle Cloud PlatformYou are designing an inter-service communication system for a distributed application on Google Cloud. The system must support high-throughput, low-latency communication between microservices, while also providing support for real-time streaming. Which communication protocol would best suit this requirement and why?
- A
HTTP REST, as it is widely supported and easier to implement across different languages.
- B
HTTP REST, as it provides built-in support for streaming and ensures low latency.
- C
gRPC, as it uses HTTP/2 for low-latency, high-throughput communication and supports bi-directional streaming.
- D
gRPC, as it is optimized for browser-based client applications and uses JSON for easy debugging.
Show answer and explanation
Correct answer: C
Explanation
gRPC is the best choice for high-throughput, low-latency communication between microservices due to its use of HTTP/2 and Protocol Buffers. HTTP REST, while widely used and easy to implement, is less efficient for scenarios requiring real-time streaming and high performance. gRPC's support for bi-directional streaming and its optimized performance characteristics make it the ideal solution for the described scenario.
- A. Incorrect.
HTTP REST is widely supported and easier to implement, but it does not provide the low latency and high throughput needed for high-performance inter-service communication. Additionally, it lacks built-in support for real-time streaming.
- B. Incorrect.
HTTP REST does not come with built-in streaming capabilities, and it typically incurs higher latency compared to gRPC due to its reliance on text-based data formats like JSON.
- C. Correct.
gRPC is designed for high-performance communication between microservices. It uses HTTP/2, which enables lower latency, higher throughput, and bi-directional streaming, making it the suitable choice for the given requirements.
- D. Incorrect.
Although gRPC supports high-performance communication, it is not optimized for browser-based clients and does not use JSON for debugging. Instead, it employs Protocol Buffers (Protobuf) for data serialization.