A logistics enterprise processes real-time delivery routing updates ingested from thousands of vehicle tracking devices into a Cloud Pub/Sub topic. A Compute Engine Managed Instance Group (MIG) running worker services pulls messages from the subscription. During morning dispatch hours, the message queue depth spikes rapidly, but CPU utilization across worker instances remains under 20% because workers spend most of their time waiting on network calls to external mapping APIs. The operations team needs to ensure timely processing during peak hours while avoiding unexpected infrastructure provisioning failures. Which autoscaling and capacity planning strategy should you recommend?
- Configure the MIG autoscaler based on a custom Cloud Monitoring metric tracking the ratio of unacknowledged Pub/Sub messages per instance, and request regional Compute Engine resource quota increases prior to peak events.Answer
- BConfigure the MIG autoscaler to target an average CPU utilization of 80% so that the instance group expands automatically when message queue depth increases.
- CMigrate the application from Compute Engine MIGs to a multi-zonal Google Kubernetes Engine (GKE) cluster managed by Horizontal Pod Autoscaler targeting CPU usage.
- DMaintain a fixed MIG instance count and configure Cloud Monitoring alerts to trigger automated GCP quota request API calls during high message queue backlog events.
Answer
Configure the MIG autoscaler based on a custom Cloud Monitoring metric tracking unacknowledged Pub/Sub messages per instance, and request regional Compute Engine resource quota increases in advance.
For I/O-bound queue consumers, CPU load remains low even when unacknowledged message queues accumulate. Scaling based on custom Cloud Monitoring metrics (such as Pub/Sub unacknowledged message count per instance) ensures that autoscaling responds directly to workload backlog. Furthermore, requesting regional quota increases in advance ensures that autoscaling policies are not blocked by project-level quota boundaries during peak traffic windows.
Step-by-Step Solution
Key Concept
Queue-based Autoscaling & Pre-provisioning Quotas