Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
Your company runs an asynchronous batch-processing workload on a Compute Engine Managed Instance Group (MIG). The worker instances consume compute-heavy image rendering tasks from a Cloud Pub/Sub subscription.
During unexpected marketing campaigns, massive influxes of messages arrive in the subscription. The current CPU-based autoscaler reacts too slowly to these sudden surges, resulting in high message processing delays. Furthermore, you need to ensure that the autoscaler does not prematurely scale in instances while tasks are still in progress.
How should you configure the autoscaling policy for the Managed Instance Group to rapidly absorb these traffic surges?
Cloud Pub/Sub queue metric autoscaling allows a Managed Instance Group (MIG) to dynamically resize based on the backlog of work waiting in a specific subscription. The metric pubsub.googleapis.com/subscription/num_undelivered_messages measures the total count of unacknowledged messages, including both pending messages in the queue and messages actively being processed by worker VMs.
num_undelivered_messages includes in-flight messages that have been pulled but not yet acknowledged, the metric will not prematurely drop to zero while instances are still rendering images. This prevents early termination of active workers.singleInstanceAssignment) defines the exact capacity (e.g., 10 messages per VM) that each instance can comfortably handle concurrently, allowing the autoscaler to compute: Target Replicas = Total Unacknowledged Messages / Single Instance Assignment.resource.labels.subscription_id) to isolate scaling signals to the exact workload queue.CPU-based scaling is a lagging indicator for message-driven architectures, whereas queue depth is a leading indicator. Configuring num_undelivered_messages with a single VM instance assignment ensures direct, deterministic scaling proportional to queue size.
The pubsub.googleapis.com/topic/send_request_count metric tracks the rate of publish API requests made to a Cloud Pub/Sub topic over time.
Delta / second) only reflects the instantaneous rate at which publishers are pushing data into the topic. It does not measure accumulated queue depth or backlog size.send_request_count immediately drops back to zero, prompting the MIG autoscaler to rapidly scale in even if millions of unacknowledged messages remain queued in the subscription waiting to be processed.The goal was to scale an ingestion proxy or API gateway whose capacity needs strictly correspond to incoming network request rates per second rather than accumulated asynchronous work queues.
Predictive autoscaling leverages machine learning algorithms to analyze historical daily and weekly CPU utilization patterns over a minimum of 3 days to forecast future capacity needs and scale out ahead of time.
The workload experienced regular, predictable, recurring daily peak traffic cycles and scaled purely based on CPU utilization rather than queue depth.
The pubsub.googleapis.com/subscription/oldest_unacked_message_age metric measures the duration (in seconds) that the oldest unacknowledged message has spent in the subscription.
You were configuring an alerting policy in Cloud Monitoring to detect stalled queue processing or deadlocks, rather than driving dynamic autoscaler capacity sizing.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated