Skip to content

How to Speed Up Magento 2 in 2026: A Checklist Verified Against Adobe's Docs

Speed up Magento 2 in order: move to supported versions, run production mode, put Varnish in front of the store and Valkey behind it for cache and sessions, tune OPcache and database memory, set indexers to Update by Schedule, cut JavaScript and image weight, and measure with real-user Core Web Vitals rather than a PageSpeed score alone.

The fastest way to speed up Magento 2 is to work in order: supported versions first, then production mode, then caching with Varnish and Valkey, then PHP and the database, and finally JavaScript and images. Measure with real-user data after each step, not with a PageSpeed score on its own.

Every item below was checked against Adobe's documentation or the Magento source. It applies to Magento Open Source and Adobe Commerce on your own infrastructure; Adobe Commerce on Cloud uses Fastly and has its own settings.

What has the biggest effect on Magento speed?

Step What it improves Command or setting
Supported versions PHP and service performance, security Adobe's system requirements
Production mode Precompiled DI and pre-deployed static files bin/magento deploy:mode:set production
Varnish Pages served without PHP, so lower TTFB bin/magento varnish:vcl:generate
Valkey In-memory cache and sessions bin/magento setup:config:set
OPcache PHP execution speed php.ini
Indexers on schedule Faster saves in the admin bin/magento indexer:set-mode schedule
JavaScript and CSS LCP and INP bin/magento config:set dev/...
Images LCP and CLS bin/magento catalog:images:resize --async

Which versions should you run in 2026?

  • Magento 2.4.9: PHP 8.5, MariaDB 12.3 or MySQL 8.4, OpenSearch 3, Valkey 9, Varnish 8.
  • Latest 2.4.8 patch: PHP 8.4 or 8.3, MariaDB 11.4 or 11.8 or MySQL 8.4, OpenSearch 3, Valkey 8.1.
  • End-of-life services: MySQL 8.0 support ended on April 30, 2026, Elasticsearch 7.17 on January 15, 2026, and all Elasticsearch modules are deprecated in Magento from 2.4.8.
  • 2.4.6: regular support ended on August 11, 2026, with extended support until August 31, 2027.

How do you run Magento in production mode correctly?

Production mode uses precompiled dependency injection instead of generating it per request; Adobe says that saves up to 25% of request processing time. This is the deployment order Adobe recommends:

bash
composer install --no-dev
bin/magento setup:di:compile
composer dump-autoload -o --apcu
bin/magento setup:static-content:deploy -j 4
  • -j sets the number of parallel jobs; the default of 0 means no parallelism.
  • Static content deploy only runs in production mode unless you add -f.
  • bin/magento deploy:mode:set production puts the store in maintenance mode and runs compilation and deployment itself.

How should you cache pages and data?

  • Pages: Varnish in front of Magento is Adobe's production recommendation. See setting up Varnish full page cache.
  • Cache and sessions: Valkey at the version your release requires. See moving Magento from Redis to Valkey.
  • Cache types: confirm they are all enabled in System › Tools › Cache Management or with bin/magento cache:status. Magento's cache lives on the server, not in the shopper's browser.

For how cache, queues and indexing interact under load, see the Redis, RabbitMQ and indexing lesson (Arabic, with English code).

Which PHP and OPcache settings does Adobe recommend?

ini
memory_limit=1G
realpath_cache_size=10M
realpath_cache_ttl=7200
opcache.memory_consumption=512
opcache.max_accelerated_files=60000
opcache.validate_timestamps=0
opcache.enable_cli=1
  • Keep opcache.save_comments enabled; Magento relies on code comments for code generation.
  • With validate_timestamps=0, PHP won't notice new files on its own, so reload PHP-FPM after every deploy.
  • Apply the same settings to both the CLI and FPM php.ini.
  • Memory: on a dedicated database server, innodb_buffer_pool_size can take around 80% of RAM so tables and indexes stay in memory.
  • Query cache: don't tune query_cache_size; the query cache was removed in MySQL 8.0.
  • Search: run OpenSearch 3 on its own host, and after changing the search engine run bin/magento indexer:reindex catalogsearch_fulltext.
  • Flat catalog: leave it off. Adobe says it's no longer a best practice from 2.3.x.

How should you configure indexers and cron?

bash
bin/magento indexer:set-mode schedule
bin/magento cron:install
  • Update by Schedule separates saving a product from reindexing it; cron processes the changes in batches. Adobe recommends leaving the Customer Grid indexer on Update on Save.
  • On large catalogs, Adobe reports that lowering batchRowsCount from 5000 to 1000 cut a full B2B reindex from four hours to two.
  • Enable asynchronous email sending at Stores › Settings › Configuration › Sales › Sales Emails › General Settings › Asynchronous Sending.

Indexer modes and MView are explained in the indexers lesson (Arabic).

How do you reduce JavaScript and CSS?

The Developer section is hidden in the admin in production mode, so use the CLI:

bash
bin/magento config:set dev/js/minify_files 1
bin/magento config:set dev/css/minify_files 1
bin/magento config:set dev/template/minify_html 1
bin/magento config:set dev/css/use_css_critical_path 1
  • Don't merge files over HTTP/2: Adobe considers merging deprecated.
  • Built-in JS bundling is a fallback, not a fix: it loads every bundle on the first visit, and Adobe prefers HTTP/2 or advanced bundling.
  • Critical CSS needs a web/css/critical.css file in your theme; Luma ships one.
  • Magento 2.4.9 adds dev/js/defer_non_critical to defer non-critical head scripts.
  • Hyvä has been free and open source since November 10, 2025, and removes RequireJS and Knockout from the storefront.

How RequireJS and layout XML load assets in the first place is covered in the frontend lesson (Arabic).

How do you optimise images?

  • Magento already adds loading="lazy" to category listing images. Don't lazy-load the main above-the-fold image: web.dev found pages that did had a median LCP of 3,546 ms versus 2,922 ms without.
  • Pre-generate image sizes with bin/magento catalog:images:resize --async and the media.storage.catalog.image.resize consumer.
  • Magento doesn't convert images to WebP; use a CDN image service or a build step. Google measures lossy WebP at 25–34% smaller than JPEG.
  • Point Base URL for Static View Files and Base URL for User Media Files at your CDN, in both Base URLs and Base URLs (Secure).

How do you know the store is actually faster?

  • Core Web Vitals from real users at the 75th percentile, mobile and desktop separately: LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1.
  • TTFB is a diagnostic, not a Core Web Vital; web.dev treats 0.8 s or less as a rough guide for good.
  • A PageSpeed score is a lab measurement, not the Core Web Vitals assessment.
  • Test several states: guest and signed-in, on mobile and desktop.
  • Speed shows up in revenue: Vodafone improved LCP by 31% and saw 8% more sales.

How speed and SEO overlap from day one is covered in the Magento SEO lesson (Arabic). To see which popular tips no longer work, read outdated Magento speed tips to drop.

Magento 2 speed checklist

  • Magento, PHP and services are on versions in Adobe's requirements
  • The store runs in production mode, deployed with --no-dev and setup:di:compile
  • Varnish serves the full page cache
  • Cache and sessions run on Valkey, in separate instances or databases
  • OPcache uses Adobe's values and PHP-FPM reloads after each deploy
  • innodb_buffer_pool_size is tuned and there is no query cache
  • OpenSearch 3 is in place and the flat catalog is off
  • Indexers use Update by Schedule and cron is running
  • Minification is on and merging is off over HTTP/2
  • The LCP image isn't lazy-loaded and image sizes are pre-generated
  • Core Web Vitals are measured from real users after every change

Sources

Technical claims in this article were checked against:

  1. Adobe — System requirements
  2. Adobe — Release versions and support dates
  3. Adobe — Performance best practices: deployment flow
  4. Adobe — Performance best practices: software recommendations
  5. Adobe — Performance best practices: configuration
  6. Adobe — Optimize CSS and JavaScript files
  7. Adobe — Advanced JavaScript bundling
  8. Adobe — Critical CSS path
  9. Adobe — Flat catalog
  10. Adobe — Catalog image resizing
  11. web.dev — Defining the Core Web Vitals thresholds
  12. web.dev — Lazy loading and LCP
  13. web.dev — Vodafone case study
  14. Google — WebP

Frequently asked questions

What is the first step to speed up a Magento 2 store?

If the store isn't in production mode and has no Varnish, start there. Production mode uses precompiled dependency injection and pre-deployed static files, and Varnish serves cached pages without the request reaching PHP.

Should I enable Merge JavaScript Files in Magento 2?

Not if your server supports HTTP/2. Adobe considers merging deprecated and of no benefit over HTTP/2; enable minification instead with bin/magento config:set dev/js/minify_files 1.

Does the flat catalog make Magento 2 faster?

Adobe says the flat catalog is no longer a best practice for 2.3.x and later, and both flat catalog settings are off by default. Magento relies on index tables and OpenSearch instead.

What Core Web Vitals should a Magento store aim for?

Per web.dev: LCP of 2.5 seconds or less, INP of 200 milliseconds or less and CLS of 0.1 or less, measured at the 75th percentile of real visits, separately for mobile and desktop.

How should OPcache be configured for Magento 2?

Adobe recommends opcache.memory_consumption=512, opcache.max_accelerated_files=60000, opcache.validate_timestamps=0 and opcache.enable_cli=1. Keep opcache.save_comments enabled and reload PHP-FPM after every deploy so new code is picked up.

Related lessons (Arabic)

These free lessons are written in Arabic; code and technical terms are in English.

Written by

Abdulrahman Masoud

Questions about this article, or need help with a Magento store? Message me.