Redis vs DynamoDB (a comparison)

Paul Namuag


What is Redis?

Redis (which means Remote Dictionary Serve) is an open-source NoSQL database known to be a fast, in-memory key-value data store, cache, message broker, and queue. The project started by Salvatore ‘antirez’ Sanfilippo, the original developer of Redis. He was trying to improve the scalability of his Italian startup developing a real-time web log analyzer. After encountering significant problems in scaling some types of workloads using traditional database systems, he began to prototype a first proof of concept version of Redis. Github and Instagram are among the first companies adopting this technology. So it’s no surprise that this has been adopted and patronized not just by big companies but also small ones and developers themselves.

Redis has been written in the ANSI C language and it works in most of the POSIX systems such as BSD, Linux, OS X without having any external dependencies. OS X and Linux are considered being the two operating systems where Redis has been developed and tested the most whereas Linux has been used for deploying the same. Redis might operate in Solaris-derived systems such as SmartOS, but the support is the best effort. Unfortunately, there is no official support that is provided for the Windows builds, but Microsoft has developed and maintained a Win-64 port for Redis. In 2019, Redis celebrated its 10th anniversary.

Redis now delivers sub-millisecond response times enabling millions of requests per second for real-time applications in Gaming, IoT, Social Networking, Financial Services, Healthcare Industry, and Ad Tech. Redis is a popular choice for caching, session management, gaming, leaderboards, real-time analytics, geospatial, ride-hailing, chat/messaging, media streaming, and pub/sub apps.

It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. It has LRU eviction, Lua scripting, built-in replication, transactions as well as different stages of on-disk persistence. It has built-in support for high-availability solutions through Redis Sentinel or by leveraging Redis Cluster with automatic partitioning.

Common use cases by experienced users of Redis can be applied in tasks such as running a number of operations like incrementing a hash value, appending to a string, computing set intersection, union and difference, pushing an element to a list, or collecting the member with the greatest ranking in a sorted set. Redis manages these types of tasks to an optimal level which can result in outstanding performance. This is because Redis operates with a built in-memory dataset.

Based on the use case, one can persist the same either by dumping a dataset to the disk once in a while or by attaching each of the commands to a log. Persistence can be easily disabled if one needs a networked, feature-rich, in-memory cache.

Just like with other mainstream databases, Redis also supports the master-slave asynchronous replication, alongside a very fast non-blocking synchronization, auto-reconnection with a partial resynchronization when the link between the master and the replica breaks, such as network issues or timeout connection. If a partial resynchronization is sense, the replica reconnects and attempts to proceed with a partial resynchronization: it means that it will try to just obtain the part of the stream of commands it missed during the disconnection.

What is DynamoDB?

Amazon DynamoDB is a fully managed NoSQL database service and one of the most powerful databases to use. It has its own advantages and disadvantages just like other NoSQL databases as well. It is offered as part of the Amazon Web Services (AWS) cloud service platform. It provides quick and predictable performance with scalability. The Amazon DynamoDB  is a key-value and document database that delivers single-digit millisecond performance at any scale. It’s a fully managed, multi-region, multi-active, durable database with built-in security, backup and restore, and in-memory caching for internet-scale applications. DynamoDB can handle more than 10 trillion requests per day and can support peaks of more than 20 million requests per second.

Many of the world’s fastest growing businesses such as Lyft, Airbnb, and Redfin as well as enterprises such as Samsung, Toyota, and Capital One depend on the scale and performance of DynamoDB to support their mission-critical workloads.

Hundreds of thousands of AWS customers have chosen DynamoDB as their key-value and document database for mobile, web, gaming, ad tech, IoT, and other applications that need low-latency data access at any scale. Create a new table for your application and let DynamoDB handle the rest.

Although DynamoDB holds primarily its strength for persistent storage to manage world’s largest scale applications by providing consistent, single-digit millisecond response times at any scale. On the other hand, Amazon DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for Amazon DynamoDB that delivers up to a 10 times performance improvement—from milliseconds to microseconds—even at millions of requests per second. This database is comparable with Redis for faster data caching solution.

DAX solidifies its ability to manage heavy lifting required to add in-memory acceleration to your DynamoDB tables, without requiring developers to manage cache invalidation, data population, or cluster management. This allows you to focus on the application side and minimize the DBA or Ops daily routine tasks without worrying about performance at scale. You do not need to modify application logic because DAX is compatible with existing DynamoDB API calls. You can enable DAX with just a few clicks in the AWS Management Console or by using the AWS SDK. Just as with DynamoDB, you only pay for the capacity you provision.

Pros of Redis

Redis is not perfect after all but it has quite pros and especially where it is more applicable for and when it is to be applicable or what are its use cases. In this section, we’ll enumerate its pros and where it is more applicable to be used.

  • Open Source License. Redis is open source software released under the terms of the three clause BSD license. This means that it is a free software and you are free to use it and deploy in whatever machine or cloud computing environment free of charge.

  • Caching. Redis is known for its ease of configuration and can act automatically as a cache and use LRU or LFU algorithms depending on your desired setup, similar to memcache database.  If your primary requirement is caching, then Redis fits your requirements very well. Redis works faster than other caching solutions.  

  • Rich data structures. Redis offers five possible data options for the values. These are hashes, lists, sets, strings, and sorted sets. The operations which are unique to these data types are given and come along with the well-documented time-complexity (The Big O notation).  

  • Data Persistence. Redis offers persistence, which further enhances its reputation as a caching solution. Redis typically holds the whole dataset in memory. For persistence, Redis supports point-in-time backups (copying the Redis data set to disk). Redis supports RDB, AOF persistence mechanism to persist the data to the non-volatile memory. 

  • Scalability. Redis supports automatic sharding whilst it’s also easy to set up a Primary-Replica with a Sentinel on top and scale either reads or writes. You can scale a Redis database easily without downtime or performance degradation. 

  • Flexibility. Due to rich data structures, you can store anything you like. Likely, for key-value strings, you can store as much as you want so long as the size does not exceed 512MiB. It’s also able to store binary safe data so you can store images in your Redis cache.

  • Ease of use. Redis has tools that help you easily set up based on your needs. Programmers can also learn this quite easily.

  • Community Support. You can get community support. Redis Labs offers premium support for the paid plans.

Pros of DynamoDB

DynamoDB intensifies its strength with  Amazon DynamoDB Accelerator (DAX) which works just like Redis, but with an in-memory cache for DynamoDB. Primarily, DynamoDB can be comparable with MongoDB which both are sufficiently performant for persistent NoSQL database storage. DAX is API compatible with DynamoDB.  If you’re currently using DynamoDB or considering DynamoDB, DAX can offer you response times in microseconds and millions of requests per second. With all these sweet spots of DynamoDB, let’s enumerate the pros or advantages of DynamoDB.

  • It’s one of the AWS Fully Managed Services. Simply, it is very advantageous if your environment is operating in the cloud and AWS is your main cloud provider or environment. It’s easier to manage your environment and less complex with a multi-tiered architecture that supports all your cloud services being consolidated into one public cloud provider.

  • Scalability. Since this is in AWS, users or database admins can easily utilize it to scale vertically or horizontally. If you need to store unlimited amounts of data, there’s no more to worry about downtime or no need to wait for your hardware resources to be ordered since it’s just a bunch of clicks and your desired resources will be there just in time you need it.

  • Distributed. DynamoDB scales horizontally by expanding a single table over multiple server

  • Cost Effective. One year free tier allows more than 40 million database operations/month and pricing is based on throughput (read/write per second) rather than storage

  • Automatic data replication. All data items are stored on Solid State Disks (SSDs) and automatically replicated across multiple availability zones in a region.

  • Security is finesse. DynamoDB uses proven methods to authenticate users and prevent unauthorized data access.

Cons of Redis

Redis is purely not a one-size-fits-all NoSQL database. There are its disadvantages which lead you to think first if it’s the right database you need. Let’s enumerate these as follows:

  • Due to memory limits, Redis can be costly or expensive when its setup or especially when scaling. Redis is an in-memory database, which means that the whole dataset should reside in the memory (RAM). This can be costly if you are planning to have large datasets.

  • You can’t implement “Role-Based-Account-Control” (RBAC) with Redis. In version Redis 6.0, access control lists (ACLs) have been incorporated but RBAC is only available when availing the Redis Enterprise 6.0.

  • Redis lacks in-built encryption.

  • Redis supports only basic security options which is a key for complying with government security compliance and data privacy protection regulations.

  • Redis has a few limitations vis-a-vis the “Master-Slave” model. It doesn’t have a smooth failover if a “Master” doesn’t have at least one “Slave”. There’s a limitation concerning sharding too. Redis assigns hash-slots to “Masters”, and it implements sharding based on that. If a “Master” holding a set of hash-slots goes down, then the data written on that slot will be lost. Although this has been addressed since Redis Cluster with the use of hash has been released, certain features are not available when Redis Cluster is deployed.

  • Redis isn’t intended for rich queries since it is a key-value database. There is no internal full-text search support and it is difficult to model relationships using Redis. Additionally, aggregate functions such as sum, average aren’t supported and need to be handled in the client side. Indexes aren’t supported internally and “sets” can be used as a workaround but maintaining them manually can be very complex. Range queries are also supported by manually maintaining some “sets”. Finally, Redis doesn’t support any query language (only commands are used) and there is no support for ad-hoc queries like in relational databases.

Cons of DynamoDB

Just as Redis has its imperfections, on the other hand, DynamoDB has them too. It’s not free and is only available if you avail the Amazon DynamoDB service in AWS. Now that’s just one of its factual cons. Here are some other disadvantages or cons:


  • Deployable only on AWS and cannot be installed on individual desktops/servers.

  • DAX is designed only to work with DynamoDB so you’ll end up choosing only DynamoDB for your persistent storage database.

  • Any database writes to DAX are a little slower than writing to DynamoDB directly.

  • DynamoDB’s DAX is not designed for write intensive applications. For write-intensive applications such as those that perform bulk data loading,  you might not want to write all of the data through DAX because only a small percentage of that data is ever read by the application. Better write to DynamoDB directly.

  • Querying data is extremely limited.

  • There’s no table joins as joins are impossible.

  • No Triggers.

  • No foreign keys concept to refer to other table items.

  • No server side scripts.

Which Shall You Choose?

If your environment relies mostly on AWS solutions and services and you have planned to use NoSQL such as DynamoDB, then using DAX is a good choice for your application as it provides a huge boost in terms of read and response time. Otherwise, Redis for caching is a perfect fit if you are using mainstream open source databases such as those databases that we support using ClusterControl. DynamoDB and DAX has been tested as well by large organizations but Redis has been also widely used by multiple companies and organizations either from small to medium and to large scale to high-traffic applications. You can use Redis on top of MySQL, PostgreSQL, or MongoDB.

Subscribe below to be notified of fresh posts