Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to speed up Drupal 8 with caching and optimization

This guide shows you how to turn on the built-in speed settings in Drupal 8. Your pages will then load faster.

CMS and Apps2 min read14 steps

What is caching?

A cache is a saved copy. Imagine you cook a big pot of soup and keep leftovers in the fridge. You do not cook again each time someone is hungry. Drupal does the same. It saves finished pages and serves the saved copy. This is quicker than building the page again.

Drupal 8 is an older version. Newer versions of Drupal use very similar settings.

Before you start

Take a backup of your site. The settings here are safe, but a backup protects you if something looks wrong afterwards.

Steps

  1. Log in to your Drupal admin area.
  2. In the top menu, click Configuration.
  3. Under Development, click Performance.
  4. Find Browser and proxy cache maximum age. Pick a time, such as 1 hour or more. This tells visitors' browsers how long they can keep a copy of your page.
  5. Find Aggregate CSS files and tick it. CSS files control how your site looks. Joining many into one makes the site load faster.
  6. Find Aggregate JavaScript files and tick it. JavaScript files add moving or clickable parts. Joining them helps in the same way.
  7. Click Save configuration.

Turn on the cache modules

Drupal 8 has two helpers. The Internal Page Cache module saves pages for visitors who are not logged in. The Dynamic Page Cache module saves parts of pages for everyone. Both are usually on already.

  1. Click Extend in the top menu.
  2. Search for Internal Page Cache and Dynamic Page Cache.
  3. Tick them if they are not ticked.
  4. Click Install at the bottom.

Clear the cache

If you change the site and do not see the change, the old saved copy is showing. Clear it.

  1. Go back to Configuration, then Performance.
  2. Click Clear all caches.
  3. Wait a few seconds, then reload your site.
Tip: While you build or change your site, keep aggregation off. Turn it on when the site is ready for visitors.

Quick recap

  • A cache is a saved copy that makes pages load faster.
  • Go to Configuration, then Development, then Performance.
  • Set a cache maximum age and tick both aggregate boxes.
  • Keep the page cache modules on.
  • Use Clear all caches when changes do not appear.
  • Always take a backup first.