Skip to content

What Async/Await Costs on Node 22, and What Crashes It

Node 22 numbers for async/await: Promise.all runs 17x faster than a loop, 5,000 parallel requests start failing, and which patterns crash Node.

· · 12 min read

Updated: November 23, 2026

Bar chart: await inside a loop takes 556 ms, Promise.all 32.2 ms and a pool of 5 takes 116 ms

Quick Take

Async/await is syntax over Promises, so the questions worth answering are numeric: how much faster parallel calls really are, what an await costs, how many requests are too many, and which error patterns kill the process. I measured all four on Node 22 against a real local HTTP server.

Run this yourself. Every number and exit code in this article came from async-await-benchmark/ in the Coding Dunia code-examples repo. npm test on Node 22 or newer reprints them for your machine.

JavaScript async await lets you write asynchronous code that reads like synchronous code, without the nesting of .then() chains. An async function always returns a Promise, await pauses it until that Promise settles, and a normal try/catch handles failures. That's the part every guide covers. The part they skip is numeric: how much faster is parallel, what does one await cost, how many requests is too many, and which error patterns take the whole process down? I ran all four against a real HTTP server on Node 22 and wrote down what came back.

Async/await in one example

Here's the same fetch written both ways. Which one would you rather read at 2am during an incident?

// Promise chain
function getUser(id) {
  return fetch(`/api/users/${id}`)
    .then(res => res.json())
    .then(user => fetch(`/api/orders/${user.id}`))
    .then(res => res.json());
}

// Async/await - same logic, flat structure
async function getUser(id) {
  const res = await fetch(`/api/users/${id}`);
  const user = await res.json();
  const orders = await fetch(`/api/orders/${user.id}`);
  return orders.json();
}

Both do exactly the same thing. The second reads top to bottom. await works inside an async function or at the top level of an ES module, and it unwraps the Promise so user is the actual object, not a pending Promise.

A Promise is a JavaScript object representing the eventual result of an asynchronous operation, in one of three states: pending, fulfilled, or rejected. Top-level await lets you use await directly in an ES module without wrapping it in an async function, which is handy for one-off scripts and for module setup that depends on an async resource.

Promise.all against awaiting in a loop

Promise.all was about 17 times faster for 20 independent requests. I started a node:http server on 127.0.0.1 that answers every request after exactly 25 ms, then fetched 20 URLs from it with five strategies. Nine rounds each, interleaved so a busy moment on the machine hit every strategy. The machine was an Apple M1 with 8 cores, shared with other jobs the whole time, running Node 22.23.3. Two complete runs on 2026-10-16, run 1 and run 2 below, in milliseconds:

StrategyMeasuredIdeal
await inside a for loop556 / 564500
Promise.all32.2 / 33.925
Promise.allSettled29.7 / 32.825
pool of 5116 / 118100
pool of 2286 / 286250
// Slow: each request waits for the previous one
for (let i = 0; i < 20; i++) { await fetch(url + i); }

// Fast: all 20 in flight at once
await Promise.all(Array.from({ length: 20 }, (_, i) => fetch(url + i)));

Promise.all finished 17.3x and 16.6x faster than the loop, against an ideal of 20x. The gap to the ideal is real. The loop paid about 3 ms per request on top of the server's 25 ms, which is the loopback round trip plus timer rounding, and Promise.all paid 7 to 9 ms in total. A real network adds its own latency to both, so the sequential penalty only grows.

The earlier version of this article said a dashboard dropped from 1.4 seconds to 380 ms. I can't reproduce a number like that from a source, so it's gone. What I can show is above, and it's tied to a script you can run.

Promise.allSettled cost the same as Promise.all here. The difference isn't speed, it's what happens on failure: all rejects at the first error and allSettled waits for everything and reports each outcome. When every input fails and you still want one error, Promise.any rejects with an AggregateError, and what its errors array survives is tested elsewhere.

Twenty requests to a 25 ms server took about 560 ms awaited in a loop and about 33 ms through Promise.all, a 17x difference that costs you one line of code.

Share this Post on X Bluesky

Firing thousands of requests at once

At first it works. Then it doesn't. The usual advice is to cap concurrency, and I wanted to know where the cap belongs. Same server, same 25 ms delay, but now N requests at once through Promise.allSettled so failures are counted instead of thrown:

Requests at onceTime, run 1 / run 2Failed, run 1 / run 2
1028.6 / 30.7 ms0 / 0
10044.8 / 40.3 ms0 / 0
1,000262 / 284 ms0 / 0
2,0001,181 / 394 ms0 / 0
5,0004,046 / 7,868 ms0 / 665
5,000 through a pool of 503,187 / 3,371 ms0 / 0

The ideal for every row is 25 ms. At 100 requests the burst took 1.6x to 1.8x the ideal; at 1,000, roughly 10x. At 5,000, the burst had failures in six of the seven runs I made, between 185 and 893 requests, all with ETIMEDOUT. One run was clean. The pool of 50, which takes at most 50 requests at a time, finished the same 5,000 without a single failure in any of my runs, in 3.2 to 5 seconds.

Where the line falls depends on the machine, the load, the server and the network, and my server was on loopback, so don't copy my 2,000. The stable result is the shape: a burst is unreliable past some size and a pool isn't. Here's the pool I used, eight lines:

async function pool(limit, jobs) {
  let next = 0;
  const workers = Array.from({ length: limit }, async () => {
    while (next < jobs.length) {
      const job = jobs[next++];
      await job();
    }
  });
  await Promise.all(workers);
}

My old rule of thumb in this article was "reach for for...of first". The numbers don't support that. A loop was 17x slower than parallel at 20 requests. Reach for Promise.all when the set is small and known, a pool when it's large or unbounded, and a for...of only when order or a rate limit demands it.

The cost of one await

One await cost between 30 and 50 nanoseconds on a quiet core. I timed a million iterations of each shape, best of five, and the two quietest runs agreed:

CaseRun 1 / run 2, ns per iteration
plain function call1.7 / 1.6
await a plain value50.4 / 42.8
await an async function call43.1 / 40.5
await Promise.resolve(x)44.8 / 42.0
the same loop written with .then()35.8 / 34.9

An await is 25 to 30 times a plain call, and a .then() loop is a bit cheaper than an await loop. In busier runs the same code measured up to 250 ns, which tells you how much to trust the absolute figures on a shared machine. The proportions held. Does it matter? A million awaits add about 45 ms. One 25 ms request is the cost of roughly half a million of them. Don't remove an await from code to save time. Do remove one when it serializes work that could overlap.

return await inside try/catch

A bare return promise skips your catch block. I asserted it:

const failing = async () => { await sleep(1); throw new Error('boom'); };

async function without() {
  try { return failing(); } catch { /* never runs */ }
}
async function withAwait() {
  try { return await failing(); } catch { /* runs */ }
}

On Node 22.23.3 the catch block ran in withAwait and did not run in without. The function hands the pending promise to its caller before it fails, and the rejection lands in the caller's lap.

Ticks tell the same story. I counted microtask ticks with a self-rescheduling microtask and compared each shape with an already-resolved promise. async () => await p cost 1 extra tick. async () => p, returning the promise without awaiting it, cost 2. Three awaits in a row cost 3. Promise.all of one promise and of three promises both cost 1, so waiting on three at once costs the same as waiting on one. That's a deterministic result, identical in every run, which the timing numbers above are not. Ticks don't paint anything, though: chunked work between resolved promises painted zero frames in a browser test.

Error patterns that crash the process

Three of the eight patterns I tried crashed it. Each case ran in its own child process on Node 22.23.3 with default flags, and I read the exit code:

PatternExit codeCrashed
Start two promises, await them in order, the second one fails first, try/catch around both1yes
The same two promises through Promise.all0no
Two failures through Promise.all0no
The same two promises through Promise.allSettled0no
forEach(async) with a try/catch around it1yes
for...of with await and a try/catch around it0no
An async call with no await and no .catch()1yes
That same call with a process.on('unhandledRejection') listener0no

The first row is the one that surprised me. This code looks safe and isn't:

const a = okAfter(60, 'a');
const b = failAfter(10, 'fast-fail');
try {
  await a;
  await b;
} catch (e) {
  console.log('caught', e.message);
}

b rejects at 10 ms while the code is still waiting for a. Nothing has attached a handler to b yet, so Node treats the rejection as unhandled and exits with code 1 before your catch can see anything. The try/catch is right there and it never fires. Put both in Promise.all and the same two promises exit with code 0 and print caught fast-fail.

Two more things I asserted. When two promises in a Promise.all both fail, the second error is swallowed without a crash. And Promise.all doesn't cancel anything: with one task failing at 10 ms and two more due at 40 ms, one task had finished when Promise.all rejected, and all three had finished 80 ms later. A rejected Promise.all leaves the other work running. If that work writes to a database, it still writes.

Error handling with try/catch

Use the try/catch you already know. One trap deserves a mention, and I checked it against my local server: fetch resolves on an HTTP 500. My server answered /fail with status 500, and the promise resolved with res.ok false.

async function loadDashboard(userId) {
  try {
    const res = await fetch(`/api/users/${userId}`);
    if (!res.ok) {
      throw new Error(`Request failed: ${res.status}`);
    }
    return await res.json();
  } catch (err) {
    console.error('Dashboard load failed:', err.message);
    return null;
  }
}

Only a network failure rejects, so you check res.ok yourself and throw. Note the return await on the last line of the try block: that's the form that keeps a failed res.json() inside your catch.

forEach doesn't wait

This looks right and is broken:

// BROKEN - forEach ignores the returned Promise
items.forEach(async (item) => {
  await save(item);
});
console.log('done'); // logs first, saves are still running

I ran a three-item version and recorded the order: after forEach, item 1, item 2, item 3. Put a try/catch around it and an error inside the callback still crashes the process with code 1, because the callback's promise is nobody's business. The fix is for...of with await for sequential work, or await Promise.all(items.map(item => save(item))) for concurrent work.

When plain promises still fit

Do you actually need to pause? If you're composing with Promise.race, or kicking off fire-and-forget work, the raw API is cleaner. And in React, a client component can't await in its body; there you hand async work to useEffect, a data library, or the use() hook, which reads a promise created outside the render. Server Components are the exception: they can be async functions and await directly. Our React hooks best practices guide covers the cleanup patterns that keep async effects from leaking, and React data fetching with TanStack Query removes most of the manual async plumbing entirely.

Limits of these numbers

The exit codes, the tick counts and the order of events are deterministic, and they were the same in every run. The milliseconds aren't. One Mac with 8 cores shared with other jobs, a server on loopback, one Node version, one fetch implementation (undici 6.28.1). Timings differed by up to 20% between my two quietest runs and by several times in the busier ones, and the threshold where a burst starts failing moved from run to run. Treat 17x as "an order of magnitude" and treat "5,000 at once is too many" as a shape, not a limit.

Async/await adds no capability Promises didn't already have. It makes asynchronous code readable enough that ordinary developers stopped getting it wrong, mostly. Start independent work together, bound it when it's big, keep return await inside try, and never put an async callback in forEach.

Frequently Asked Questions

What is the difference between async/await and Promises?
Async/await is syntax built on top of Promises. Every async function returns a Promise, and await pauses the function until a Promise settles. The one place the difference shows is timing: awaiting a native promise takes one microtask tick, while returning a promise from an async function takes two. That tick count isn't why return await matters inside try/catch, though: with a plain return the function leaves the try block before the promise rejects, so the catch never runs, while return await keeps it inside the try until the promise settles.
Do I need try/catch with every await?
Not every single await, but every logical unit that can fail. Wrap a related group of awaits in one try/catch, or let the rejection bubble up to a caller that handles it. An unhandled rejection exits a Node 22 process with code 1 by default, and a try/catch around the call does not help if the promise was never awaited inside it.
How do I run multiple async calls at the same time?
Start the calls first, then await them together with Promise.all. In my run, 20 requests to a server that answers after 25 ms took about 560 ms awaited one by one and about 33 ms through Promise.all. Past a few thousand simultaneous requests, bound the concurrency with a small pool instead.
Can I use await inside a forEach loop?
No. Array.forEach ignores the returned Promise, so the awaits do not pause the loop, the code after it runs first, and an error inside the callback becomes an unhandled rejection that crashes Node 22. Use a for...of loop for sequential work, or map the array to Promises and pass them to Promise.all for concurrent work.
Is async/await slower than plain Promises?
Slightly. A loop of one million awaits cost about 43 to 50 ns per iteration on Node 22.23.3, and the same loop written with .then() cost about 35 ns. That gap is real and utterly irrelevant next to the network or disk work you are awaiting, so choose by readability.