advanced 2 min answer

Marketing wants personalised content on pages currently cached at the edge with a 24-hour TTL. How do you preserve performance?

edgecachingpersonalisation
Show the full answer Hide the answer

What the interviewer is testing

Whether you can decompose a page by cacheability rather than accepting an all-or-nothing choice.

The trap

Making the whole page personalised makes it uncacheable, so every request reaches the origin. Load rises sharply, latency rises, and the CDN's benefit disappears — for a personalised element that is often a small fraction of the page.

The techniques

Split by cacheability. The page shell, navigation, layout and non-personalised content stay cached. The personalised fragment is fetched separately — client-side after initial render, or composed at the edge. The user gets fast first paint; personalisation fills in.

Edge-side composition. Assemble the cached shell with a personalised fragment at the edge, avoiding an origin round trip for the cached majority.

Cache by segment rather than by user. If personalisation resolves to one of twenty segments, cache twenty variants keyed by a segment cookie. That preserves a high hit rate while delivering differentiated content, and it covers most of what marketing actually wants.

Edge compute with edge-replicated data. Run the personalisation logic at the edge against replicated segment data, so no origin call is needed at all.

Reserve full origin rendering for genuinely per-user content, and only on the routes that need it.

The design consequence to manage

Fragments arriving after initial render cause layout shift unless space is reserved. Cumulative Layout Shift is a Core Web Vital and a real user annoyance, so placeholders with reserved dimensions are mandatory, not optional.

What a strong answer adds

Interrogating the requirement. "Personalised" frequently means segment-based rather than individual — returning versus new visitor, region, product interest — and segment caching handles that at near-full performance. Establishing that distinction before designing usually removes the conflict entirely.

And measuring the value: personalisation that costs 400 ms of latency should demonstrate a conversion improvement that exceeds the well-documented conversion cost of that latency.

Common weak answers

Disabling edge caching for those pages. Rejecting personalisation on performance grounds without offering segment caching.