Safeguard
Industry Analysis•

Cold start or patching: how should you weigh them for dependencies?

Layers, bundling and containers shift cold start and patching in different ways. A decision guide that keeps patching ahead of tiny latency gains.

Safeguard Security Team
4 min read

Decide on patching first and cold start second. AWS says cold starts typically occur in under 1 percent of invocations and range from under 100 ms to over 1 second, and provisioned concurrency exists to reduce them. A packaging choice that makes patching slow rarely repays a small, unmeasured latency gain.

What AWS says about cold starts

The Lambda execution environment documentation describes a cold start as the preparation of an environment: downloading your code, starting the environment and running initialization code outside the handler. It states cold starts typically occur in under 1 percent of invocations, that the duration varies from under 100 ms to over 1 second, and that they are more common in development and test functions. For predictable start times it recommends provisioned concurrency, which pre-initializes execution environments.

So the frequency is low and a tool exists. That frames the trade honestly: cold start is real but bounded.

The packaging options and what each costs

OptionPatchingCold start note
Dependencies in the zipRebuild per functionLarger package to download
Shared layerOne layer update, then roll each function to the new versionAWS says layers for Go and Rust can increase cold start
Container imageRebuild on a new base and dependency setKeep images small, multi-stage builds help, per AWS
Runtime-included librariesAWS updates them periodicallySmallest package, but less control

Regular Lambda layers do not patch themselves. Each function must be updated to the new layer version, covered in how to roll out a patched Lambda layer.

A decision guide

  1. Is the function on a hot, user-facing path? If not, ignore cold start and optimize for patchability.
  2. If it is, measure. Record cold start and warm latency for your actual package. Do not rely on a general claim.
  3. Trim before you restructure. Removing unused dependencies cuts size and risk together.
  4. Consider provisioned concurrency for the few paths that need steady latency, and remember that it keeps environments pre-initialized with the version configured.
  5. Never trade away the ability to rebuild fast. If a choice means a patch takes days, it needs a strong reason.

Where startup time hides

AWS documents that static initialization code runs before the handler and that the Init phase is limited to 10 seconds for standard functions. Heavy imports, large clients and eager setup all run there. Lazy loading rarely used dependencies is a safe optimization, as long as the dependency is still declared and scanned.

Patching latency is the number to track

Cold start is easy to see on a dashboard. Patch latency is not, unless you track it: the time from a fix release to the fix running in production. Add it to your engineering metrics next to cold start. A team that watches only the first will optimize the wrong thing.

Try it yourself

The fix available now demo shows the gap between a fix being published and being applied. That gap is the metric that matters here.

Click through it at your own pace, or open it full screen.

Where Safeguard fits

Safeguard's dependency scanning and reachability analysis show which findings need a fast fix, and autonomous remediation can open fix pull requests, which are off by default with every category on Manual. Free scan: gold.safeguard.sh/scan.

Quick check

How often do Lambda cold starts happen?

AWS says they typically occur in under 1 percent of invocations, more often in development and test functions.

Is provisioned concurrency a security feature?

No. It pre-initializes execution environments to reduce cold starts. It does not patch anything.

Sources

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.