← Back to Node.js performance map
🧵
Node.js Performance

Async Bottlenecks

Find slow promise chains, sequential awaits, and stuck async resources.

await

Detailed Description

Async bottlenecks happen when independent operations are awaited sequentially. The endpoint latency becomes the sum of each operation instead of the duration of the slowest operation.

Use tracing or manual timing to find waterfalls. Convert safe independent calls to Promise.all, but keep dependent operations sequential when correctness requires ordering.

Mental Model

sequential await
-> waterfall latency
-> parallelize safe calls

When To Use

  • ->Route latency is sum of many independent awaits
  • ->External calls can run in parallel
  • ->You need visibility into async resource lifetimes
Tools: async_hooks, Promise.all, OpenTelemetry spans
parallel-awaits.js

Live Editor

Loading...

Output

Run code to see output...