We all know Redis is a popular tool used across the world. Let me take you on a small trip of tips & facts in the midst of your hectic corporate schedule to tell you more about this ever-popular caching tool.
What is Redis?
By default, Redis is a cache which has been called upon as a database for use. It utilizes volatile memory and can provide users full-fledged options for persistency & support to additional data types.
15 Interesting Facts about Redis
- Persistence allows you to treat Redis as a legitimate database rather than an unstable and temporary cache. If you reboot a similar tool — ‘Memcached’ it loses its information. But Redis data stays intact and maintains entirety.
- Redis has database capabilities. Even when combined with caches’ advantages, it performs remarkably well. In fact, if we don’t want persistence, it can be turned off for solely using it to cache, temporarily.
- Redis displays much of its performance to the point that the data always resides in-memory. It fascinates developers with the its ability of its Read/Write operations to outpace the capabilities of regular databases.
- The release of Redis version 2.0 featured capability to diffuse data, utilizing the Subscribe/Publish messaging protocol aka the ‘pub-sub’ model.
- CPU performace seldom becomes a bottleneck with Redis, since Redis is either Memory or Network bound. However, should such a scenario come about, horizontal/vertical scaling can help overcome any CPU related bottlenecks.
- Many industry leading companies you might have heard of use Redis. Some of these include: Twitter, Pinterest, and Github who has been an early adopter of the Redis project, like us at DLT Labs.
- Unlike traditional DBs like MongoDB, Redis allows transactions.
- Redis Persistence and RDB
Point-In-Time snapshots your dataset at specified intervals (Data backup) in AOF fashion, logging every write operation received by the server.
The result? Greater durability!
- Redis’ policy of snapshot / Redis background saving process is forked only when the server has no following execution for the command(s), thus guaranteeing any command that is reported as atomic in RAM is also atomic from a disk snapshot point of view.
- If you prefer using Java, ‘Jedis’ can be used which is a java client. Use this to connect your Java application with Redis.
Please note: A single Jedis instance is not threadsafe! Hence to dodge these problems, ‘JedisPool’ is the option, which is a threadsafe pool of network connections with a default max connection pool size of 8.
- Redis stores data as key-value pairs, where certain types of data structures act as a key. Additionally, it allows objects’ cap their key and value at 512 Megabytes. This system of hashing keys, that is used in storing key-value pairs is known as Redis hash.
- Redis can handle up to 2³² keys and be tested in practice to handle a minimum of 250 million keys per instance. In other words, the limit to using Redis is likely the available memory in your machine/infrastructure.
- Every possible data structure for Redis can hold 2³² elements i.e. hash, list, set, and sorted sets can hit the peak with 2³² elements.
- Nonetheless, Redis is by far the second easiest thing to set up, well don’t ask what’s the first one!
A Bonus Tip About Redis
To make Linux perform using a more efficient allocation manner (this is ideally what you want for Redis): Set overcommit_memory to 1.
Thanks for reading!
If you are unfamiliar with the topic of caching with Redis, you can read more about it here:
The art of caching, with Redis
We recently selected Redis to handle data on our servers. We share some basic keys commands and give an introduction…
DLT Labs on medium.com
Author — Aman Gupta, DLT Labs™
About the Author: Aman is part of the core DevOps & Infrastructure team at DLT Labs and is skilled in AWS, C++, DS-A, and open-source tools. He loves playing Badminton and enjoys e-gaming.