Skip to Content

Google Professional Cloud Developer: What is the best way to deploy an API that creates requests on asynchronous message service using gRPC?

Learn the optimal approach for deploying an API that generates requests on an async message service via gRPC, while minimizing infrastructure management overhead. Discover how Cloud Run and Pub/Sub can streamline your API deployment.

Table of Contents

Question

You are developing a new API that creates requests on an asynchronous message service. Requests will be consumed by different services. You need to expose the API by using a gRPC interface while minimizing infrastructure management overhead. How should you deploy the API?

A. Deploy your API to App Engine. Create a Pub/Sub topic, and configure your API to push messages to the topic.
B. Deploy your API as a Cloud Run service. Create a Pub/Sub topic, and configure your API to push messages to the topic.
C. Deploy your API to a GKE cluster. Create a Kafka cluster, and configure your API to write messages to the cluster.
D. Deploy your API on a Compute Engine instance. Create a Kafka cluster, and configure your API to write messages to the cluster.

Answer

B. Deploy your API as a Cloud Run service. Create a Pub/Sub topic, and configure your API to push messages to the topic.

Explanation

When deploying an API that creates requests on an asynchronous message service using gRPC, the most suitable approach is to use Cloud Run and Pub/Sub. Here’s why:

  1. Cloud Run is a fully managed serverless platform that allows you to run stateless containers, making it ideal for deploying APIs. It abstracts away infrastructure management, automatically scales based on demand, and supports gRPC natively.
  2. Pub/Sub is a fully managed message queuing service that enables asynchronous communication between services. It is highly scalable, reliable, and integrates seamlessly with Cloud Run.

By deploying your API as a Cloud Run service and creating a Pub/Sub topic for your API to push messages to, you can efficiently expose your API using gRPC while minimizing infrastructure management overhead. Cloud Run handles the deployment, scaling, and management of your API, while Pub/Sub ensures reliable message delivery to consuming services.

The other options are less suitable:

  • App Engine (option A) is a platform for building scalable web applications, but it may not be the best fit for a gRPC API and requires more infrastructure management compared to Cloud Run.
  • Deploying to a GKE cluster (option C) or Compute Engine instance (option D) with a Kafka cluster would require you to manage the infrastructure and Kafka cluster yourself, adding unnecessary complexity and overhead.

Therefore, deploying your API as a Cloud Run service and using Pub/Sub for asynchronous messaging is the most effective and efficient approach in this scenario.

Google Professional Cloud Developer certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Google Professional Cloud Developer exam and earn Google Professional Cloud Developer certification.