Keep the useful bits, human.
Beginner field notes
- For the ordinary Lambda event-function model here, initialization prepares the environment; invocation runs the handler for an event.
- When initialization happens on a request’s path, that preparation adds work before the handler result. A reused prepared environment can avoid repeating that setup.
- A function can have a cold-start path after many earlier calls if a new environment is needed. Cold does not mean the function has never run.
See a worked example
Account for preparation only where the trace says it occurs
One reviewed sample, shared across levels. Nothing here runs on your computer.
Example review recorded 2026-10-17 · version 1.
Offline Lantern Archive timing model for ReadLabel. The function has been used before these cases.
Assume ordinary on-demand event-function execution, no provisioned concurrency, SnapStart, Durable Functions, Managed Instances, extensions, errors, resets or retries. Every invocation is authorized and its B7 read completes with Seeds; there are no writers.
Measure only initialization on this request path plus handler execution; exclude queueing, network and all other delays. Durations are invented, not measured.
1. A fresh environment A is prepared for this request: Init 300 ms, then handler 40 ms.
2. The trace explicitly says A is retained and reused: no new Init, handler 35 ms.
3. A is no longer available; the trace explicitly uses fresh environment B: Init 200 ms, then handler 40 ms.1. Fresh-environment cold-start path: 300 + 40 = 340 ms in this model. Returned label: Seeds.
2. Given warm reuse of A: 0 new Init + 35 = 35 ms. Returned label: Seeds.
3. New-environment cold-start path despite earlier successful calls: 200 + 40 = 240 ms. Returned label: Seeds.
Initialization happens twice across this stated trace, not on every invocation and not just once for the function’s lifetime. Nothing here predicts the environment or timing of a fourth request.Use the given environment and lifecycle facts, not a guessed millisecond cutoff, to distinguish the paths. Sum only the two included durations. All work and reuse are stipulated paper events; no environment is created, timer run, log inspected or AWS service contacted.
Sources for this sampleVisual
The reviewed description and complete diagram source are available here.
More of this diagram is available inside its frame. Focus the frame and use the arrow keys to pan.
Read the complete diagram source
This is the source for the reviewed diagram, not a command to run.
flowchart LR
A["Given: fresh environment A"] --> I["Init: 300 ms"] --> H["Handler: 40 ms"] --> R["Result after modeled 340 ms"]
W["Given later reuse of A"] --> WH["No new Init; handler: 35 ms"]
B["Given later fresh environment B"] --> BI["Init: 200 ms"] --> BH["Handler: 40 ms"] Full explanation and primary sources
Reviewed explanation
A Lambda cold-start path includes preparation of an execution environment before the function’s handler runs. Initialization starts the runtime and performs setup, including applicable code outside the handler. A warm invocation can use an environment that is already prepared. The distinction is preparation versus handler work, not a rule that a function is cold only on its first-ever call.
We use a deliberately ordinary on-demand event-function model. The trace says exactly when a fresh environment is prepared on the request path and when a prepared one is reused. It excludes provisioned concurrency, SnapStart, Durable Functions and Managed Instances, which can change where initialization, restoration or other work happens. Even on-demand Lambda can sometimes initialize environments ahead of requests; the trace is a chosen case, not a promise about every invocation.
Code outside the handler can prepare reusable objects, while the handler processes the particular event. In the given second invocation, environment A remains available and is reused, so its setup is not repeated. The handler still runs and can have its own permissions, dependencies, input validation or errors. Warm does not mean that the entire operation takes no time or is guaranteed to succeed.
The function may have been used many times before environment A exists. Scaling, environment retirement or failures can cause a later invocation to take a different preparation path. In the third case we explicitly choose new environment B. Do not infer reuse from the function name, the closeness of two requests, or a label that happened to be fast. A runtime can also reset and initialize again after an error; the no-error example below does not model that path.
The numbers below are invented to separate two parts of time: initialization on the modeled request path plus handler execution. We omit queueing, network transport and all other delays. For A’s first modeled request, 300 milliseconds of initialization plus 40 milliseconds of handler work gives 340 milliseconds. That arithmetic is not an AWS performance target, a cold-start threshold, a billing calculation or a guarantee that all warm calls are faster than all cold calls.
Treat reuse as an optimization, not the storage of record. A prepared environment can retain suitable objects or a temporary cache, but it can be replaced or shut down. An application should not depend on the next invocation receiving that same memory. Here every given read returns Seeds under the unchanged-storage assumption; the returned label is separate from whether a fresh or reused environment handled it.
Source collection
- AWS Lambda: Understanding the Lambda programming model
Used in: Quick notes · Worked example · Lesson text
Configured handler, invocation event/context, ordinary event-function environment reuse, concurrency and transient state.
Describes the configured handler entry point, invocation event/context, initialization outside the handler, returned errors and qualified environment reuse. This lesson is scoped to an ordinary event-function example, not all Durable/Web/Managed Instances behavior, default runtime limits or prices.
- AWS Lambda: Execution environment lifecycle
Used in: Quick notes · Worked example · Lesson text
Init/Invoke, on-demand preparation, environment reuse/reset, suppressed initialization and SnapStart timing; no prices, default limits or universal lifetime.
Explains Init/Invoke, possible environment reuse, resets/shutdown, and different timing for provisioned concurrency, SnapStart, Durable Functions and Managed Instances. On-demand environments can sometimes initialize ahead of requests. No latency distribution, billing claim, lifetime or guaranteed reuse is taken from the page.
Notes AI source review · 2026-10-17
AI source comparison recorded 2026-10-17. Human learner validation is pending.
Quick quiz · one question
Add only the stated initialization time
Sample scenario. Synthetic offline Lantern Archive fixture. Ordinary on-demand,no failures/resets/extensions/SnapStart/provisioned concurrency/otherLambda modes; invented timing excludes queueing/network.
- Chosen scope
Ordinary on-demand event-function example with given fresh or reused environments and no errors or resets. Outside this paper trace: provisioned concurrency, SnapStart, Durable Functions, Managed Instances, extensions, retries, errors, resets, queueing, network transport and other delays. Durations are invented Init + handler only, not measured latency, billing or a guarantee.- one
Given fresh environment A; Init 300 ms; handler 40 ms; stated label Seeds.- two
Given reuse environment A; Init 0 ms; handler 35 ms; stated label Seeds.- three
Given fresh environment B; Init 200 ms; handler 40 ms; stated label Seeds.
Use the given environment facts and invented durations. What are the three modeled times, and how many initialization steps occur?
Why this answer?
Answers stay on this device.
Sources and exercise scope
- AWS Lambda: Understanding the Lambda programming model
Describes the configured handler entry point, invocation event/context, initialization outside the handler, returned errors and qualified environment reuse. This lesson is scoped to an ordinary event-function example, not all Durable/Web/Managed Instances behavior, default runtime limits or prices.
- AWS Lambda: Execution environment lifecycle
Explains Init/Invoke, possible environment reuse, resets/shutdown, and different timing for provisioned concurrency, SnapStart, Durable Functions and Managed Instances. On-demand environments can sometimes initialize ahead of requests. No latency distribution, billing claim, lifetime or guaranteed reuse is taken from the page.
Original synthetic exercise. AI comparison against the reviewed lesson recorded on 2026-10-17; the references above state their scope. Human learner validation has not been run. A result here records this attempt; it does not establish mastery.
Save or adjust this lesson
Make this lesson yours
Save it for later, or tell your robot what would help.
This correction stays on this browser. Browse all concepts if the topic is missing.
Familiarity is your own assessment. To use it in your coding tool, download your updated learning profile.
Familiarity and lesson feedback are saved on this browser. They do not sync to your account or coding tool.