Skip to Content

Google Professional Cloud Developer: How to Identify Bottlenecks in a Cloud Run Application Under Load?

Learn the Google-recommended best practices for running load tests and identifying performance bottlenecks in a microservice-based Cloud Run application. Use Cloud Trace to capture and analyze request timings.

Table of Contents

Question

You are developing a discussion portal that is built on Cloud Run. Incoming external requests are routed through a set of microservices before a response is sent. Some of these microservices connect to databases. You need to run a load test to identify any bottlenecks in the application when it is under load. You want to follow Google-recommended practices. What should you do?

A. Modify the response to include a time series that shows elapsed time per service. Use Log Analytics in Cloud Logging to create a heatmap that exposes any service that could be a bottleneck.
B. Configure Cloud Trace to capture the requests from the load testing clients. Review the timings in Cloud Trace.
C. Expose the latency metrics per service for each request. Configure Google Cloud Managed Service for Prometheus, and use it to scrape and analyze the metrics.
D. Add log statements that capture elapsed time. Analyze the logs and metrics by using BigQuery.

Answer

B. Configure Cloud Trace to capture the requests from the load testing clients. Review the timings in Cloud Trace.

Explanation

When load testing a microservice-based application built on Cloud Run to identify performance bottlenecks, the recommended Google best practice is to use Cloud Trace. Cloud Trace is a distributed tracing system that collects latency data from your applications and displays it in the Google Cloud Console.

To use Cloud Trace for load testing:

  1. Configure Cloud Trace to capture requests from your load testing client. This will cause trace spans to be generated for each request, containing detailed timing information as the request flows through the various microservices.
  2. Run the load test, simulating traffic to your application.
  3. Review the traces and timings captured by Cloud Trace in the Cloud Console. The trace visualization will show you the end-to-end journey of requests, including the time spent in each microservice.
  4. Analyze the data to identify which microservices or databases are consuming the most time under load. Services with high latency are potential bottlenecks to investigate further and optimize.

The other options are not ideal for this use case:

  • Option A would require instrumenting your application code to generate timing metrics. Cloud Trace handles this automatically.
  • Option C suggests using Prometheus for metric analysis, but Cloud Trace is purpose-built for collecting and visualizing distributed traces.
  • Option D proposes custom logging and BigQuery analysis, which would be more complex and labor-intensive compared to using the built-in tracing tools.

So in summary, leverage Cloud Trace, Google’s managed distributed tracing service, to easily capture and analyze request timings when load testing your Cloud Run application. This will surface actionable data to help you identify and resolve performance bottlenecks.

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.