High-traffic Magento 2 architecture with Varnish, Redis and OpenSearch
A layered Magento 2 platform built to stay fast under campaign traffic, with every cache and data tier sized and monitored.
A reference solution describes how we design and deliver this type of system. It is not a specific client case study.
The business problem
Category, search and checkout pages slow down sharply during sales, and adding servers does not help because the bottleneck is in caching, the database or search.
Typical starting point
Magento 2.4 or Adobe Commerce on a few virtual machines, Varnish or Fastly misconfigured or bypassed, MySQL and OpenSearch sharing hosts with PHP.
Problems we usually find
- Low full-page cache hit rate caused by private content and aggressive invalidation
- PHP-FPM workers saturated while CPU is spent on uncached pages
- OpenSearch undersized, with many unnecessary searchable attributes
- Cron and queue consumers competing with customer traffic
Solution architecture
Traffic passes through a CDN and WAF to Varnish, which serves cacheable pages without touching PHP. Stateless PHP-FPM nodes scale horizontally behind it, with admin, cron and queue consumers isolated on their own nodes. Redis runs as separate cache and session instances, and MySQL and OpenSearch sit on dedicated, monitored tiers.
Engineering work
- Profiled requests end to end (APM, slow logs, cache hit rate)
- Fixed cache-busting blocks and invalidation rules
- Separated Redis cache and sessions; tuned PHP-FPM and OPcache
- Reduced searchable attributes and sized OpenSearch heap
- Moved cron and consumers to dedicated workers
- Load-tested checkout at 2x expected peak
Implementation approach
- Baseline: Core Web Vitals, TTFB, cache hit rate, error rate
- Fix highest-impact bottlenecks first, one change at a time
- Re-measure after every change
- Hand over dashboards and a capacity plan
How results are measured
We agree a baseline before work starts and track:
- Full-page cache hit rate
- Server response time (TTFB) for cached and uncached pages
- Largest Contentful Paint and INP on mobile
- Checkout error rate under load
Technology stack
Related services
Magento Performance Optimization
Full-stack Magento 2 speed optimization: profiling, caching, database, OpenSearch, PHP-FPM, front-end and Core Web Vitals, plus load testing.
ExploreMagento Development
Magento 2 and Adobe Commerce builds, B2B portals, Hyvä and headless storefronts, custom modules, integrations and replatforming.
ExploreCloud Infrastructure Management
Multi-cloud infrastructure management across AWS, Azure and Google Cloud: migration, Kubernetes, IaC, high availability and disaster recovery.
ExploreRelated solutions
Magento production rescue and root-cause remediation
A structured response for Magento stores that are down, throwing errors or compromised: stabilise first, then find and fix the real cause.
View solutionMagento CI/CD with zero-downtime deployments
A repeatable pipeline that builds Magento once, tests it, and releases it without taking the store offline.
View solutionMigrating ecommerce and PHP workloads to AWS or Azure
A phased migration from legacy hosting to AWS or Azure, built as code and rehearsed before cut-over.
View solutionFacing this challenge?
Tell us about your environment and a senior engineer will suggest a first step.