0%
Frontend System Design Interviews: Components, Rendering, State, Caching and Performance
Networking and Real Time on the Client
The previous lesson on data fetching treated the network as a layer underneath the cache. This lesson opens that layer. It covers what modern HTTP versions change for frontend design, how to control request volume with batching, debouncing and throttling, how to cancel requests and avoid races, how to retry safely, how to choose between polling, long polling, server sent events and WebSockets, and how to handle reconnection, missed events and offline use. These topics appear in almost every frontend prompt that involves search, feeds, collaboration, notifications or chat, and they are where many otherwise strong designs fall apart under questioning.
In the framework from the first lesson, this is mostly step four, the interface, and a common deep dive in step five.
Latency, not bandwidth
The first fact to keep in mind is that for most web requests, latency dominates bandwidth. A typical API response of a few kilobytes takes almost no time to transfer even on a slow connection, but each round trip on a mobile network can take one hundred to several hundred milliseconds. A new connection needs several round trips before the first byte of data: a DNS lookup, a TCP handshake and a TLS handshake, or with HTTP/3 a combined QUIC handshake. On a phone with a weak signal, a cold request to a new origin can easily cost half a second before the server even starts working.
This shapes client design. Fewer round trips matter more than fewer bytes. Reusing connections matters. Avoiding sequential requests, the waterfalls from the data fetching lesson, matters most of all. When you estimate how long a screen takes to load, count round trips, not kilobytes.
What HTTP/2 changed
HTTP/1.1 sends one request at a time per connection. Browsers worked around that by opening around six connections per origin, and requests beyond six queued. That is why older advice said to concatenate files into large bundles, combine icons into sprite images and spread assets across several domains, a trick called domain sharding, to get more parallel connections.
HTTP/2 multiplexes many requests over a single connection as independent streams, interleaving their frames. Thirty requests can be in flight on one connection at once, with one handshake and header compression that makes repeated headers such as cookies cheap. The old workarounds now often hurt. Domain sharding adds handshakes and splits prioritisation across connections. Huge concatenated bundles defeat caching, because a one line change invalidates the whole file. With HTTP/2, a moderate number of reasonably sized chunks, split by route and feature as the performance lesson described, caches better and loads just as fast.
HTTP/2 still runs over TCP, which delivers bytes in order. If one packet is lost, every stream on the connection waits until it is retransmitted. This is head of line blocking at the transport level, and on lossy mobile networks it can make one HTTP/2 connection behave worse than several HTTP/1.1 connections.
What HTTP/3 changes
HTTP/3 runs over QUIC, a transport built on UDP. QUIC handles streams itself, so a lost packet only delays the stream it belongs to, not all of them. It combines the transport and TLS handshakes, so a new connection needs fewer round trips, and it supports resuming a previous session with zero round trip data for repeat visits, with care around replayed requests. It also supports connection migration: when a phone moves from Wi-Fi to cellular and its IP address changes, a QUIC connection can continue rather than being torn down and rebuilt.
For a frontend engineer, HTTP/3 is mostly a server and CDN setting, not client code. Its effects are worth knowing for the interview: faster first connections, better behaviour on lossy mobile networks and more resilient long lived connections. Most major CDNs support it, and browsers negotiate it automatically when the server advertises it.
Request count still matters, differently
Multiplexing makes many small requests cheaper, but not free. Each request still has headers, server processing, a slot in the browser's priority scheme and, for API calls, often a database query behind it. Fifty requests for fifty avatars on one feed screen create fifty server round trips of work and fifty cache entries to manage. And requests to different origins do not share a connection at all, so each new third party origin pays its own handshake.
The practical guidance is to keep static assets on few origins, split code by route and feature rather than into one bundle or hundreds of tiny files, use preconnect for one or two critical third party origins and design APIs so that a screen needs a small number of requests, ideally fetched in parallel.
Request batching
When many components need small pieces of related data at the same moment, a batching layer can combine them into one request. The classic example is a feed where each post's avatar component asks for its author's profile. Instead of twenty requests, the batcher collects every id requested within a short window, often a single tick of the event loop or a few milliseconds, sends one request for all of them and distributes the results to each caller.
Batching needs API support, such as an endpoint that accepts many ids, and it trades a few milliseconds of waiting for fewer requests. It also makes failures coarser: if the batch fails, every caller fails. GraphQL APIs often batch naturally because one query can request everything a screen needs; some GraphQL clients also batch separate queries into one HTTP request. The usual alternative to client batching is simply to ask the server to embed related data, such as including author summaries in the feed response, which removes the extra requests entirely and is often the better answer.
Request priority
Not all requests are equally urgent. The main content's data should go first, analytics and prefetches last. The fetch priority hint lets you mark requests as high or low priority, and the browser uses it when scheduling. Analytics beacons can use sendBeacon or keepalive requests that the browser sends without delaying anything else, even as the page unloads. In an interview, a single sentence that the feed request is high priority and prefetches and analytics are low priority shows you think about contention on slow networks.
Compression and payload shape
Payload size is rarely the main cost, but it is not irrelevant on slow connections or for large lists. Servers should compress text responses with Brotli or gzip, which typically shrinks JSON by seventy to ninety percent. Beyond compression, the shape of the payload matters more. A feed endpoint that returns every field of every post, including full comment threads and author biographies, sends data the screen never shows and costs parse time on low end phones. Ask for the fields the screen needs, paginate lists with cursors and send summaries in lists with full detail only on the detail screen. GraphQL makes field selection explicit; with REST, a few purpose built endpoints for the main screens, sometimes called a backend for frontend, achieve the same effect.
Images and video are the exception where bytes dominate, and the performance lesson covered responsive images and modern formats. For API traffic, the order of priorities is round trips first, then payload shape, then compression settings, which are usually already handled by the CDN.
What the interviewer is checking
The interviewer is checking whether you reason in round trips, know that HTTP/2 and HTTP/3 change old bundling advice, understand head of line blocking and the benefits of QUIC on mobile and can reduce request counts sensibly through API design or batching. A strong answer connects these to the design: the feed embeds author summaries so avatars need no extra requests, assets are served from one CDN origin over HTTP/3 and route chunks are moderately sized for caching.
On mobile networks a round trip often costs more than downloading a typical API response. When you estimate load time for a screen, count new connections and sequential requests first; they usually explain the delay better than payload size.