Core Web Vitals: Every Page Under 1.2 Seconds
The caching layers, image sizes and deferred scripts that got our LCP down on cheap hosting.
Object caching with Redis cut database time on busy pages by more than half, mostly by removing repeated option and permission lookups.
Where the time went
The CDN caches static assets for a year with hashed file names, so a deploy never serves stale CSS.
Fast pages are a feature. Visitors do not read performance reports, but they do leave when a page takes three seconds to show anything.
- Largest Contentful Paint under 1.2 seconds
- Cumulative Layout Shift under 0.05
- Time to First Byte under 200 ms from cache
- 5,000 concurrent visitors on a $6 server
“Premature optimization is the root of all evil.”
— Donald Knuth, Structured Programming with go to Statements (1974)
What we changed
Our rule is to measure first. Every change in this post started with a trace, not a hunch, and several hunches turned out to be wrong.
Results
Images are served at the size they are displayed, with explicit width and height, which fixed most of our layout shift in one go.
Scripts are deferred unless they are needed to paint the first screen, and there are very few of those.
We run a load test before every major release against the smallest server we recommend, not the biggest one we own.
Database indexes follow real queries from the slow log, not guesses made while writing the migration.
How we work on posts like this
Our editing rule of thumb is to cut anything that would not change what the reader does next. Background and history are welcome when they explain a decision, but a post that only tells a story without leaving the reader able to do something is usually a draft that is not finished yet.
Questions or a better approach? Leave a comment below, or reply to the build-log email and we will fold the best ideas into the next release.
Love how honest these build logs are. Most companies would never share the numbers.
We hit the same problem last month. Wish I had read this before our launch.
Would you share the full config file? The snippet is helpful but I am missing context.
Clear, practical and no fluff. Thank you.
I tried this on a small VPS and it worked first time. Thanks for the clear steps.
Small nitpick: the second step assumes Redis is already installed. Might be worth a note.
We switched to this approach after the last post and support tickets dropped noticeably.