Google Professional Cloud Developer Question 46
Select 1Google Cloud PlatformYou are developing a microservices-based application on Google Cloud. The application needs high performance for internal service-to-service communication, with support for strongly-typed contracts and low latency. However, the application also requires external APIs to interact with third-party systems that may use a wide range of technologies. Which combination of communication protocols should you use?
- A
Use gRPC for internal service-to-service communication and HTTP REST for external APIs.
- B
Use HTTP REST for internal service-to-service communication and external APIs.
- C
Use gRPC for both internal service-to-service communication and external APIs.
- D
Use HTTP REST for internal service-to-service communication and gRPC for external APIs.
Show answer and explanation
Correct answer: A
Explanation
gRPC is well-suited for internal service-to-service communication due to its high performance, low latency, and support for strongly-typed contracts, making it ideal for microservices. On the other hand, HTTP REST is widely adopted for external APIs because it is language-agnostic, easy to use, and compatible with a diverse range of third-party systems. Combining the two leverages their respective strengths and ensures the application is both performant and interoperable with external systems.
- A. Correct.
Correct: gRPC is suitable for internal service-to-service communication because it offers high performance, low latency, and strongly-typed contracts. HTTP REST is more appropriate for external APIs due to its widespread adoption and compatibility with diverse third-party technologies.
- B. Incorrect.
Incorrect: HTTP REST is less efficient than gRPC for internal service-to-service communication, particularly in scenarios requiring low latency and high performance.
- C. Incorrect.
Incorrect: While gRPC is excellent for internal communications, using it for external APIs can be problematic as many third-party systems may not support it, limiting compatibility.
- D. Incorrect.
Incorrect: HTTP REST is not ideal for internal service-to-service communication due to its comparatively higher latency and less efficient serialization. Additionally, gRPC is not widely adopted for external APIs.