How to Load Data in Parallel Without Waterfalls
Remove request waterfalls in JavaScript by starting independent fetches together, awaiting them with Promise.all and keeping only dependent calls in order.

A waterfall is a chain of requests where each one starts only after the previous one finishes, even though it did not need to wait. Three calls of 200 milliseconds each take 600 milliseconds in a waterfall and about 200 when they run together. The cause is almost always a harmless-looking await in the wrong place. This post shows how to load data in parallel without waterfalls in Node.js 24 and in browser code: how to spot a waterfall, how to start independent work together with Promise.all, how to keep the calls that really depend on each other in order, and how a pipeline of partial dependencies can still overlap. All timings in the examples come from a simulated delay, so the numbers are exact and repeatable.
How a waterfall hides in plain code
Each line below reads naturally, and the whole function is slower than it needs to be.
const delay = (ms, value) => new Promise((resolve) => setTimeout(resolve, ms, value));
const fetchUser = () => delay(200, { id: 1, name: "Ada" });
const fetchPosts = () => delay(200, ["first", "second"]);
const fetchSettings = () => delay(200, { theme: "dark" });
async function loadPage() {
const user = await fetchUser();
const posts = await fetchPosts();
const settings = await fetchSettings();
return { user, posts, settings };
}
const started = performance.now();
const page = await loadPage();
const elapsed = Math.round((performance.now() - started) / 100) * 100;
console.log(page.user.name, page.posts.length, page.settings.theme);
console.log(`about ${elapsed} ms`);Ada 2 first dark
about 600 msThe measured value varies by a few milliseconds, so the code rounds to the nearest 100 and prints "about". The posts call does not use user, and the settings call uses neither, yet each waits for the one before it. Nothing in the language forces that. await pauses the function until the promise settles, so the next line cannot even start the next request.
The fix: start first, await later
A promise begins its work when you create it, not when you await it. So the repair is to create all the promises first and wait for them together.
const delay = (ms, value) => new Promise((resolve) => setTimeout(resolve, ms, value));
const fetchUser = () => delay(200, { id: 1, name: "Ada" });
const fetchPosts = () => delay(200, ["first", "second"]);
const fetchSettings = () => delay(200, { theme: "dark" });
async function loadPage() {
const [user, posts, settings] = await Promise.all([
fetchUser(),
fetchPosts(),
fetchSettings(),
]);
return { user, posts, settings };
}
const started = performance.now();
const page = await loadPage();
const elapsed = Math.round((performance.now() - started) / 100) * 100;
console.log(page.user.name, page.posts.length, page.settings.theme);
console.log(`about ${elapsed} ms`);Ada 2 first dark
about 200 msAll three timers start in the same tick, so the total is the slowest call, not the sum. Promise.all rejects as soon as one promise rejects, which is usually what a page wants: if the user call fails, there is no point waiting for the rest. If you want every result even when some fail, Promise.allSettled returns an array of outcomes instead.
A second form of the same fix keeps the names readable when there are many calls. Start each promise into a variable, then await the variables.
const delay = (ms, value) => new Promise((resolve) => setTimeout(resolve, ms, value));
async function loadPage() {
const userPromise = delay(200, "Ada");
const postsPromise = delay(150, 12);
const settingsPromise = delay(100, "dark");
const user = await userPromise;
const posts = await postsPromise;
const settings = await settingsPromise;
return `${user} has ${posts} posts, theme ${settings}`;
}
console.log(await loadPage());Ada has 12 posts, theme darkThe awaits are sequential, yet the requests are not, because all three promises were created before the first await. Total time is still 200 milliseconds. One hazard comes with this style: if postsPromise rejects while the code is still waiting on userPromise, Node.js reports an unhandled rejection before your later await attaches a handler. Prefer Promise.all when failure handling matters.
Dependent calls stay in order
Some data truly depends on earlier data. The posts for a user need the user's id, so that pair cannot be parallel. The skill is to separate the real dependency from the accidental one, then parallelize everything else.
const delay = (ms, value) => new Promise((resolve) => setTimeout(resolve, ms, value));
const fetchSession = () => delay(100, { userId: 7 });
const fetchPostsFor = (userId) => delay(200, [`post by ${userId}`]);
const fetchFeatureFlags = () => delay(150, { beta: true });
async function loadDashboard() {
const flagsPromise = fetchFeatureFlags();
const session = await fetchSession();
const [posts, flags] = await Promise.all([fetchPostsFor(session.userId), flagsPromise]);
return { posts, flags };
}
const started = performance.now();
const result = await loadDashboard();
const elapsed = Math.round((performance.now() - started) / 100) * 100;
console.log(result.posts[0], result.flags.beta);
console.log(`about ${elapsed} ms`);post by 7 true
about 300 msThe feature flags do not depend on the session, so they start first and run beside it. The critical path is session then posts, 100 plus 200 milliseconds, and the flags finish inside that window. The fully sequential version would take 450. Draw the dependency chain on paper if you are unsure: the longest chain sets the floor, and everything off the chain should be started as early as possible.
Overlapping partial dependencies
Often a later call needs only part of an earlier result. Do not wait for the whole earlier step to feed something small to the next one. If a page needs user for the header and posts for the list, and posts need only the id, which you may already have from the URL, then both can start immediately and the header renders when the user arrives. In frameworks with streaming rendering, that is the difference between a blank screen and a page that fills in.
The pattern for nested data is to build small async functions that each load one piece and return a promise, then compose them without awaiting in the middle.
const delay = (ms, value) => new Promise((resolve) => setTimeout(resolve, ms, value));
const loadAuthor = (id) => delay(120, { id, name: "Ada" });
const loadComments = (postId) => delay(180, [`comment on ${postId}`]);
async function loadPost(id) {
const author = loadAuthor(id);
const comments = loadComments(id);
return { id, author: await author, comments: await comments };
}
const posts = await Promise.all([loadPost(1), loadPost(2), loadPost(3)]);
console.log(posts.map((post) => `${post.id}:${post.author.name}:${post.comments[0]}`));[ '1:Ada:comment on 1', '2:Ada:comment on 2', '3:Ada:comment on 3' ]Inside each loadPost the two lookups overlap, and across posts the three loads overlap, so the whole thing takes about 180 milliseconds, the longest single lookup, not 900. Be aware of the cost, though: three posts mean six simultaneous requests, and three hundred posts mean six hundred. That leads to the next limit.
Do not parallelize without limit
Parallel is not free. Browsers cap simultaneous connections per host, servers rate limit, and a database pool has a fixed size. When the number of calls depends on data, use a concurrency limit, such as the pool from implementing Promise.all with a concurrency pool. A good default is to parallelize across a handful of independent calls and to bound any loop over a list.
Also keep an eye on the cost of the work itself. Parallel requests do not make a slow query faster, they only stop you from adding its time to everything else.
Spotting waterfalls in real code
You can find them without a profiler by reading for a pattern: a sequence of await lines where later calls do not use the variables from earlier ones. A lint rule such as no-await-in-loop catches the loop version, where await inside a for loop serializes iterations that could run together. In the browser, the Network panel's waterfall column shows requests stepping down and to the right instead of stacking. On the server, add a timing log around each step and compare their sum to the total: if the sum equals the total, nothing overlapped.
In frameworks, the waterfall often hides in component structure. A parent component loads its data, then renders a child that loads its own, and the child's request cannot begin until the parent finished. The fix is to hoist the loads to a place where both can start together, for example a route-level loader, or to start the child's request early and pass the promise down.
Where the advice stops
Do not parallelize calls whose order matters for correctness, such as a write followed by a read that expects it. Do not hide a dependency by guessing a value to start early, then discard the work when the guess is wrong, unless the guess is nearly always right. And do not start work the page may never use: a prefetch for a panel the user rarely opens spends bandwidth and server capacity to save time on a path few follow.
A worked review of a slow page
Consider a page handler that took 1.1 seconds in review and had five awaited calls in a row: session, profile, notifications, recent orders and recommendations. Reading the code showed that only orders depended on the profile, because it needed the customer id. The other four needed nothing but the session cookie. Moving the four independent calls into one Promise.all and starting the orders call as soon as the profile arrived cut the longest chain from five steps to three. The code change was about ten lines, and no query was touched.
The review habit that found it is worth copying. For every await, write down which earlier variables the call actually uses. If the answer is "none", the call belongs in the first batch. If the answer is "one", the call belongs right after the one it needs and should run beside any other call that needs the same thing. After that exercise most handlers turn out to have a dependency chain of two or three links, however many calls they make.
Error handling in a parallel load
Starting calls together changes how failures behave, so decide the policy deliberately. With Promise.all, the first rejection wins and the handler can respond with an error immediately, while the other calls finish unseen in the background. That is usually fine for reads. For a page where some sections are optional, wrap those calls so they resolve to a fallback value on failure, and let only the required calls reject the whole load. The comparison in Promise.all vs Promise.allSettled covers the trade-offs in detail.
Timeouts need the same care. A single slow call now holds the whole batch, because the total is the slowest member. Give each call its own timeout through AbortSignal.timeout(), and decide whether a timed-out optional call becomes a fallback or an error. A page that waits 30 seconds for a recommendations widget has made a bad trade, since the widget is the least important thing on it.


