Drupal 11 has one of the most sophisticated caching systems of any CMS. Most slow Drupal sites are not slow because of Drupal; they are slow because something prevents its caches from working. Fix that, and the rest is fine-tuning.
Know your caching layers
| Layer | What it does |
|---|---|
| Internal Page Cache | Stores full pages for anonymous visitors |
| Dynamic Page Cache | Caches pages for all users, leaving personalized parts as placeholders |
| BigPipe | Sends the cached page immediately, then streams personalized placeholders |
| Render cache | Caches individual blocks and components |
| Reverse proxy / CDN | Serves pages from the edge (for example Varnish) |
Get cache metadata right
Every render array should say what it depends on. Cache tags say which data it shows (invalidate when it changes), contexts say what it varies by, and max-age says how long it may live:
$build['latest_news'] = [
'#theme' => 'item_list',
'#items' => $items,
'#cache' => [
'tags' => ['node_list'], // clear when any node changes
'contexts' => ['languages:language_interface'],
'max-age' => Cache::PERMANENT,
],
];
The most common mistake is a max-age of 0 or a user context on a block that appears on every page. One such block can disable caching site-wide.
Isolate personalization with lazy builders
A cart count or a "Hello, Sara" greeting should not make the whole page uncacheable. Render it with a lazy builder and let BigPipe stream it:
$build['greeting'] = [
'#lazy_builder' => ['my_module.lazy_builders:greeting', []],
'#create_placeholder' => TRUE,
];
The service method referenced here must be declared as a trusted callback.
Back-end tuning
- Redis or Memcache for cache bins, so cache reads do not hit the database.
- OPcache properly sized, with realpath cache tuned for large codebases.
- Database: review slow query logs; heavy Views without caching are a frequent culprit.
- Cron and queues: move heavy work (imports, emails, indexing) to queues, not page requests.
Enabling Redis with the contributed Redis module typically looks like this in settings.php:
$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['redis.connection']['host'] = 'redis';
$settings['cache']['default'] = 'cache.backend.redis';
Front-end and Core Web Vitals
Google's Core Web Vitals measure Largest Contentful Paint (LCP), Interaction to Next Paint (INP) and Cumulative Layout Shift (CLS). In Drupal terms:
- LCP: use responsive image styles, modern formats such as WebP via the image style "Convert" effect, and do not lazy-load the hero image.
- INP: keep JavaScript lean; audit contrib libraries attached on every page.
- CLS: always output image width and height, and reserve space for embeds and banners.
- Keep CSS and JavaScript aggregation enabled in production.
A 30-minute performance audit
- Request a page twice as anonymous: is the second response a cache hit?
- Check response headers for
X-Drupal-CacheandX-Drupal-Dynamic-Cache. - Use Webprofiler or similar to find uncacheable blocks.
- Run PageSpeed Insights on your top templates and fix the biggest LCP issue first.
Need a deeper review? Our Drupal performance engineers can audit your stack end to end.