O'Reilly logo

Resilience and Reliability on AWS by Jurg van Vliet, Flavia Paganelli, Jasper Geurtsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Redis

Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, and sorted sets.

Redis has a very novel approach to being a datastore. Actually, its own data structure server is a very apt description: it is a server.

As with all our infrastructure components, we aim for resilience (does not break easily) and reliability (does what you expect it to do). For Redis, we have to figure out how to do the following:

  • Backup/restore
  • Failover
  • Scaling (up and down)
  • Monitoring

This project is available on github at ReDiS.

The Problem

Redis as a data structure server finds its limits in the server. The core idea is that it exposes the memory on an instance as a variety of structured data through an API. This is fast but very fragile. Memory is not persisted.

This feature has two consequences we have to deal with:

  1. Persistence (how to make backups)
  2. Replication

Both these problems would go away if Redis were available in a distributed manner. In the next chapter, we’ll see how elasticsearch elegantly solves this shortcoming. But the distributed Redis is a work in progress and we don’t know when it will be available. In the meantime, we have our own workaround.

Our Approach

Redis has the notion of master-slave replication. In Redis anything can be a master, and masters are almost completely unaware of existing slaves. A slave has only one master, which is slaveof.

This simple approach to replication ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required