Parallel Fetching, Sequential Fetching & Waterfalls
Data fetching performance is often dominated by dependency structure, not by React itself.
Two requests that each take 300 ms can cost roughly:
sequential: 300 + 300 β 600 ms
parallel: max(300, 300) β 300 ms
Real systems add network, database, rendering, and scheduling overhead, but the mental model is useful.
Sequential fetchingβ
Sequential work is correct when one result is required to start the next operation.
const user = await getUser(userId)
const organisation = await getOrganisation(user.organisationId)
Dependency graph:
getUser
β
organisationId
β
getOrganisation
You cannot safely start the second call until you know the ID.
Accidental waterfallβ
This is different:
const project = await getProject(projectId)
const activity = await getActivity(projectId)
const members = await getMembers(projectId)
If all three depend only on projectId, the awaits create an unnecessary waterfall.
Start independent work togetherβ
const [project, activity, members] = await Promise.all([
getProject(projectId),
getActivity(projectId),
getMembers(projectId),
])
Dependency graph:
ββ getProject ββββ
projectId ββ getActivity βββΌβ render
ββ getMembers ββββ
Start early, await lateβ
Sometimes you want finer control than one Promise.all block.
const projectPromise = getProject(projectId)
const membersPromise = getMembers(projectId)
const project = await projectPromise
const permissionsPromise = getPermissions(project.organisationId)
const [members, permissions] = await Promise.all([
membersPromise,
permissionsPromise,
])
This preserves the real dependency while overlapping unrelated work.
Component boundaries can parallelize naturallyβ
Instead of one parent awaiting everything:
export default function Dashboard() {
return (
<>
<Revenue />
<RecentOrders />
<Alerts />
</>
)
}
with each async Server Component owning independent data:
async function Revenue() {
const revenue = await getRevenue()
return <RevenueCard value={revenue} />
}
async function RecentOrders() {
const orders = await getRecentOrders()
return <OrdersTable orders={orders} />
}
The server render can begin independent work without forcing one large top-level sequence.
But component nesting can create a waterfallβ
async function Parent() {
const user = await getUser()
return <Child user={user} />
}
async function Child({ user }) {
const recommendations = await getRecommendations(user.id)
return ...
}
This may be a real dependency.
But if recommendations only need a request-level user ID already available elsewhere, the parent-child sequence may be architectural rather than necessary.
Identify the critical pathβ
Draw the page:
session βββββββββββββββ
β
project βββ¬β members ββΌβ main content
ββ activity β
billing ββββββββββββββββ sidebar
Then label approximate durations:
session 80 ms
project 120 ms
members 300 ms
activity 220 ms
billing 500 ms
Questions:
- Which work blocks first meaningful content?
- Which work can start at request entry?
- Which subtree can stream independently?
- Which call can be cached or precomputed later?
- Which dependency exists only because of component placement?
Promise.all failure semanticsβ
Promise.all rejects when one input rejects.
That may be correct for a cohesive unit:
const [account, permissions] = await Promise.all([
getAccount(id),
getPermissions(id),
])
If either is required for safe rendering, fail the unit.
But optional data might need independent handling:
const accountPromise = getAccount(id)
const recommendationsPromise = getRecommendations(id)
.catch(() => [])
Do not turn every error into an empty fallback. Only degrade gracefully when the product semantics allow it.
Avoid giant fan-outβ
Parallelizing 100 requests is not automatically good.
Promise.all(100 remote calls)
can cause:
- upstream overload
- rate-limit spikes
- connection pool pressure
- database saturation
- memory growth
- tail-latency amplification
Concurrency should match the dependency and infrastructure contract.
Database N+1β
Example:
const projects = await db.project.findMany()
const rows = await Promise.all(
projects.map(async project => ({
project,
owner: await db.user.findUnique({
where: { id: project.ownerId },
}),
})),
)
Even though the inner queries run in parallel, you still created N+1 database work.
Prefer database-level joins/includes/batching when appropriate:
const projects = await db.project.findMany({
include: { owner: true },
})
Parallelism does not fix a poor query shape.
Pool limits matterβ
A route that launches many database calls can exhaust a small connection pool.
Measure:
query count
pool wait time
query duration
concurrent requests
transaction duration
Do not benchmark one isolated request and assume production concurrency behaves the same.
External API concurrencyβ
For a service with strict rate limits, use bounded concurrency when needed rather than unbounded fan-out.
Architectural options:
- aggregate upstream
- batch IDs
- cache shared data
- precompute
- queue non-critical work
- stream optional UI later
Sequential UX can still be correctβ
Example checkout:
validate cart
β
load authoritative prices
β
calculate tax
β
create payment intent
These stages have real dependencies.
Trying to parallelize them could produce incorrect or insecure results.
The goal is not βparallelize everything.β
The goal is:
remove accidental dependencies, preserve real ones.
Waterfalls across service layersβ
The component may look parallel while a helper hides a sequence:
async function getDashboard() {
const user = await getUser()
const org = await getOrg(user.orgId)
const plan = await getPlan(org.planId)
const limits = await getLimits(plan.id)
return { user, org, plan, limits }
}
Instrument the entire dependency chain, not only React components.
Streaming changes the questionβ
Without streaming, you may ask:
How fast can every dependency finish?
With Suspense boundaries, you can also ask:
Which dependencies must finish before useful UI appears?
Phase 10 goes deeper into streaming mechanics. Phase 5 uses Suspense to separate critical and deferred data work.
Preload relationshipβ
Sometimes one component knows a dependency will be needed later.
You can start work earlier without immediately awaiting it.
void preloadProject(projectId)
The preload chapter covers this pattern and React cache in detail.
Performance debugging workflowβ
When a route feels slow:
1. capture end-to-end route time
2. list every data dependency
3. mark dependency edges
4. add durations
5. find longest chain
6. remove accidental awaits
7. reduce N+1/query fan-out
8. add streaming boundaries where product-safe
9. measure again
Do not begin with memoization or client migration.
Common mistakesβ
Sequential awaits for independent workβ
Start promises together.
Using Promise.all as a performance ritualβ
If operations are dependent or overload infrastructure, parallelization is wrong.
N+1 queries hidden inside Promise.allβ
Fix the query/data model instead of only increasing concurrency.
Making optional data block the main pageβ
Consider independent Suspense/error handling.
Moving slow server reads to the browserβ
That often changes where the user waits, not the underlying latency.
Interview questionsβ
What is a data waterfall?
A sequence where later data work waits for earlier work, whether because of a real dependency or accidental code structure.
How do you decide what to parallelize?
Draw the dependency graph. Operations that depend on the same already-known inputs can often start together; dependent operations must preserve ordering.
Why can Promise.all still be a bad design?
It can create excessive fan-out, overwhelm pools/rate limits, or hide an N+1 access pattern.
How does Suspense affect waterfall design?
It lets independent slow subtrees resolve and stream separately so not every dependency must block the same visible UI.
Exerciseβ
Given a dashboard with:
session 80 ms
profile 120 ms
projects 250 ms
billing 500 ms
notifications 180 ms
Design:
- dependency graph
- which calls start immediately
- which depend on session/org identity
- which content blocks the main shell
- which content can stream
- where batching could reduce query count
- what metrics you would capture before/after