Submit feedback on
Excessive Lambda Duration from Synchronous Waiting
We've received your feedback.
Thanks for reaching out!
Oops! Something went wrong while submitting the form.
Close
Excessive Lambda Duration from Synchronous Waiting
Igor Bareev
Service Category
Compute
Cloud Provider
AWS
Service Name
AWS Lambda
Inefficiency Type
Inefficient Configuration
Explanation

Some Lambda functions perform synchronous calls to other services, APIs, or internal microservices and wait for the response before proceeding. During this time, the Lambda is idle from a compute perspective but still fully billed. This anti-pattern can lead to unnecessarily long durations and elevated costs, especially when repeated across high-volume workflows or under memory-intensive configurations.

While this behavior might be functionally correct, it is rarely optimal. Asynchronous invocation patterns—such as decoupling downstream calls with queues, events, or callbacks—can reduce runtime and avoid charging for waiting time. However, detecting this inefficiency is nontrivial, as high duration alone doesn’t always indicate synchronous waiting. Understanding function logic and workload patterns is key.

Relevant Billing Model

Lambda costs are based on two primary dimensions:

Detection
  • Review Lambda functions with consistently high average or p95 durations relative to expected execution complexity
  • Identify functions that invoke external services or APIs synchronously
  • Check whether long execution times correspond to periods of low CPU or memory utilization
  • Evaluate whether downstream systems could be decoupled or moved to an async pattern
  • Consult application owners to confirm whether waiting time is built into function logic
  • Correlate duration spikes with network latency or known API response delays
Remediation
  • Redesign functions to offload synchronous calls using asynchronous patterns (e.g., queues, event buses, Step Functions)
  • Break apart long-running workflows into smaller chained or event-driven Lambdas
  • Optimize memory allocation to minimize idle cost when waiting cannot be avoided
  • Include async design principles in serverless architecture reviews
Submit Feedback