Performance
Magento Performance Optimization: The Complete Checklist
Why Magento Performance Matters
A 1-second delay in page load time can reduce conversions by 7%. Magento's flexibility comes at a cost — a poorly tuned store can be slow. The good news: most performance wins are configuration, not code.
1. Enable All Cache Types
bin/magento cache:enableMagento has 17 cache types. In production, all should be enabled. The most impactful:
full_page— full-page cache (FPC), the biggest winblock_html— individual block outputconfig— merged configuration XMLs
2. Use Varnish for Full-Page Cache
The built-in FPC is good. Varnish in front of it is better — it serves cached pages without hitting PHP at all.
bin/magento config:set system/full_page_cache/caching_application 2
bin/magento setup:config:set --http-cache-hosts=varnish:6081Our environments come with Varnish pre-configured and ready to enable.
3. Redis for Session and Cache Backend
Store sessions and the cache pool in Redis instead of the filesystem:
// app/etc/env.php
'session' => [
'save' => 'redis',
'redis' => [
'host' => 'redis',
'port' => '6379',
'database' => '2',
],
],
'cache' => [
'frontend' => [
'default' => ['backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => ['server' => 'redis', 'database' => '0']],
'page_cache' => ['backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => ['server' => 'redis', 'database' => '1']],
],
],4. Elasticsearch Index Optimization
Run a full reindex regularly and optimize your Elasticsearch indices:
bin/magento indexer:reindex catalogsearch_fulltext
bin/magento indexer:set-mode schedule catalog_product_priceSetting indexers to schedule mode means they update asynchronously in cron instead of blocking the save operation.
5. JavaScript Bundling and Minification
bin/magento config:set dev/js/minify_files 1
bin/magento config:set dev/js/enable_js_bundling 1
bin/magento config:set dev/css/minify_files 1For even better performance, consider Hyvä Themes which replaces RequireJS with Alpine.js and reduces JS payload by ~90%.
6. Database Query Optimization
Enable MySQL slow query log in your MagentoEnv environment to spot N+1 problems:
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 0.5;Then use the Magento Profiler (?profiler=1 in dev mode) to correlate slow queries with specific page blocks.