Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamodb vs Redis

We're using AWS, and considering to use DynamoDB or Redis on our new service.
Below is our service's character

  1. Insert/Delete occur over between hundreds and thousands per minute, and will be larger later.
  2. We don't need quick search, only need to find a value with key
  3. Data should not be lost.
  4. There are another data that doesn't have a lot of Insert/Delete unlike 1.

I'm worried about when Redis server down.
When the Redis failure, our data will be removed.

That's why I'm considering to select Amazon DynamoDB.
Because DynamoDB is NoSQL, so Insert/Delete is so fast(slower than Redis, but we don't need to that much speed), and store data permanently.

But I'm not sure that my thinking is right or not.

If I'm thinking wrong or don't think another important point, I'm going appreciate when you guys teach me.

Thanks.

like image 511
JoonT Avatar asked Jul 03 '19 12:07

JoonT


People also ask

Is Redis faster than DynamoDB?

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.

Is DynamoDB similar to Redis?

DynamoDB and Redis are fast, robust, and reliable NoSQL databases. They both use the key-value store as the primary database model, and DynamoDB also supports the document model. Redis offers secondary database models like the document store, graph DBMS, and spatial DBMS.

Is DynamoDB good for caching?

DynamoDB caching can significantly increase performance even if the number of requests exceeds millions of requests per second.

Is Elasticache faster than DynamoDB?

The main reason we use Elasticache rather than DynamoDB is the speed - you get sub 1ms round trip latency for small objects. The box is really close to your EC2 machine, and memory is that much faster than disk, even SSD.


1 Answers

There are two type of Redis deployment in AWS ElastiCache service:

  1. Standalone
  2. Multi-AZ cluster

With standalone installation it is possible to turn on persistence for a Redis instance, so service can recover data after reboot. But in some cases, like underlying hardware degradation, AWS can migrate Redis to another instance and lose persistent log.

In Multi-AZ cluster installation it is not possible to enable persistence, only replication is occur. In case of failure it takes a time to promote replica to master state. Another way is to use master and slave endpoints in the application directly, which is complicated. In case of failure which cause a restart both Redis node at time it is possible to lose all data of the cluster configuration too.

So, in general, Redis doesn't provide high durability of the data, while gives you very good performance.

DynamoDB is highly available and durable storage of you data. Internally it replicates data into several availability zones, so it is highly available by default. It is also fully managed AWS service, so you don't need to care about Clusters, Nodes, Monitoring ... etc, which is considering as a right cloud way.

Dynamo DB is charging by R/W operation (on-demand or reserved capacity model) and amount of stored data. In may be really cheap for testing of the service, but much more expensive under the heavy load. You should carefully analyze you workload and calculate total service costs.

As for performance: DynamoDB is a SSD Database comparing to Redis in-memory store, but it is possible to use DAX - in-memory cache read replica for DynamoDB as accelerator on heavy load. So you won't be strictly limited with the DynamoDB performance.

Here is the link to DynamoDB pricing calculator which one of the most complicated part of service usage: https://aws.amazon.com/dynamodb/pricing/

like image 193
Roman Shishkin Avatar answered Oct 22 '22 13:10

Roman Shishkin