Documentation

Redis

Every project hosted on Servd uses Redis by default. You don't have to add any special config or enable anything in the dashboard, simply deploy your project and you're away.

Why does Servd use Redis? #

By default, Craft CMS stores various files on the filesystem of your PHP server, such as mutexes, caches and sessions. On Servd however, we store these things in a Redis database that lives independently on a separate server. We do this for a few reasons:

Scalability - When a site runs on a single server, storing runtime data on the filesystem is fine. However, it becomes a problem when we want to scale horizontally and add more PHP servers. Files stored on one server's filesystem are inaccessible to others, which can lead to a lot of unusual behaviour, e.g. database deadlock, baskets being lost, users randomly being signed out of their accounts, etc. However, by configuring Craft to read and write runtime data to an independent Redis database, PHP servers can be added and removed without issue, offering us a lot more scalabilty.

Security - Servd treats its PHP filesystems as ephemeral. Every time a server is replaced by another one (e.g. when you deploy a change), the filesystem is reset, along with any mutexes, caches and sessions stored on it. This is great from a security perspective, but less great if you're storing your runtime data on the filesystem. They'll just get repeatedly get wiped every time a server is replaced. By using Redis as an independent and external place to store data, server tear-downs leave the data intact and avoid the issue entirely.

Speed - Redis is an "in-memory database" which means it's fast; much faster than reading data from disk. By storing performance-specific data in it, such as caches, you get further performance benefits.

How does Servd set up Redis? #

We inject our own custom Craft config files into your project during deploys, overriding certain items in the config pulled from your git repository. This includes all the necessary plumbing to get your project talking to one of our Redis servers. You shouldn't have to do a thing. 🥳