Boost
Boost provides static page caching for Drupal, enabling significant performance improvements for sites that receive mostly anonymous traffic.
boost
Overview
Boost is a static page caching module that dramatically improves performance and scalability for Drupal sites with heavy anonymous traffic. It caches entire HTML pages as static files in the public files directory, allowing web servers (Nginx or Apache) to serve these files directly without executing PHP.
The module works by intercepting responses for anonymous users and saving the rendered HTML to the filesystem. When the same page is requested again, the cached file can be served directly by the web server, bypassing Drupal entirely. This can result in performance improvements from ~8 requests/second without caching to nearly 20,000 requests/second with proper web server configuration.
Boost includes multiple cache generation strategies (cache warming) including entity path generation, XML sitemap crawling, and path alias generation. Cache purging can be done manually, via cron based on the system's maximum cache age, or through Drush commands.
Features
- Static HTML page caching for anonymous users with files stored in public://boost/ directory
- Automatic cache generation on first page visit by anonymous users
- Multiple cache warming strategies: entity paths, XML sitemap crawling, and all path aliases
- Automatic cache purging via cron based on system cache maximum age setting
- Path-based cacheability settings to include or exclude specific paths from caching
- Optional shell command execution (find/rm) for extremely fast cache purging
- X-Boost-Cache response header indicating cache status (partial vs full)
- Batch processing with progress UI for cache generation and purging operations
- Full Drush command integration for CLI-based cache management
- Support for basic authentication during cache generation crawling
Use Cases
High-traffic news or content sites
Boost is ideal for news sites, blogs, or content-heavy sites that receive mostly anonymous traffic. By caching rendered HTML pages, the site can handle dramatically more concurrent visitors without increasing server resources. With proper Nginx configuration, a site can go from ~8 requests/second to nearly 20,000 requests/second.
Shared hosting environments
On shared hosting where you cannot install Varnish or other reverse proxy caches, Boost provides the best option for improving performance. The static HTML files can be served directly by the web server, reducing PHP execution overhead.
Scheduled cache warming for SEO
Use Drush commands in scheduled cron jobs to pre-generate cache files before traffic peaks. By crawling XML sitemaps, you ensure all important pages are cached and ready for visitors and search engine crawlers.
E-commerce product catalogs
For e-commerce sites with anonymous browsing of product catalogs, Boost can cache product listing and detail pages, improving browsing performance while authenticated cart and checkout pages remain dynamic.
Tips
- For optimal performance, configure Nginx to serve static cache files directly using the try_files directive pointing to the boost cache directory
- Use the XML sitemap crawl strategy for large sites to ensure all important pages are pre-cached
- Enable the exec option for extremely fast cache purging on servers where PHP shell commands are allowed
- Set up a cron job to run boost:purge-max-age and boost:generate commands for automated cache maintenance
- Consider using different cache generation strategies for different content types - entity paths for nodes, XML sitemaps for complete site coverage
- The cache files are stored in public://boost/ by default, with the file extension .html
- Always verify Boost is working by checking for the X-Boost-Cache response header in browser developer tools
Technical Details
Admin Pages 1
/admin/config/development/performance/boost
Configure Boost static page caching settings, manage cache generation strategies, and perform cache management operations such as counting, purging, and generating cache files.
Permissions 1
Hooks 2
hook_cron
Implements automatic cache purging based on system cache maximum age when the 'Cron purge maximum age' option is enabled in Boost settings.
hook_help
Provides help text for the Boost module on the help page, explaining the module's purpose and installation requirements.
Drush Commands 6
drush boost:count-cache-files
Count the number of cached files in the Boost cache directory.
drush boost:generate-entity-paths
Generate cache files for entity paths defined in the configuration. Uses batch processing with HTTP requests to warm the cache.
drush boost:generate-xmlsitemap-crawl
Generate cache files by crawling XML sitemaps defined in the configuration. Parses each sitemap and requests all URLs found.
drush boost:generate-aliases-all
Generate cache files for all path aliases in the system. Not recommended for large sites.
drush boost:purge
Purge (delete) all Boost cache files using batch processing.
drush boost:purge-max-age
Purge cache files older than the system's cache maximum age setting. Useful for scheduled cache invalidation.
Troubleshooting 4
The 'partial' header means PHP is still executing. You need to configure your web server (Nginx or Apache) to serve the cached static files directly. Review the Nginx or Apache configuration examples in the module's README.md file.
Ensure you are visiting pages as an anonymous user. Boost only caches responses for anonymous users. Also check that the page is not excluded by the path cacheability settings.
Drush commands that generate cache files require the --uri option to make HTTP requests. Use: drush boost:generate-entity-paths --uri=https://yoursite.com
Ensure cron is running properly and the 'Cron purge maximum age' option is enabled in Boost settings. Also verify that the system Performance page has a cache maximum age greater than 0 (no caching).
Security Notes 5
- Boost only caches content for anonymous users - authenticated user content is never cached
- The module respects page cacheability settings to exclude sensitive paths like /user/* from caching
- When using shell execution mode, ensure the boost cache directory has proper permissions
- Cached HTML files are stored in the public files directory - ensure your web server is configured to prevent directory listing
- Basic authentication credentials for cache generation are stored in configuration - use proper configuration management practices