Eight jobs, one process
Eight jobs, one process

Redis is not a single tool. It is a toolbox that replaced eight pieces of
infrastructure at once — which is exactly why it is so hard to remove.

The eight applications

1. Cache — the job it is famous for.
Store the result of an expensive database query so the next request doesn't
repeat the work. "Top 10 news stories, computed once, served from Redis for 60
seconds." This alone is why most sites install it.

2. Session store.
When you log into a website, the site must remember who you are between
requests. Sessions live in Redis: shared across web servers, auto-expiring,
instant. Log out = delete the key.

3. Rate limiting and counters.
"Max 5 login attempts per minute." Redis counts and expires with one command,
and its single-threaded design makes the count race-free — two requests cannot
slip past the limit at the same instant.

4. Message broker / job queue.
One program pushes a job ("send email to Alice") onto a Redis list; a worker
pops it and does the work. Blocking pops mean two workers never grab the same
job.

5. Pub/sub (publish–subscribe).
A publisher sends a message; every subscriber receives it. No polling, no
queue management. This is a full real-time messaging system inside the cache.

6. Leaderboards and sorted data.
Sorted sets keep scores in native order. Game high-scores, "most popular
products", autocomplete — Redis returns the top 10 without sorting anything.

7. Geospatial lookups.
"Find all taxis within 3 km of this point." Coordinates are stored and queried
natively.

8. Distributed locks and coordination.
Many servers agree "only one of us runs this job" using Redis's atomic
"set only if absent" primitive.

The compounding effect

Each single use case has a dedicated competitor: Memcached for caching, RabbitMQ
for queues, PostgreSQL for state, ZooKeeper for coordination. But Redis bundled
all eight into one process with one protocol. For a small or medium system
that is dramatically fewer moving parts, less code and less operations.

The result is lock-in by convenience: no single feature is irreplaceable,
but the bundle is. Organisations that would happily rewrite one integration
will not rewrite eight.

What the toolbox hides

Here is the part most Redis users never see coming: every job in the toolbox
sits in the same process, behind the same port, protected by the same
assumptions.
The cached sessions, the job queue, the locks and the
rate-limiters are one failed boundary away from each other.

So when Part 6 opens the door Redis never locked, remember the floor plan: the
attackers are not breaking into a cache. They are breaking into the session
store, the queue, and the coordination layer of the whole application.

Next: Part 4 — why Redis beat Memcached, PostgreSQL, Kafka and RabbitMQ, and
what each victory cost.