A team is developing a microservice that processes messages from Pub/Sub. The service is deployed on Cloud Run and uses Cloud Firestore to store processed data. During load testing, the service frequently fails with 'DeadlineExceeded' errors from Firestore. What is the most likely cause and best practice to fix it?
Trap 1: Increase the Pub/Sub subscription acknowledgment deadline
This affects message redelivery but not the Cloud Run request timeout.
Trap 2: Enable CPU always allocation for the Cloud Run service
This prevents CPU throttling but does not change the request timeout.
Trap 3: Add retry logic with exponential backoff for Firestore operations
Retry logic helps with transient failures but not with timeouts caused by long operations.
- A
Increase the Cloud Run container instance request timeout
This extends the time a request can run, preventing premature termination.
- B
Increase the Pub/Sub subscription acknowledgment deadline
Why wrong: This affects message redelivery but not the Cloud Run request timeout.
- C
Enable CPU always allocation for the Cloud Run service
Why wrong: This prevents CPU throttling but does not change the request timeout.
- D
Add retry logic with exponential backoff for Firestore operations
Why wrong: Retry logic helps with transient failures but not with timeouts caused by long operations.