Question

Difficulty: HardManaging Compute Engine Resources

A cloud engineering team operates a Managed Instance Group (MIG) that processes asynchronous background tasks from a Cloud Pub/Sub subscription. During high-traffic events, CPU utilization across the VM instances remains below 25%, but the message backlog grows significantly, resulting in SLA violations. The team needs to reconfigure the MIG autoscaling strategy to scale based on the number of unacknowledged messages in the subscription and ensure newly launched instances complete their startup scripts before the autoscaler evaluates performance metrics. Which configuration approach should the engineer implement?

  1. Configure the autoscaling policy to use a Cloud Monitoring metric tracking Pub/Sub unacknowledged messages, and set an appropriate cool-down period on the autoscaler.Answer
  2. B
    Lower the autoscaling policy target CPU utilization threshold from 80% to 15% and configure a health check delay interval.
  3. C
    Assign the Project Owner primitive role to the Compute Engine default service account and configure instance uptime as the scaling metric.
  4. D
    Submit an automated GCP Quota Increase request for Compute Engine API requests to accelerate metric sampling rates during queue spikes.

Answer

Configure the autoscaling policy to use a Cloud Monitoring metric tracking Pub/Sub unacknowledged messages, and set an appropriate cool-down period on the autoscaler.
To auto-scale a Managed Instance Group based on Pub/Sub workload requirements, Google Cloud best practice dictates using a Cloud Monitoring metric (such as unacknowledged message count). Configuring a cool-down period ensures the autoscaler ignores metric anomalies during VM startup and initialization.

Step-by-Step Solution

1
Identify the proper scaling signal for queue-based workloads
Cloud Monitoring metrics (such as pubsub.googleapis.com/subscription/num_undelivered_messages) reflect backlog depth rather than CPU utilization.
I/O bound or message processing tasks may not consume high CPU, making CPU metrics ineffective for workload-based scaling.
2
Configure the MIG initialization buffer
Define a cool-down period (initialization period) in the autoscaling policy equal to or greater than the average VM boot and initialization duration.
Prevents the autoscaler from prematurely launching extra instances while newly added instances are still booting.

Key Concept

Compute Engine MIG Custom Metric Autoscaling and Cool-down Periods
Rate this question