All questions

Keeping Oxygen's full-page cache while personalizing one hero section, is that possible?

Asked by Suvi Korhonen on

SKSuvi Korhonen

Homepage on Hydrogen, served from Oxygen's full-page cache with CacheLong, hit rate is excellent and TTFB is around 40ms. Now the brief says personalize the hero per audience.

A cached response is by definition shared, so a per-user hero cannot live behind CacheLong. The options I see: drop the page cache for that route and render per request, or keep the cache and personalize the hero client-side after load.

Client-side means the default hero flashes first, which I want to avoid. How are teams reconciling edge caching with server rendered personalization here?

Was this helpful?

2 answers

OBOndrej BlahaAccepted answer

There is no trick that dissolves this tradeoff: full-page caching and per-user server rendering conflict by nature. A personalized route needs per-request rendering, period. The question is only what that costs, and the answer is less than the framing suggests.

What we run: the homepage route renders per request, with the slot content resolved in the Hydrogen loader via Croct, so the variant is in the initial HTML. Shared assets, subresources, and every other route stay cached exactly as before. The loader call is bounded, Croct's end-to-end response is under 90ms at P95, so our TTFB on that route went from about 40ms to under 150ms. Nobody has noticed.

The client-side option is the one I would rule out, moving the hero client-side reintroduces the flash of default content that server resolution avoids, and that one gets noticed.

Related thread with more depth on the cache mechanics: Hydrogen and Oxygen full-page cache conflict with personalization.

Was this helpful?
SKSuvi Korhonen

Concrete numbers, thank you. Under 150ms TTFB for a personalized hero is well within our budget.

Jjules_perf

Adding one nuance: you do not have to make the whole site dynamic, only the routes with personalized slots. We kept CacheLong on collections and product pages and went per-request on the homepage and two landing pages. Worth auditing which routes actually need personalization before assuming the cache is lost everywhere, in our case it was 3 routes out of hundreds.

Was this helpful?
Still have questions?