Speed up page load times by saving commonly-used web pages in Drupal’s page cache. Cached pages are faster to send to site visitors.
Table of Contents
This article is part of the Essential steps to speed up a Drupal web site article series. Other articles in this series look at improving the performance of PHP and MySQL and ways to adjust your page layout to improve web site performance.
How to enable Drupal page caching
Drupal&'s page cache is disabled by default. Enable it to speed up page load times substantially.
- Log in as your Drupal site's administrator.
- Go to the Administer » Site configuration » Performance page.
- Check the Normal checkbox for the Caching mode.
- Set the Minimum cache lifetime to 1 day.
- Click the Save configuration button
What does it do?
To build the web page, Drupal queries the site’s database to get menus, blocks, user information, and the main content of a page. All of this is formatted by the site’s modules to create the HTML page that’s returned to the visitor.
By default, Drupal builds a new web page for every visitor. If two visitors ask for the same page, Drupal builds the page twice. To save time, the page cache enables Drupal to save each page the first time it is built. On the second visit, Drupal returns the saved page instead of building it all over again.
The page cache is empty when it is first enabled. As visitors view the site’s pages, Drupal builds and saves the pages into the cache. After awhile, the cache will have most of the site’s popular pages and the site will feel much faster.
Pages in the cache expire and are thrown out after the Minimum cache lifetime. Changes to a cached page will not be seen by visitors until the page expires. To see changes sooner, set the lifetime to a shorter value.
The Caching mode also has an Aggressive setting. When enabled, this slightly improves page load times but it can break some modules. Use it at your own risk.
How well does it work?
I benchmarked the effect of page caching on two representative test sites: a simple Drupal site with just the basic modules, and a complex site with lots of modules (see my Specifications for Drupal web site testing). Both sites have no other performance improvements (e.g., no file compression, no PHP script cache, no MySQL query cache, and no Drupal CSS file aggregation). Load times are for each site’s home page, including HTML, CSS, JavaScript, and images. Tests simulated a web page uploaded over a 64Kbps cable modem, such as that used to serve small web sites from a home or small business.
With page caching, page load times improved by 30-40%.

Web pages for the complex site include more blocks and require more time to build than for the simple site. Caching these complex pages therefore has a more substantial impact than for the simple site. In general, the more complex the site, the greater the benefit from enabling page caching.
When doesn’t it work?
Drupal’s page cache only works for anonymous visitors (people who don’t log in to the site). For many web sites, nearly all traffic is from anonymous visitors and the page cache is an important way of speeding up the site.
However, the page cache is disabled for logged-in visitors. Each of these visitors may have unique account permissions and preferences that shape how Drupal builds web pages. Since each logged-in visitor may be different, Drupal must generate a custom page for each one. It cannot use the page cache.
Conclusions
Drupal’s page cache works well for anonymous visitors and it is a useful way to improve web site performance. Because logged-in visitors do not benefit from the page cache, it is important to also look at other performance improvements, such as file compression and Drupal’s CSS file aggregation.
Further reading
- Essential steps to speed up a Drupal web site.
- Enabling Drupal’s page cache is one of several important steps to speed up a web site. Other steps include enabling file compression, using a PHP script cache, enabling MySQL’s query cache, and enabling Drupal’s CSS file aggregation.
- Drupal 5: Performance
- Drupal’s inventor, Dries Buytaert, has benchmarked page cache performance. It’s worth a read. Note, however, that Dries uses Apache Bench (ab) to repeatedly get the same HTML page and time the results before and after enabling the page cache. This shows a huge 90% improvement. Two catches: (1) his benchmarks are run on the web server itself with near instant access to the files, and (2) Apache Bench only gets the HTML for a page. But real web pages have CSS, JavaScript, and images too, and real site visitors have a slower network connection through which to get the files. More files, big files, and a slower connection mean longer page load times that bring the page cache impact down to the more realistic 30-40% measured above.

Post new comment