Redis Compass (Introduction To Redis) — Part 1

Redis

Redis is an in-memory datastore that is potentially 10x faster than disk databases such as your normal RDBMS when performing operations such as updates.  It is built on a of a key-value mapping system model.

What makes Redis Different From Your Normal RDBMS Like Mysql

Now you may be wondering, “what makes redis different from rdbms like mysql?”, “is redis better than Mysql?”, “when exactly do you use redis instead of an rdbms like mysql?”.  I’ll try to break it down:

First of all, the striking difference between redis and an rdbms like mysql is:  mysql follows the ACID principle and uses a disk storage mechanism, in the sense that all data is not held in memory while redis though it has options to write to disk uses in-memory and does not follow the ACID principle.

Is Redis better than Mysql

Short answer, No none is better than the other, they have various use cases where one will reasonably outperform the other but they are not competitors, meaning Redis does not completely replace Mysql and vice-versa.

When exactly do you use redis instead of an rdbms like mysql

When dealing with unstructured data, things like graphs, likes in social networks, data from iot sensors  e.t.c  at massive scale redis outshines mysql.  So if you are working on a project where data consistency is not a top priority and there are a lot of unstructured data then redis would truly be the best to use.

Take for example you are working an banking software, in such cases data consistency is top priority and most of the data aggregated is structured, it makes more sense to use an rdbms like mysql, but say you are building a platform like facebook or twitter and you want to monitor data like number of shares, likes, tweets e.t.c that is not inherently a top priority for data consistency and is highly unstructured, redis makes more sense to be used in these case.

In most cases, in medium to large scale applications, you will definitely be using a combination of the two.

 

In the next post we will go even deeper into redis.

Got any questions? hit me a comment.

3 comments on “Redis Compass (Introduction To Redis) — Part 1

  1. First of all, thanks to author for the excellent post and to everyone have commented it.
    However, would like to remark a few things. First of all, Redis is a (the Cache) , has been planned and used for this role, so comparison is correct neither to RDBMS, nor to a NoSQL Database and cannot replace them at all. And not only because of is not ACID compliant. Redis has its effect of fast access( in memory!!) data storage because a record has expiration time. And as small as good. Key based principle is second one. So, ideologically it cannot replace any permanent data storage. Redis also, and fortunately, has built in messaging, which notify also about data events, This is extremely important in Reactive architecture and design.
    More correct comparison is with other caches (as EhCache) and Data Grids (as Hazlecast). While Redis is absolutely winning in front of EhCache, it has not many very useful abilities as are in Hazecast. As instance I am about shared Collection, Locks , convenient and clear(unlike in Redis) subscription for data events in a collection, those are more helpful in realization of distributed and reactive architecture. At the same time Redis in easy more in cluster and has more wide ecosystem
    https://odoepner.files.wordpress.com/2015/04/mastering_hazelcast1.pdf
    https://hazelcast.com/use-cases/nosql/redis-replacement/
    https://hazelcast.com/resources/benchmark-redis-vs-hazelcast/

  2. Quite correct but redis gives you the option to persist data (RDB) through point in time snapshots. I had never heard of hazelcast before, it’s a really interesting technology, thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *