Menu

Lambda Cold Start in Python: Diagnose and Cut Init Time
📰

Lambda Cold Start in Python: Diagnose and Cut Init Time

DEV Community: aws·Oleksandr Kuryzhev·3 days ago
#Qv0Nnihl
#devtoaws#devto#dev#init#cold
Reading 0:00
15s threshold

Originally published on kuryzhev.cloud

An API Gateway endpoint backed by a Python function answers in 80 ms most of the time, then occasionally takes 3 seconds. The slow requests cluster after idle periods, after deployments, and during traffic bursts. That pattern is most often a Lambda cold start, and this runbook covers how to confirm it, find where the time goes, and fix it in order of increasing cost.

Symptoms: how a Lambda cold start shows up

Look for these signs before changing anything:

p50 latency is fine, but p99 or max latency is several times higher.

Slow requests follow idle gaps, deployments, configuration changes, or sudden traffic increases.

Clients behind short timeouts (API Gateway, Step Functions task timeouts, webhooks) fail intermittently while retries succeed.

The REPORT log line for slow invocations contains an Init Duration field. Warm invocations do not have it.

The last point is the reliable test.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.