← Back to Baseline

MB-R038Redis/Varnish configured

C06 Cache & Indexing Health Medium

Magento supports advanced cache backends like Redis or Varnish. Without proper configuration, stores rely on file-based cache, which scales poorly and risks corruption. Using Redis or Varnish ensures faster cache invalidation, distributed caching, and higher resilience under heavy traffic.

Why it Matters

By default, Magento can use the filesystem for cache and sessions. On production, this is slower and less reliable. If the store has multiple web nodes, file-based cache can cause inconsistencies and broken sessions across servers.

Using Redis (for cache and sessions) or Varnish (for full page cache) provides faster response times, better scalability, and consistent data across clusters. It reduces I/O bottlenecks and ensures stability under heavy traffic.

Verification Steps

Magento configuration

# Check env.php for cache configuration
grep -A3 'cache' app/etc/env.php

# Expected: backend should be redis (not file)

Command line

bin/magento cache:status
# Confirm full_page is enabled with Varnish (if configured)

Remediation / Fix Guidance

  1. Configure Redis for cache and session storage in env.php:
    'cache' => [
      'frontend' => [
        'default' => [
          'backend' => 'Cm_Cache_Backend_Redis',
          'backend_options' => [
            'server' => '127.0.0.1',
            'port' => '6379'
          ]
        ]
      ]
    ],
    'session' => [
      'save' => 'redis',
      'redis' => [
        'host' => '127.0.0.1',
        'port' => '6379'
      ]
    ]
  2. For full page cache, configure Varnish as backend in Magento Admin and web server.
  3. Test cache flush and session persistence after migration.

Examples

Fail Example
# env.php shows filesystem cache
'cache' => [
  'frontend' => [
    'default' => ['backend' => 'File']
  ]
]
Pass Example
# env.php configured with Redis
'cache' => [
  'frontend' => [
    'default' => ['backend' => 'Cm_Cache_Backend_Redis']
  ]
]

References