PHPackages                             goat/the-cache-warmer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. goat/the-cache-warmer

ActiveMagento2-module[Caching](/categories/caching)

goat/the-cache-warmer
=====================

Magento 2 module for caching website pages using Python warmer script

V1.0.6(4mo ago)18GPL-3.0-or-laterPHPPHP ~8.1||~8.2||~8.3CI passing

Since Feb 21Pushed 4mo agoCompare

[ Source](https://github.com/Nazar65/the-goat-cache-warmer)[ Packagist](https://packagist.org/packages/goat/the-cache-warmer)[ RSS](/packages/goat-the-cache-warmer/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (5)Used By (0)

 [![Goat Logo](images/goat.jpg)](images/goat.jpg)

[![Python Unit Tests](https://github.com/Nazar65/the-goat-cache-warmer/actions/workflows/python-tests-pipeline.yml/badge.svg)](https://github.com/Nazar65/the-goat-cache-warmer/actions/workflows/python-tests-pipeline.yml)

The Cache Warmer Module
=======================

[](#the-cache-warmer-module)

Overview
--------

[](#overview)

The Cache Warmer module for Magento 2 is designed to improve website performance by proactively warming up cache entries for frequently visited pages. This helps reduce the response time for user requests, especially during high-traffic periods or when cache entries have expired.

The module works by analyzing nginx access logs and sitemap data to identify popular pages and then using a Python script to fetch these URLs, thereby pre-populating the cache with the requested content.

Key Features
------------

[](#key-features)

- **Automated Cache Warmup**: Automatically warms up cache for frequently accessed pages
- **Multiple Warmup Strategies**: Supports config-based, sitemap-based, and log-based warmups
- **Log Analysis**: Parses nginx access log files to extract page URLs
- **Sitemap Integration**: Processes XML sitemaps to identify important product/category pages
- **Sitemap Parsing from robots.txt**: Automatically discovers sitemap URLs by parsing the robots.txt file. Note that this configuration might be environment-specific (e.g., staging environments) and may require adjustments if sitemaps are not properly configured in robots.txt.
- **Smart Filtering**: Filters out static assets (images, CSS, JS), API endpoints, and other non-page resources
- **Multi-Configuration Support**: Supports different user agent and header configurations for various visitor types
- **Admin Configuration**: Fully configurable through Magento admin panel
- **Performance Monitoring**: Logs execution details and performance metrics
- **Rate Limiting**: Control the rate of cache warming requests per minute to prevent overwhelming servers
- **Threaded Execution**: Parallel processing capability for improved performance (disabled by default)

Architecture
------------

[](#architecture)

```
[nginx access.log] → [UrlParser Service] → [CSV Generation] →
                       ↓
               [CacheWarmer Model] → [Python Warmer Script]
                       ↓
                [Magento Cache Warmup]

[sitemap.xml] → [Sitemap Parser] → [CSV Generation] →
                       ↓
               [CacheWarmer Model] → [Python Warmer Script]
                       ↓
                [Magento Cache Warmup]

[custom CSV files] → [Direct CSV Input] → [CacheWarmer Model] → [Python Warmer Script]
                       ↓
                [Magento Cache Warmup]

```

### Components

[](#components)

1. **WarmupFromNginx Cron Job**: Parses nginx access logs and generates CSV files with top visited URLs
2. **WarmupFromSitemap Cron Job**: Processes sitemaps to generate CSV files for cache warming
3. **WarmupFromConfig Cron Job**: Uses configured CSV files for warmup operations
4. **UrlParser Service**: Extracts page URLs from nginx access log, filters out non-page resources
5. **Sitemap Parser**: Parses XML sitemap files to extract product/category pages and other important URLs
6. **CacheWarmer Model**: Executes the Python warming script with configured parameters
7. **Message Queue System**: Allows for asynchronous cache warmup execution via queue consumers
8. **Console Commands**: Manual execution capabilities through CLI commands
9. **Admin Configuration**: Provides interface to configure paths, timeout settings, and schedules

Installation
------------

[](#installation)

There are two ways to install the Cache Warmer module:

### Method 1: Manual Installation (Legacy)

[](#method-1-manual-installation-legacy)

1. Copy module files to `app/code/Goat/TheCacheWarmer/`
2. Run the following commands in your Magento root directory:

    ```
    bin/magento module:enable Goat_TheCacheWarmer
    bin/magento setup:upgrade
    bin/magento cache:flush
    ```

### Method 2: Composer Installation (Recommended)

[](#method-2-composer-installation-recommended)

Install directly from Packagist using Composer:

```
composer require goat/the-cache-warmer:dev-master
```

After installation via Composer, run:

```
bin/magento setup:upgrade
bin/magento cache:flush
```

Performance Improvements &amp; Core Web Vitals (CWV) Results
------------------------------------------------------------

[](#performance-improvements--core-web-vitals-cwv-results)

The Cache Warmer module has demonstrated significant improvements in website performance and Core Web Vitals scores, particularly for default Magento themes.

### Before vs After Cache Warming Performance Comparison

[](#before-vs-after-cache-warming-performance-comparison)

MetricBefore WarmupAfter WarmupImprovement**Largest Contentful Paint (LCP)**2.5s+&lt;1.0s60%+ reduction**First Input Delay (FID)**150ms+&lt;50ms67%+ reduction**Cumulative Layout Shift (CLS)**0.25+&lt;0.160%+ reduction**Time to First Byte (TTFB)**1200ms+&lt;900ms25%+ reduction### Key Performance Benefits

[](#key-performance-benefits)

- ✅ **Passes Core Web Vitals** on default Magento theme
- ✅ **Reduces TTFB below 900ms threshold**
- ✅ **Improves LCP scores by over 60%**
- ✅ **Enhances FID performance significantly**
- ✅ **Maintains consistent CLS values**

### Visual Performance Comparison

[](#visual-performance-comparison)

```
Performance Metrics Before and After Cache Warmer Implementation
                    ┌─────────────────┐
                    │   BEFORE        │
                    │  LCP: 2.5s      │
                    │  FID: 150ms     │
                    │  TTFB: 1200ms   │
                    └─────────┬───────┘
                              │
                              ▼
                    ┌─────────────────┐
                    │   AFTER         │
                    │  LCP:  **Magento Cloud Note**: For Magento Cloud instances, the nginx access log file location may differ from the standard path. Instead of `/var/log/nginx/access.log`, you might need to use `/var/log/platform/project_id/access.log` where `project_id` is your specific project identifier. Ensure that the configured log path matches your environment's actual log file location.

Ignored User Agents Feature
---------------------------

[](#ignored-user-agents-feature)

The Cache Warmer module includes an "Ignored User Agents" feature that allows you to exclude specific bot traffic, crawlers, or other automated requests from being included in cache warming operations. This helps prevent unnecessary cache warming for non-human visitors and ensures that your caching efforts focus on actual customer traffic.

### How It Works

[](#how-it-works)

When enabled, the module will:

1. Parse nginx access logs line by line
2. Check each request's User-Agent header against configured patterns
3. Skip processing any requests from user agents that match the ignored patterns
4. Only include human visitor traffic in the cache warming process

### Configuration

[](#configuration-1)

To configure ignored user agents:

1. Navigate to **Stores &gt; Configuration &gt; Advanced &gt; Cache Warmer**
2. Expand the "Ignored User Agents" section
3. Add one or more user agent patterns (one per line)
4. Save configuration and flush cache

Patterns can be:

- Exact strings (e.g., `Googlebot`)
- Partial matches (e.g., `bot`, `crawler`)
- Regular expressions for advanced matching

### Use Cases

[](#use-cases)

This feature is particularly useful for:

- Excluding search engine crawlers that don't need caching
- Filtering out monitoring tools and health check scripts
- Ignoring automated bots that may not represent real customer traffic
- Reducing unnecessary cache warming when dealing with high-volume bot traffic

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

1. **Access Log Not Found**: Ensure the path in cron job matches your actual nginx access log location
2. **Python Path Issues**: Verify Python executable path is correct in admin configuration
3. **Permissions**: Make sure Magento has write permissions to media directory
4. **Queue Not Processing**: Check that queue consumers are running (`bin/magento queue:consumers:start`)

### Debugging

[](#debugging)

Enable debug logging by setting log level to `DEBUG` or check `/var/log/the_cache_warmer.log` for detailed execution information.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance76

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

132d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5606d4be76bcbf595c098203bc27c36c05459c0ed4387d9b27b61d406e27dcde?d=identicon)[Nazar65](/maintainers/Nazar65)

---

Top Contributors

[![Nazar65](https://avatars.githubusercontent.com/u/2481206?v=4)](https://github.com/Nazar65 "Nazar65 (15 commits)")

---

Tags

cachefastlymagento2performance-optimizationwarmup

### Embed Badge

![Health badge](/badges/goat-the-cache-warmer/health.svg)

```
[![Health](https://phpackages.com/badges/goat-the-cache-warmer/health.svg)](https://phpackages.com/packages/goat-the-cache-warmer)
```

###  Alternatives

[fastly/magento2

Fastly CDN Module for Magento 2.4.x

1564.4M1](/packages/fastly-magento2)[lizardmedia/module-varnish-warmer

Varnish Cache Warmer Magento2 module by Lizard Media

6180.3k](/packages/lizardmedia-module-varnish-warmer)[elgentos/magento2-varnish-extended

This extension extends the built-in Varnish functionalities

6920.7k](/packages/elgentos-magento2-varnish-extended)[litespeed/module-litemage

LiteMage Full Page Cache for LiteSpeed Web Server

3257.9k](/packages/litespeed-module-litemage)[pronko/selective-cache

Pronko Consulting Selective Cache

3520.4k](/packages/pronko-selective-cache)[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1860.2k](/packages/myparcelnl-magento)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
