WHAT IS REDIS?
Redis stands for Remote Dictionary Server. When we say that Redis is a database, that’s only a part of the truth. Redis is a very fast non-relational database that stores a mapping of keys to five different types of values.Redis supports such abstract data structures, as strings, lists, maps, sets, sorted sets, HyperLogLogs, bitmaps, streams, and spatial indices.
Also it boasts in-memory persistent storage on disk, replication to scale read performance, and client-side sharding to scale write performance. Sounds like a mouthful? Let's get back to basics!
RELATIONAL VS NON-RELATIONAL DATABASES
Imagine your data is a cat. In front of it, you put an Excel sheet and a Word doc. Which one will your cat go to?
This may sound a bit childish – but it’s a nice way to realize what kind of data works best for the two main types of databases. Let’s look at the difference between relational and non-relational databases – this is what every business should do before choosing a database.
Relational Databases
So, imagine your “data cat” prefers the Excel sheet. Why? Because it fits nicely into rows and columns.
A relational database is one that stores data in tables. The relationship between each data point is clear and searching through those relationships is relatively easy. The relationship between tables and field types is called a schema.
Examples of Relational/SQL Databases: SQL Server, MySQL, PostgreSQL.
Non-Relational Databases
Back to your “data cat.” Suddenly it came to the Word doc. Why? Because of its blank open space! The data enters in all shapes and sizes – and it needs some room to fit in.
A non-relational database is any database that does not use the tabular schema of rows and columns like in relational databases. Non-relational databases are gaining popularity as more and more businesses start to use big data for analysis and reporting.
Examples of Non-Relational/NoSQL Databases: MongoDB, Redis.
REDIS COMPARED TO OTHER DATABASES AND SOFTWARE
Redis is a type of database that’s commonly referred to as No SQL or non-relational. In Redis, there are no tables, and there’s no database-defined way of data relating.
It’s not uncommon to hear Redis compared to memcached, which is a very high-performance, key-value cache server. Like memcached, Redis can also store a mapping of keys to values and can even achieve similar performance levels as memcached. But the similarities end quickly — Redis supports the writing of its data to disk automatically in two different ways, and can store data in four structures in addition to plain string keys as memcached does.
Generally speaking, many Redis users will choose to store data in Redis only when the performance or functionality of Redis is necessary, using other relational or non-relational data storage for data where slower performance is acceptable, or where data is too large to fit in memory economically. Let’s look at some of your options.
REDIS VS MongoDB VS MS SQL Server
1. Redis:
Redis was developed by Redis labs and initially released on May 10, 2009. It is written in ANSI and C languages. Redis offers memory efficiency, fast operating speed, high availability and provides some features like tunability, replication, clustering, etc.
2. MongoDB:
MongoDB is a cross-platform document-oriented and a non relational (i.e. NoSQL) database program. It is an open-source document database storing the data in the form of key-value pairs. MongoDB is developed by MongoDB Inc. and initially released on 11 February 2009. It is written in C++, Go, JavaScript, Python languages. MongoDB offers high speed, high availability, and high scalability.
3. MS SQL Server:
Microsoft SQL Server is a relational database management system (RDBMS) which is platform dependent and it is both GUI and command based software. It supports a wide variety of transaction processing, business intelligence and analytics applications in corporate IT environments. It was developed by Microsoft Corporation and initially released on April 24, 1989. It is written in C and C++ languages.
SO, WHY REDIS?
By using Redis instead of a relational or other primarily on-disk database, you can avoid writing unnecessary temporary data, avoid needing to scan over and delete this temporary data, and ultimately improve performance.
With some training and some clean working code you’ll be able to remove bottlenecks, simplify your code, collect data, distribute data, build utilities, and, overall, to make your task of building software easier. When done right, you can scale your software to levels that would make other users of so-called web-scale technologies blush.
Large companies such as Twitter, GitHub, and Weibo are using Redis. Amazon Web Services offers a managed Redis service called Elasticache for Redis, Microsoft offers Azure Cache for Redis in Azure, and Alibaba is offering ApsaraDB for Redis in Alibaba Cloud.
It was voted most loved database in the Stack Overflow Developer Survey in 2017, 2018, 2019, 2020 and 2021.