DEV Community

Cover image for Say No to SQL 🙅
Kunal Agrawal
Kunal Agrawal

Posted on

Say No to SQL 🙅

Attention Developers!

Are you facing these problems with the current application architecture?

  • High Throughput to the SQL database.
  • Bottleneck in the SQL database.

Image description

An In-memory data store will be the solution to the problem. Redis is the most popular option available in the market for In-memory data storage, and cache. Redis has a wide ecosystem because major tech giants adopt it, it's an open-source project developed by Salvatore Sanfilippo. Redis stands for Remote Dictionary Server.

In layman's terms, consider Redis an index page in the textbook.
Here key-value pairs are stored. Where value can be in different data structures like sorted sets, lists, stacks, strings, and integers.
The limitation of this In-Memory data store is, that it comes with a significant increase in costs. The solution is to use a memory hierarchy according to the application requirements.

FYI: Even your device uses a Memory Hierarchy to provide the best storage organization corresponding to its value.

Memory Hierarchy

Image description

Memory Hierarchy is the design to organize computer memory components according to their response time. It includes the use of several memory components like Cache, RAM, ROM, and SSD/HDD.

Why to use In-Memory data store?

Ques - Why should we use something like Redis, where we can simply store the value in a Map data structure with the key corresponding to it, and serve the concurrent requests with it?

  • Scaling

    Yes, It will work with Monolith architecture. However, it is required to vertically scale up the system by adding more resources like RAM and CPUs. But by using Redis we can horizontally scale up the infrastructure by adding more Redis servers to the cluster.

  • ACID Compliance

    Redis supports partial ACID compliance because it's single-threaded which guarantees consistency and isolation. The use of system memory will heavily increase CPU usage and RAM consumption which slows the application process. Also, redis supports the expiration of keys, regarding time or use of the record. so it automatically deletes the record when no longer in use.

  • Community Support

    Redis is an open-source project with services like Pub-Sub, Data Streams, Vector Search, etc. Where each of the services is backed by the most optimized algorithms and data structures available to the market.

  • Concurrent Request

Image description
Redis uses single-threaded event-driven architecture, also the response time for Redis is 1000 times faster compared to SQL databases when 100 users read the database. Also by using event-driven architecture, it can handle high throughput with ease.

Is Redis a replacement for SQL Databases?

  • Consider Redis as a plugin for your database infrastructure, which makes your application blazingly fast.

That's it for this article, I hope you learn something useful. Share your thoughts on this article on socials.

Let's Connect -
Tweet Thanks
https://linktr.ee/kunal.dev

Top comments (0)