Google Professional Cloud Developer Question 45
Single answerGoogle Cloud PlatformYou are developing a microservices-based application on Google Cloud and need to choose between HTTP REST and gRPC for communication between services. The system needs to support high-throughput, low-latency communication and will primarily use internal service-to-service communication. Which communication protocol should you choose, and why?
- A
HTTP REST, because it is more human-readable and widely supported across different clients.
- B
HTTP REST, because it provides lower latency and higher throughput compared to gRPC.
- C
gRPC, because it supports HTTP/2 and provides features like streaming and lower latency.
- D
gRPC, because it is easier to debug and directly supports browsers without additional tooling.
Show answer and explanation
Correct answer: C
Explanation
For high-throughput, low-latency communication in a microservices architecture, gRPC is a better choice because it uses HTTP/2 for efficient communication, supports streaming, and is optimized for internal service-to-service communication. HTTP REST, while widely supported and human-readable, is less efficient in terms of performance and latency.
- A. Incorrect.
While HTTP REST is human-readable and widely supported, it is not optimized for high-throughput or low-latency communication, which makes it less suitable for internal service-to-service communication in this scenario.
- B. Incorrect.
This is incorrect because HTTP REST does not provide lower latency or higher throughput compared to gRPC. HTTP REST is generally slower due to its reliance on text-based formats like JSON.
- C. Correct.
This is correct because gRPC uses HTTP/2, which supports multiplexing, lower latency, and features like streaming. These characteristics make it well-suited for internal service-to-service communication in high-performance systems.
- D. Incorrect.
This is incorrect because while gRPC has many advantages, it is not inherently easier to debug than HTTP REST and requires additional tooling (such as a gRPC-Web proxy) to support browsers.