20 Jul 2026 · 2 min read
Magento 2 performance best practices that actually move the needle
A practical Magento 2 performance checklist — full-page cache, Varnish, Redis, indexing, and profiling — ranked by the impact each change delivers.
After cataloging the common mistakes, here is the positive side: the performance practices that actually change numbers, roughly in order of impact. Most of these assume a production-shaped stack — the kind a framework-aware orchestrator like Govard brings up with one command — so the wins are real, not just local.
1. Put Varnish in front (biggest win)
For anonymous catalog traffic, Varnish serving whole pages from memory is the single largest speedup. Ensure cache headers and cookies are correct so the edge cache isn't silently bypassed.
2. Keep the full-page cache on, sessions in Redis
FPC off means PHP renders every page. Redis for sessions and the cache backend keeps state fast and shared across nodes.
3. Schedule the indexers
Don't run indexers "on save" for big catalogs. Schedule them, or drive them through the message queue, so writes don't block requests and reads hit fresh flat tables.
4. Profile before optimizing
Guesswork wastes time. Capture a profiler trace and read where the seconds go. The stock Magento profiler can emit CSV timing data; with a framework-aware local stack you can capture that output on demand and compare before/after any change.
5. Use production mode + opcache
bin/magento deploy:mode:set production enables full DI compilation and static-content generation, and opcache removes per-request recompilation.
6. Trim the frontend payload
Prefer Hyva over the heavy Luma/Knockout stack where appropriate; lazy-load images and non-critical JS; ship only the modules you use.
7. Offload search to OpenSearch/Elasticsearch
Catalog search in SQL doesn't scale. Keep the search index current and monitor its size.
8. Watch the database
Slow query log, proper indexes on custom tables, and avoiding EAV direct queries in custom code all matter at scale.
A simple ranking
| Change | Typical impact |
|---|---|
| Varnish + correct cache headers | Very high |
| FPC on + Redis sessions/cache | High |
| Scheduled indexers | High |
| Production mode + opcache | Medium–High |
| Hyva frontend | Medium–High |
| Search engine current | Medium |
What's next in this series
Performance is one axis; code quality is another. Next: writing Magento 2 code that stays maintainable — events over plugins, lean di.xml, no core rewrites.
Next in this series: Magento 2 code best practices —
/blog/magento2-code-best-practices