Your team runs a stateless image-processing service in a managed instance group (MIG) that pulls jobs from a Cloud Pub/Sub subscription. CPU utilization is typically low, but the subscription backlog can grow quickly. You must configure the MIG (minimum 2, maximum 10 VMs) to add or remove instances so that the number of undelivered Pub/Sub messages stays close to 500 per VM. Which autoscaling configuration should you implement?
Configure autoscaling on average CPU utilization with a 60% target, assuming higher backlog will increase CPU and trigger scaling.
Create an autoscaling policy that uses the Cloud Monitoring metric "pubsub.googleapis.com/subscription/num_undelivered_messages" with utilizationTargetType set to "GAUGE_PER_INSTANCE" and target set to 500.
Replace Pub/Sub with an App Engine task queue and use a scheduled autoscaler to add VMs only during business hours.
Attach an internal HTTP(S) load balancer in front of the MIG and set the autoscaler to maintain 80% load-balancing serving capacity.
The Compute Engine autoscaler can scale a MIG using any Cloud Monitoring metric when you add a custom-metric utilization rule. The Pub/Sub metric "pubsub.googleapis.com/subscription/num_undelivered_messages" is a gauge that represents the current number of unacknowledged messages. By setting utilizationTargetType to GAUGE_PER_INSTANCE, the autoscaler keeps the metric value per VM near the specified target-in this case 500 messages per instance-causing the group to scale out when backlog per VM exceeds 500 and scale in when it drops below that threshold. CPU-based, load-balancer-based, or schedule-based policies would not react to message backlog spikes.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a Managed Instance Group (MIG)?
Open an interactive chat with Bash
What is the 'GAUGE_PER_INSTANCE' utilizationTargetType?
Open an interactive chat with Bash
How does the Pub/Sub metric 'num_undelivered_messages' affect autoscaling?
Open an interactive chat with Bash
GCP Associate Cloud Engineer
Planning and implementing a cloud solution
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99 $11.99
$11.99/mo
Billed monthly, Cancel any time.
$19.99 after promotion ends
3 Month Pass
$44.99 $26.99
$8.99/mo
One time purchase of $26.99, Does not auto-renew.
$44.99 after promotion ends
Save $18!
MOST POPULAR
Annual Pass
$119.99 $71.99
$5.99/mo
One time purchase of $71.99, Does not auto-renew.
$119.99 after promotion ends
Save $48!
BEST DEAL
Lifetime Pass
$189.99 $113.99
One time purchase, Good for life.
Save $76!
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .