Redis Installation and Configuration
Redis installation and configuration
Redis keeps data in memory and serves it an order of magnitude faster than disk. It is used as a site cache, session storage and a job queue.
What is included
- installing and configuring the service;
- a memory limit and an eviction policy — without them Redis consumes all free memory and the system starts killing processes;
- access protection: binding to the local interface, a password;
- the PHP extension for working with Redis;
- connecting the site: cache, sessions, or both;
- separate key namespaces where several sites share a server;
- cache hit rate verification — if it is low, the setup achieves nothing.
Two typical mistakes
Redis reachable from outside without a password. The classic: the service listens on all interfaces and anyone can read or wipe the data. For session storage that means someone can hijack a user's session.
A shared key namespace across sites. Two stores on one server overwrite each other's cache, and their owners see odd things: someone else's prices, someone else's category names.
When Redis is not needed
On a site with modest traffic and a small catalogue you will not notice a difference — the file cache copes. Redis pays off where there is load.
Tags: redis, cache, vps, linux, performance