microservice.guru
← All posts

Backend for Frontend: Should One Slow Service Hold Back the Entire UI?

· Architecture · Microservices · BFF · Performance

By Alain Cyr, Founder, Koesion

microservice.guru — Should one slow service hold back the entire UI? One aggregated call waits 500 ms; two parallel calls to the same BFF paint at 50 ms.

Backend for Frontend: The Missing Link left you with a rule and a dashboard metric: one screen, one call. Build a BFF that way and, within a sprint or two, you will run into the question this post is about.

The 500 ms problem

Take the claim screen from that post. Behind its one BFF endpoint, five services, called in parallel — exactly as recommended. The claim, the policy, the parties and the documents answer in 50 ms. The payment history, sitting on the oldest system in the building, takes 500 ms.

The BFF waits for all five before it answers. So the screen waits 500 ms.

Five parallel calls behind one BFF endpoint: four answer in 50 ms, one in 500 ms, and the whole screen waits 500 ms

Four answers sat ready for 450 ms. Nobody was allowed to see them.

Technically, the BFF did its job. It aggregated, it shielded the client, it fanned out in parallel. And it quietly introduced a new coupling: the whole screen now renders at the speed of its slowest dependency. That is tail latency, and it does not stay put — the more services a screen fans out to, the more likely one of them is having a bad moment on any given load.

One screen, one BFF — not one HTTP request

What “one call per screen” protects is not the request count. It is the rule that the client does not orchestrate the domain: it does not know which services exist, in what order to call them, or how to stitch their answers together. Two requests to the same BFF break none of that.

Option A — one aggregated response. The client calls the claim screen, the BFF calls all five and returns everything together. Simple, atomic, and the slowest service sets the time to first paint.

Option B — two parallel calls to the same BFF. The screen asks for its core — claim, policy, parties, documents — and, at the same moment, for its payment block. The core paints at 50 ms. The payments fill in when they land.

Option A: one aggregated call, first paint at 500 ms. Option B: two parallel calls to the same BFF, core at 50 ms and the payment block at 500 ms

Same BFF, same team, same abstraction. The screen just stopped waiting for its slowest part.

Look at what the client knows in option B: that the screen has two regions, and that they load at different speeds. It still does not know the payment service exists, how it is called, or how its answer is translated. That is screen knowledge, and screen knowledge is exactly what a frontend is allowed to have. The split lives in the BFF, owned by the same team, deployed with the same button:

// BFF — one screen, two endpoints, one owner
app.get('/screens/claim/:id', ({ params }) =>
  Promise.all([
    claims.get(params.id),
    policies.forClaim(params.id),
    parties.forClaim(params.id),
    documents.forClaim(params.id),
  ]).then(toClaimScreen))

app.get('/screens/claim/:id/payments', ({ params }) =>
  payments.history(params.id).then(toPaymentBlock))

// Client — both fired at once, never one after the other
const core = getJson(`/screens/claim/${id}`)
const paymentBlock = getJson(`/screens/claim/${id}/payments`)
renderClaim(await core)
renderPayments(await paymentBlock)

The line to watch is the one between two calls the screen’s design asks for and six calls because the app is assembling a claim again. The first is a layout decision. The second is the problem the BFF was built to remove.

Two other tools

A latency budget. The previous post already has the BFF deciding failure once: the payment block times out, the screen comes back with that block marked unavailable. Give the aggregation a budget of 150 ms and you keep one call and a fast screen. But a budget is not the same thing as option B: when the payments arrive at 500 ms, nobody is listening anymore. It is the right answer for a service that is sometimes late, not for one that is always slow.

Streaming. One request, and the BFF flushes each block as soon as it is ready — a streamed HTTP response, or server-sent events. First content at 50 ms, still one call. It works, and it sends you a bill: timeouts on a connection that stays open, responses your CDN cannot cache, errors that arrive halfway through a payload, and a client that has to render partial data properly. For a screen that loads once, two plain HTTP calls are usually the cheaper answer. For a screen that never stops moving, streaming stops being optional — that is the subject of my futur article Advanced BFFs for real-time consoles (in the next few weeks).

Comparison of full aggregation, two BFF endpoints, a latency budget and streaming by number of calls, first content, last content and cost

Illustrative timings, network and BFF processing excluded. Every row is a legitimate BFF.

Decide by data, not by request count

The right shape depends on what the data means to the screen:

So I would sharpen the rule from the last post rather than retract it:

One screen, one BFF — not necessarily one HTTP request. The goal is to take domain orchestration out of the client, not to make every pixel wait for the slowest service you own.

Calls-per-screen is still the metric to put on a dashboard. Two is fine. Six is a smell. And a fast screen held hostage by one slow block is a smell too — it just never shows up as a number of calls.

Where to go next

References