Safeguard
Developer Tools•

What signals should autoscale your scan workers?

Scale scan workers on queue age and backlog per lane, not CPU alone. Add cooldowns, a floor for background work and a ceiling tied to downstream limits.

Safeguard Security Team
4 min read

Scale scan workers on queue age and backlog per priority lane, because CPU use alone lags and misleads. Add a minimum worker count, a maximum tied to your source host and registry limits, and cooldowns so the fleet does not thrash. Scale back down once queues drain.

Why CPU is the wrong lead signal

A scan worker spends time waiting: fetching code, pulling layers, calling a database mirror. CPU may be low while the queue grows. By the time CPU rises, developers are already waiting. Scale on the thing users feel, which is how long jobs wait.

Signals to use

SignalUseCaveat
Oldest job age in the interactive lanePrimary trigger to add workersNeeds per-lane metrics
Backlog depth divided by throughputEstimates time to drainThroughput varies by scan type
Worker utilisationSecondary check, to avoid idle spendNot a trigger on its own
Failure rate from resource limitsSignals that worker class is too smallScaling count will not fix it
Downstream limit headroomCap on scaling outAdding workers can trigger rate limits

Steps

  1. Emit queue depth and oldest job age per lane and scan type.
  2. Set a target for each lane, for example interactive jobs start within a few minutes.
  3. Scale out when oldest job age exceeds the target for a sustained short window.
  4. Scale in slowly, after queues have been empty for a longer window, and drain workers gracefully so they finish their current job.
  5. Keep a minimum number of warm workers, since cold starts include image pulls and database cache loading.
  6. Set a maximum based on how many parallel clients your source host, registry and database mirror can support, so autoscaling does not turn a backlog into an outage elsewhere.
  7. Use separate pools for heavy scan types so a few large jobs cannot hold every worker.

Mind the cost and the cache

Workers with warm caches are faster. Scaling to zero between bursts saves money but means each new worker re-downloads the database and layers. A shared cache volume or mirror reduces that penalty, which is another reason to put the vulnerability database behind an internal mirror.

Spot or preemptible capacity suits the background lane, because jobs are idempotent and can restart. Keep interactive workers on stable capacity.

Predictable peaks

Scan load is not random. Monday mornings, release days, and the hours after a big advisory all bring surges. Schedule extra capacity ahead of known peaks and use the reactive signals for the surprises.

Test it

Run a load test that enqueues a large number of jobs at once, and measure how quickly the fleet reaches steady state and how queue age behaves. Do this before a real advisory event does it for you.

Try it yourself

Click through it at your own pace, or open it full screen. A new disclosure is the sort of event that creates a burst of reactive scan work.

Safeguard is hosted, so capacity planning for scanning sits with us. You can try the free scan at https://gold.safeguard.sh/scan.

Quick check

Can I just scale on CPU?

It is a weak signal for jobs that wait on the network. Queue age is closer to what users experience.

Why cap the maximum workers?

More workers mean more calls to source hosts and registries, which have their own limits.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.