Book Image

Mastering Redis

By : Jeremy Nelson
Book Image

Mastering Redis

By: Jeremy Nelson

Overview of this book

Redis is the most popular, open-source, key value data structure server that provides a wide range of capabilities on which multiple platforms can be be built. Its fast and flexible data structures give your existing applications an edge in the development environment. This book is a practical guide which aims to help you deep dive into the world of Redis data structure to exploit its excellent features. We start our journey by understanding the need of Redis in brief, followed by an explanation of Advanced key management. Next, you will learn about design patterns, best practices for using Redis in DevOps environment and Docker containerization paradigm in detail. After this, you will understand the concept of scaling with Redis cluster and Redis Sentinel , followed by a through explanation of incorporating Redis with NoSQL technologies such as Elasticsearch and MongoDB. At the end of this section, you will be able to develop competent applications using these technologies. You will then explore the message queuing and task management features of Redis and will be able to implement them in your applications. Finally, you will learn how Redis can be used to build real-time data analytic dashboards, for different disparate data streams.
Table of Contents (18 chapters)
Mastering Redis
About the Author
About the Reviewers

32-bit Redis

In the official documentation on's website on Memory Optimization3, one suggestion is to compile Redis in 32-bit mode instead of using the default 64 bit instance.

Using a 32-bit Redis instances for datasets under 3 GB is smaller than the same dataset in the 64-bit version of Redis. This can be illustrated in the following tests. We'll launch two Redis instances, INSTANCE64 and INSTANCE32. We'll create a quick Python function, test_redis_32k_65k, in a Python command line to create 100,000 keys using a UUID as a string value:

>>>def test_redis_32k_64k():
  for i in range(100000):
    key = "uuid:{}".format(i)
    value = uuid.uuid4()
    INSTANCE32.set(key, value)
    INSTANCE64.set(key, value)
>>> test_redis_32k_64k()

To see what happens to the memory usage of 32-bit verses 64-bit type of Redis instances, we'll compare the output of two Redis-cli sessions by connecting to each instance.

For the Redis 32-bit instance:> INFO memory