Craft CMS, and the Need for Speed

What I do to speed up Craft CMS. Alright. I expect you have Craft properly installed and running. From hereon we can go about optimizing page load times.

Start measuring

It’s easy to waste a lot of time guessing what might be the slow parts of your system. So, don’t. Try to measure as much as you can first.

Page Speed: Insights (PSI) is a nice resource for benchmarking your site and learning about concrete steps to optimize your specific site. Other sites offer similar benchmarking services.

If the PSI benchmark gives you good speed testing results your road ends here. Most likely the results will include suggestions for improvements. And if you implement them you’ll get a faster site and then your road might end there.

Suggestions for Craft specific optimizations

Again, measuring is a prerequisite here. Try to get an overview of what Craft is spending time on when handling requests.

  1. Upgrade PHP. For example php 7.x is orders of magnitudes faster than php 5.x. Look into this.
  2. Optimize the web server (Nginx or Apache). These should be fast to begin with but you might measure and discover that there is extra performance to be eeked out by tweaking the configuration. What does the server look like under load, does it have enough ram?
  3. Upgrade the database. Is your database on the same server or in the same world region? It doesn’t help having a beefy database if it takes a long time to contact it. Are you sharing the database with other applications or is it dedicated to your single craft installation? Does it have enough ram? Look into this.
  4. Start using Craft’s {% cache %} tags. Read the docs. Measure page load times. Start using cache tags. Measure again. Tweak the cache tags measure again.

Want to get even wiser about Craft’s caching?

Check out my other writeup: Getting wiser about Craft’s caching (version 2.6)