Craft CMS performance tips

Published

Updated

The usual causes of a slow Craft CMS site on fortrabbit, and where to fix each one, from database queries and image transforms to the queue and caching.

About Craft CMS performance

Most slow Craft CMS sites in our support share a few causes. Start by finding where the time goes: the metrics and logs of the environment show whether PHP, memory or the database is the bottleneck. The general performance section covers what applies to any PHP app, including PHP processes and scaling.

Common causes

SymptomLikely causeFix
504 on image upload or first page viewImage transformsImage transforms
Slow pages, many queriesElement queriesDatabase queries
Site slow while editors workQueue in web requestsQueue jobs
Memory killsTransforms, bulk updatesOut of memory
High disk I/OCache without keyCaching
Load from botsUncached 404 pagesCaching

Blocking PHP requests

A PHP process is busy as long as it is executing. When all of them are busy, the site stops answering. Examples from support:

  • A plugin queries an external service in a blocking way and the answer takes too long.
  • The database is overwhelmed by too many or too expensive queries.
  • Image transforms or the queue run in the PHP processes that serve the site.

Dev mode in production

Keep CRAFT_DEV_MODE=false on fortrabbit, as the software template sets it. In dev mode, Craft logs more and writes verbose log files, which costs time on every request. See production settings.

Further reading

Ryan Irelan has educational video content on CraftQuest, some paid, some free:

Frequently asked

Why is my Craft CMS site slow on fortrabbit?

Most often image transforms or the queue run in the PHP processes that serve the site, or element queries load too much from the database. The metrics of the environment show whether PHP, memory or the database is the bottleneck.

#

Written by humans and AI in collaboration.

AI use & editorial processEdit on GitHub ↗