Technology · Database

Redis — cache, sessions and queues in operation

Redis keeps data in memory and serves it faster than a database could. We use it in Shopware 6 and TYPO3 as a cache and session store, and as a queue for background work with Symfony Messenger. Redis does not speed up anything that was built wrong, though. It only hides it until the cache is empty.

cache and session store in operation

What is Redis?

Redis is a data store that keeps information in memory — used for caches, session data and task lists that are allowed to be fast and short-lived.

What we use Redis for

In Shopware 6, Redis takes the object and HTTP cache as well as the sessions. That noticeably relieves the database, because basket and login state no longer run through tables that are written on every page view. In TYPO3, Redis takes over the caching framework backends. In our own Symfony applications we also use it as a transport for Symfony Messenger, so that imports, mail dispatch and ERP synchronisation do not hang inside the web request.

The typical case is a project with several application servers behind a load balancer. As soon as sessions must not live on a single machine, a shared store is needed, and Redis is the obvious route. The same goes for shops with many simultaneous hits on the same category pages. What it cannot solve: a cache only helps on the second request. The first stays as slow as the application builds it.

How we run Redis

Redis runs here in its own containers on the Proxmox cluster, separated by purpose. Cache and sessions do not share an instance, because they need different rules: a cache may discard entries, a session may not. That is exactly where many installations come apart. If maxmemory-policy is set to allkeys-lru and the sessions sit in the same database, baskets are simply evicted under load — and nobody finds the reason in the shop log.

Along with that go persistence settings, a fixed memory limit and monitoring of memory use, evicted keys and hit rate. Redis is also not reachable from outside, only on the internal network and with a password. At deployment we check that cache keys are versioned, so a release does not meet old structures. And when in doubt we clear selectively instead of discarding everything and letting the shop start cold.

When you do not need Redis

A single web server with modest traffic gets by without Redis. Sessions in the file system and the database cache are enough, and you save yourself another service that has to be monitored, updated and understood when it fails. Redis is often sold where a missing index was the real problem. Once the index was in place the query was fast enough — the cache would only have covered it up.

Our order is therefore: measure first, then repair the query or the code, then cache. Cache first and you move the problem to the day the cache is empty — after a deployment, after a restart, after a price change across the whole range. Then the full load hits an application that was never built for it. We would rather say so beforehand.

Frequently asked questions

Does Redis make our shop faster?

Redis makes repeated requests faster, not badly built queries. A cache serves from memory on the second request what was expensively computed on the first — the expensive computation itself remains. So we look at the database queries and the application code first. If load is left over after that, Redis brings a real gain. Before that you are only buying a comfortable delay of the problem.

Do baskets get lost when sessions are stored in Redis?

That happens when the memory limit and the eviction rule are set wrongly. If maxmemory-policy is set to allkeys-lru and cache and sessions share one instance, Redis evicts session data too under memory pressure — baskets and logins included. So we separate cache and sessions, choose the noeviction rule for sessions so that Redis returns an error under memory pressure rather than discarding sessions, switch on persistence and monitor memory use. Redis is then unproblematic for sessions.

At what point is Redis worth having at all?

Redis becomes useful as soon as several application servers need a shared session, or the same content is requested very frequently. The same applies when background work has to move out of the request — imports, mail dispatch, interfaces to the ERP. On a single server with quiet traffic, the additional service is usually not needed. Sharpness sets Redis up when it solves a concrete problem, not as a standard line in a quote.

Redis or Valkey — which do you use?

Both, depending on the environment. Redis changed its licence in 2024 and has been open source again under AGPLv3 since version 8; in parallel, Valkey emerged as a BSD-licensed fork under the roof of the Linux Foundation. Protocol and configuration are largely identical. Where the distribution or the application prescribes it — current Debian and RHEL releases, and Adobe Commerce from version 2.4.8, use Valkey — we run Valkey. Existing systems on Redis are under no pressure to move, but there is a path if they want to.

Redis: existing system or new build?

We also take over systems that were built elsewhere — after a look at the code and the hosting.

What else we build with

Call Start a project