TL;DR: AI inference traffic is bursty, and sizing fixed replicas for the peak is the fastest way to overspend. Autoscaling adds capacity when load rises and removes it when load falls, but only if you tune the triggers and cooldowns correctly. This guide covers autoscaling strategy on Tencent Cloud CVM — triggers, cooldown, multi-model behavior, and cost control — so you can absorb spikes without paying for idle capacity in quiet hours.
🔗 Start here: CVM exclusive offer · CVM product page
1. Why inference traffic breaks fixed capacity
Inference traffic does not behave like web traffic. A chatbot can sit at 10 requests per minute for hours and then spike to 1,000 the moment a marketing email lands. Embedding endpoints see the same shape: idle until a batch indexing job kicks off, then saturated. If you size replicas for the spike, you pay for idle GPUs during the long quiet stretches. If you size for the average, you miss latency SLOs exactly when it matters.
The Cloudflare "Agent Cloud" conversation has renewed interest in on-demand, pay-for-what-you-use compute for agent workloads — and that demand maps directly onto autoscaling. The goal is simple in words and fiddly in practice: add capacity fast enough to absorb a spike, and remove it fast enough to stop paying for idle capacity, without thrashing.
| Traffic shape | Fixed replicas | Autoscaling |
|---|---|---|
| Steady | Cheap, simple | Little benefit |
| Spiky | Expensive at peak, idle off-peak | Right-sized always |
| Unknown | Risky | Safe default |
2. The autoscaling strategy in one table
Autoscaling for inference has four moving parts. Get them wrong and you either thrash (scaling up and down constantly) or strand capacity (too slow to react).
| Component | What it decides | Tuning concern |
|---|---|---|
| Metric | What triggers scaling | Queue depth beats CPU |
| Threshold | When to trigger | Avoid hair-trigger |
| Cooldown | How long to wait between actions | Long enough to avoid thrash |
| Step size | How many replicas per action | Match step to spike size |
The single most common mistake is scaling on CPU utilization. CPU is a lagging indicator for inference — by the time CPU is high, the queue is already long and users are already waiting. Queue depth (or tokens-in-flight) is a leading indicator: it rises before latency degrades.
The second most common mistake is setting cooldown too short. When a scale-up happens, the new replicas take time to load the model into GPU memory. If cooldown is shorter than that load time, the scaler fires again before the first batch of replicas is ready, over-provisions, then scales back down — the classic thrash loop that burns budget without improving latency.
3. Configuring triggers and cooldown
A robust autoscaling policy for inference looks roughly like this:
| Signal | Scale up | Scale down |
|---|---|---|
| Queue depth | > 10 for 60s | < 2 for 180s |
| p99 latency | > 800ms for 60s | < 400ms for 180s |
| GPU utilization | > 85% for 120s | < 30% for 300s |
Rules of thumb:
- Use at least two signals. Queue depth alone misses model-load time; GPU utilization alone misses CPU-bound preprocessing.
- Set scale-down windows longer than scale-up windows. Removing capacity too fast is the main cause of repeated spikes.
- Set cooldown to at least the model load time plus a buffer. For a 7B model, that is often 60–120 seconds; for a 70B model it can be several minutes.
On CVM, the scaling layer reads metrics from the same Prometheus stack you already run for monitoring. A minimal rule in pseudocode:
scaling_policy:
metric: vllm:num_requests_waiting
scale_up:
threshold: 10
for: 60s
count: +2
scale_down:
threshold: 2
for: 180s
count: -1
cooldown:
scale_up: 120s
scale_down: 300s
Step size matters as much as threshold. Adding one replica at a time is too slow for a 10x spike; adding ten at a time is wasteful for a 2x spike. A reasonable starting point is to size the step as a fraction of current replica count, so the cluster grows proportionally rather than linearly.
4. Cost control and the bridge to CVM
Autoscaling is a cost control tool, but only if you also cap the upside. Without a maximum replica count, a misconfigured metric can spin up replicas until the budget is gone. Set a ceiling based on what your budget allows, and alert when you approach it.
| Cost lever | Effect | When to use |
|---|---|---|
| Max replica cap | Hard ceiling on spend | Always |
| Scheduled scaling | Pre-warm for known peaks | Marketing events |
| Preemptible instances | Lower hourly cost | Batch-friendly workloads |
| Scale-to-zero | Zero cost at idle | Low-traffic dev endpoints |
Scale-to-zero deserves a caveat: it is great for dev endpoints and low-traffic models, but the cold start (model load) makes it a poor fit for latency-sensitive production traffic. For production, keep a minimum of one warm replica and scale up from there.
This is where a standard server matters. Autoscaling on CVM means the instances you spin up are the same Linux machines you already know — same SSH access, same Docker images, same kernel tunables. There is no separate "serverless inference" abstraction to debug; the scaling layer just adds more of the servers you already run. If you are setting up inference autoscaling, the CVM exclusive offer is where the baseline instances come from, and the CVM product page lists the GPU instance families you can scale across.
5. Start with CVM
- 🚀 CVM exclusive offer — launch the baseline GPU instances your autoscaler will grow from.
- 📘 CVM product page — pick GPU instance families for your scaling group.
The one-paragraph version
AI inference traffic is bursty, and autoscaling is the discipline of adding capacity fast enough to absorb spikes and removing it fast enough to stop paying for idle GPUs. The keys are scaling on queue depth rather than CPU, setting cooldowns longer than model load time, and capping the maximum replica count so a misconfigured metric cannot drain the budget. On Tencent Cloud CVM, the instances your autoscaler spins up are the same standard Linux servers you already operate, so scaling adds capacity without adding abstraction.