A browser doesn't draw a page all at once. The HTML arrives first; from it the browser learns what else it needs – styles, fonts, scripts, images – and only once it has enough does it paint the first screen. Every decision about what lives in the HTML and what arrives later directly affects how fast visitors see content and how much work your server does.
What should arrive first
- First-screen content inside the HTML itself. The headline, the main text, the first image. If JavaScript has to assemble it, the screen stays blank until scripts download and run.
- Critical styles early, the rest later. One small CSS file blocks rendering for less time than five large ones.
- The main image with priority (
fetchpriority="high"), images below the fold withloading="lazy". - Scripts with
defer. They don't block painting and still run in order. - Ads, analytics and chat widgets – last. Third parties are the most common reason for a slow site, and visitors don't need them to see the content.
Not everything has to be dynamic
Modern frameworks make it easy to render every page on the server for every visitor. That's convenient for developers but expensive at peak: a thousand visits means a thousand identical computations and a thousand database queries. For every part of a page it pays to ask: how often does this actually change?
- Almost never (about, terms, landing pages) – static HTML, generated at publish time.
- Rarely (countries, cities, categories, price lists) – a JSON file on the CDN, cached for hours or days.
- Often, but the same for everyone (listings, news) – server-rendered HTML, cached briefly on the CDN and refreshed in the background.
- Different for every visitor (cart, profile, messages) – only this needs to be dynamic.
Login state doesn't have to break your cache
A common reason a whole page can't be cached is one tiny part: the corner says “Hi, Mark” instead of “Sign in”. Because of those few words, the entire page is computed from scratch for every visitor.
A better approach: the page is identical for everyone and comes from the cache, and the small login-state part is fetched separately by the browser – one tiny request (e.g. /api/me) – which fills in the corner. Within a few dozen milliseconds the user sees their name, and the server answered with a few bytes instead of a whole page.
The same goes for the cart, the unread-message count or saved items: a static shell, personal details afterwards.
How to tell where you stand
Open your site, then the browser's developer tools (F12) and the Network tab. Look at how long the first request (the HTML) takes, how many requests there are in total, how many megabytes, and which requests repeat on every page even though the content doesn't change. That's a good start – and an audit gives you the full picture.








