Skip to content

Redis: In-Memory Data Store easily explained!

  • Data

Redis is a key-value-based NoSQL database that stores data in memory, i.e. in RAM. This data store is one of the most frequently used key-value databases today and is used for caching, for example. The abbreviation stands for Remote Dictionary Server.

What are NoSQL Databases?

NoSQL (“Not Only SQL”) describes databases that, unlike SQL, are non-relational, i.e. cannot be organized in tables, among other things. These approaches can also be distributed across different computer systems and are therefore highly scalable. NoSQL solutions are very suitable for many Big Data applications.

The databases are characterized by two criteria in particular, which are very broad. Firstly, data is not stored in tables and secondly, the query language is not SQL, which is also made clear by the name Not Only SQL.

Redis belongs to the so-called key-value stores, which are a category within NoSQL databases. They are a very simple data structure in which each record is stored as a value with a unique key. Using this key, the information can be retrieved specifically.

Das Bild zeigt die vier Kategorien von NoSQL Datenbanken, also Document Stores, Key-Value Stores, Wide Column Stores und Graphdatenbanken.
NoSQL Database Categories

How does Redis work?

Redis was developed to have a reliable data store that can store and also output information in a short time. The special feature of this database is the combination of the already mentioned key-value store and the in-memory storage.

An in-memory database stores data on the computer’s random access memory (RAM) instead of writing it to a hard disk, such as an HDD or SSD. This speeds up the process of writing and reading many times over, but comes at the expense of data security and cost. RAM is usually more expensive than comparable hard disk storage and is completely erased when the machine shuts down or the system crashes.

Each entry in this memory is assigned a unique key that can be used to access the data record. Since the working memory of computers is usually a limited resource, it must be used carefully. This also includes the use of special data structures that consume as little memory as possible.

In most cases, strings are used and stored as data structures. In addition, there are other data types that Redis can process (cf. IONOS (2020)):

  • Strings: Strings with a maximum memory size of 512 MB.
  • Hashes: Mapping between a hash representation and an associated string.
  • Lists: A collection of strings that are stored in a list.
  • Bitmaps: Compact representation for boolean values.
  • Streams: A type of log file developed specifically for Redis.

For which Applications is Redis used?

Although the use cases of Redis are very limited, they are hard to displace in this area due to their advantageous properties. As mentioned earlier, Redis is primarily used for caching, such as on Twitter. Caching is generally understood to mean saving intermediate states so that future queries can run faster. In the case of Twitter, for example, this could mean that profile pictures or tweets that have already been loaded are kept in the cache so that they are available more quickly when they are queried again.

These functionalities are especially advantageous in chats or messaging services, as the new messages can be sent to the user almost in real-time.

What are the Advantages of Redis?

NoSQL databases have several advantages over traditional, relational databases. These include a better performance with large data volumes and distribution across multiple systems. Redis can also score with the following advantages:

  • Fast accessibility through in-memory memory
  • Support for most common programming languages
  • With the help of various tools, Redis offers a high level of user-friendliness
  • Data can also be distributed across multiple clusters and held in memory on other computers
  • Open-source

What are the Disadvantages of using Redis?

As with most databases, the use of Redis has some disadvantages that must be weighed before implementing it. Besides the risk of data loss in the event of a system crash, the following points also play a role:

  • Main memory is an expensive hardware component
  • Data can only be accessed via keys
  • More complex data sets can only be mapped with difficulty

This is what you should take with you

  • Redis is key-value storage that stores data in memory.
  • The fast write and read processes make the database well suited for caching applications or when storing chat messages.

Other Articles on the Topic of Redis

close
Das Logo zeigt einen weißen Hintergrund den Namen "Data Basecamp" mit blauer Schrift. Im rechten unteren Eck wird eine Bergsilhouette in Blau gezeigt.

Don't miss new articles!

We do not send spam! Read everything in our Privacy Policy.

Cookie Consent with Real Cookie Banner