Skip to content
Back to skills

Magento Performance

ASecurity

Optimize Magento 2 performance — full page cache (Varnish), Redis, indexer tuning, JavaScript/CSS optimization, database optimization, and profiling. Use when diagnosing slow pages, optimizing load times, or configuring caching.

  • 39 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added May 29, 2026
ai-agentsjavascriptgojavaphpbashsqldatabasefrontendbackendperformance

Security analysis

A100/100

Scanned May 29, 2026

npx -y skills add OrcaQubits/agentic-commerce-skills-plugins --skill magento-performance --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Magento Performance?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Magento Performance
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/orcaqubits-magento-performance/badge)](https://www.skillsdirectory.com/skills/orcaqubits-magento-performance)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: magento-performance
description: >
  Optimize Magento 2 performance — full page cache (Varnish), Redis, indexer
  tuning, JavaScript/CSS optimization, database optimization, and profiling. Use
  when diagnosing slow pages, optimizing load times, or configuring caching.
---

# Magento 2 Performance Optimization

## Before writing code

**Fetch live docs**:
1. Web-search `site:experienceleague.adobe.com commerce performance` for performance best practices
2. Web-search `site:experienceleague.adobe.com commerce configuration cache` for cache configuration
3. Web-search `site:developer.adobe.com commerce php development cache` for cache development guide

## Full Page Cache (FPC)

### Varnish (Recommended for Production)

- Serves cached pages from RAM before hitting the web server
- Dramatically reduces TTFB (time to first byte)
- Magento generates VCL (Varnish Configuration Language) files
- Configure at Stores > Configuration > Advanced > System > Full Page Cache
- Generate VCL: `bin/magento varnish:vcl:generate`

### Built-in FPC (Fallback)

- Filesystem-based cache — slower than Varnish
- Suitable for development only
- No separate service required

### Cache Invalidation

- Automatic on entity save (products, categories, CMS)
- Manual: `bin/magento cache:clean full_page`
- Cache tags track which pages contain which entities
- Hole-punching for dynamic content (customer name, cart count) via private content/sections

## Redis / Valkey

### Cache Backend

Store all Magento caches in Redis for fast reads:
- Configuration cache, layout cache, block HTML cache
- Configure in `app/etc/env.php` under `cache`

### Session Storage

Store PHP sessions in Redis instead of filesystem/database:
- Faster session reads/writes
- Better for load-balanced environments
- Configure in `app/etc/env.php` under `session`

## Indexer Tuning

- **Update by Schedule** (production) — cron-based, uses changelogs
- **Update on Save** (development) — immediate but resource-intensive
- Monitor indexer status: `bin/magento indexer:status`
- Tune cron frequency for indexer jobs

## JavaScript and CSS Optimization

### Production Mode

Static content is pre-deployed and minified:
```bash
bin/magento setup:static-content:deploy --jobs=N
```

### Minification

- JS minification: enabled via admin config
- CSS minification: enabled via admin config
- HTML minification: configurable

### Bundling

- Built-in JS bundling (basic)
- Advanced bundling with Magepack (community tool) for page-specific bundles
- Critical CSS extraction for above-the-fold rendering

### Hyva Performance Gain

If using Hyva themes: ~5 HTTP requests vs ~230, ~0.4MB vs ~3MB — eliminates most JS optimization needs.

## Database Optimization

- Use MySQL 8.0+/MariaDB 10.6+ for latest optimizer improvements
- Tune InnoDB buffer pool size (ideally 70-80% of available RAM on dedicated DB servers) and use MySQL 8.0 optimizer hints where applicable
- Optimize slow queries: enable slow query log, analyze with `EXPLAIN`
- Clean log tables periodically (cron handles this)
- Use persistent database connections in `app/etc/env.php`

## Profiling Tools

- **Magento Profiler**: enable in `app/etc/env.php` or via `bin/magento dev:profiler:enable`
- **New Relic**: APM integration built into Magento
- **Blackfire.io**: PHP profiling
- **MySQL slow query log**: database bottlenecks
- **Varnish stats**: cache hit rates

## Best Practices

- Always use production mode in production
- Varnish + Redis is the standard production stack
- Set all indexers to "Update by Schedule"
- Pre-deploy static content during build (not on production server)
- Monitor cache hit rates — low rates indicate misconfigured invalidation
- Profile before optimizing — measure, don't guess
- Use CDN for static assets
- Enable HTTP/2 on the web server
- Consider Hyva for frontend performance

Fetch the performance documentation for exact configuration paths, VCL generation options, and Redis configuration format before optimizing.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.