Magento Performance Audit · Chapter 1 sample Get the full book

Before You Touch Anything

The client sends a message: “the store is slow.” Within the hour someone has swapped the server for a bigger one, installed a “speed optimization” module, turned on JavaScript merge and bundling and run cache:flush three times “just to be sure.” On Monday the store is still slow, the hosting bill has doubled, and nobody can say what changed, because nothing was measured beforehand.

That is the most expensive mistake in Magento performance, and it isn’t technical: it’s touching things before you know where it hurts.

Rule of thumb

No change goes in without a baseline before and a re-measurement after. If you can’t prove it got faster, you didn’t optimize anything. You just poked at it.

The rest of this book is how to do that with a method, in a 1–2 day audit, and walk out with a report the store owner understands and the team can execute. This first chapter lays the groundwork: where the cases come from, how to turn “slow” into a question you can actually answer, why it’s worth it (in money), the five-step method everything else uses, how to look things up in the book starting from the symptom in front of you, and what access to ask for when the store isn’t yours.

Where the cases in this book come from

The real cases in this book come from performance work on several Magento stores. The ones that teach the most are high-volume stores at a scale that, rounded on purpose, looks like this: millions of orders in the database, tens of thousands of products, several websites, more than one application host with a few hundred PHP-FPM workers, Varnish behind a CDN/WAF1 and a dedicated database. A store like that can have an in-house team and an APM2 installed and still live from one incident to the next; the cases show why. If any of those names are new to you, keep going: workers, Varnish and the rest are explained in this chapter, the first time they make a difference.

At those stores, we measured the same set of things every week:

The instruments were off the shelf: an APM with per-transaction profiling, metrics and logs centralized in dashboards, OpenTelemetry tracing on the backend and RUM on the frontend (collecting metrics from the browser). Nothing exotic. What changed the outcome was turning those instruments into a routine with a verdict, which is the subject of Chapter 9.

The next figure shows four of those results, one per area, each told in full in the chapter indicated. The home page that went from 10.1 s back to 240 ms was a new cache type that shipped disabled in a release. The uniqueness check that dropped from about 18 thousand to under 50 seconds of database time per day (−99.7% or more) was a missing index. Checkout CLS, measured at mobile p90, went from 0.934 to 0.094 through layout changes in the checkout itself. The product page TTFB is the only aggregate: it adds up several changes from the same period, which is why Chapter 7 doesn’t attribute it to any single one of them.

Four results from cases in this book, measured in production, one per area: the home page average (Chapter 4), database seconds per day of a product uniqueness check (Chapter 3), checkout mobile p90 CLS (Chapter 6) and the product page mobile p90 TTFB in RUM (Chapter 7, combined effect of several changes). Each panel has its own scale. Numbers from the cases; database seconds per day rounded.

Three rules apply to every case:

  1. Exact before → after. Latency, CLS, the time of a query or a request and percentages (hit rate, “−89%”) appear as they were measured: if the text says “1,456 ms to 916 ms”, those were the numbers. When a gain wasn’t measured, the case says so in plain words, and some say that was the mistake.
  2. Store scale rounded. Everything that measures the size of the store, rather than the effect of the fix, is rounded or given as a range: orders, table rows, workers, hosts, cache keys, volumes and counts per day, database seconds per day. “Millions of orders”, “a few hundred workers”, “about 18 thousand seconds”. When a number is both kinds, rounding wins, and the ratio between before and after stays exact. The math in the text works out with the rounded numbers.
  3. Vendors by category. Names of the store, its customers and its vendors stay out: a SaaS search, a payment gateway, the CDN, the APM. Off-the-shelf tools (Varnish, Redis/Valkey, New Relic, Tideways, Grafana, Cloudflare) appear by name when the text teaches you to use them, not as a portrait of the store.

Where needed, a detail of a case was changed or combined with one from another store, without changing the mechanism or the number that teaches. The care is so the text doesn’t point to any particular store; the pattern is there for you to recognize in yours.

Some cases are older or from smaller stores, and the text says so. The first of them is in this very chapter, in the cost section: a store I built wrong myself.

One pattern runs through the whole book, and it’s worth knowing up front: most of the problems in these cases didn’t produce a single line of error. The disabled cache type (Chapter 4) wrote nothing to var/log. The query that read the whole table (Chapter 3) returned the right result, just slowly. The signal was always in the shape of a production graph: a plateau where there should have been a peak, a line that peeled away from the others. That’s why this book has so many graphs.

“Slow” is not a diagnosis

“The store is slow” is a symptom reported by someone who isn’t a developer. It can mean completely different things, with causes that have nothing to do with each other:

What the client says What it might be Where the cause usually is
“The home page takes forever to open” High TTFB on a page that should come from cache FPC/Varnish with a low hit rate, a cacheable="false" block
“The page opens, but it’s frozen” Bad LCP or INP with a good TTFB JavaScript, images, third-party scripts
“Category X is slow” One specific category, not the store Layered navigation, filterable attributes, a huge collection
“Checkout takes ages” A page that is uncacheable by nature Plugins in the cart flow, synchronous external integration (shipping, anti-fraud)
“The admin is hell” Order grid, saving a product Queries without an index, indexers on Update on Save, heavy observers
“It gets slow in the morning” Degradation at a fixed time Cron, full reindex, ERP import, backup
“It went down during the campaign” Capacity, not latency Saturated PHP-FPM, mass cache invalidation, database at its limit

The same sentence points to the database, to Varnish, to the frontend or to a cron job scheduled at 9 a.m. Starting to “optimize” without separating those is guesswork. You don’t need to know every term in the table yet: TTFB, FPC, LCP and INP show up later in this chapter, and the rest3 in each area’s chapter.

That’s why the first question isn’t “which server?” It’s: slow where, for whom and when?

Each answer cuts the search space in half. “Only the sofas category, for every visitor, since Tuesday” is a problem you can investigate. “Slow” isn’t.

The chapter goes on

The first measurement (TTFB), why the average lies, what slowness costs in sales, search and servers, and the five-step method the whole book uses. Then ten chapters apply the method area by area: database, cache, code, frontend, infrastructure, bots and observability. In two volumes or the Complete Edition.

See the options