使用DynamoDB或Redis在我们的服务中。

huangapple go评论85阅读模式
英文:

To use DynamoDB or Redis on our service

问题

我正在实现一个新的服务,计划使用Redis或DynamoDB,但不确定选择哪个。

工作流程大致如下:

  1. 从前端获取数据,将其存储在数据库中。
  2. 如果前端发送了一个以上的请求,则转发存储在数据库中的数据,然后稍后将其删除。
  3. 否则,如果前端没有发送额外的请求,我们可以删除存储的数据。
英文:

I am implementing a new service wherein I am planning to use Redis or DynamoDB but not sure which one to pick.
The working would be something like:

  1. Get data from front-end store it in DB.
  2. If the front end sends one more request, then forward the data stored in the database and delete it later.
  3. Else, if the front end does not send one more request we can delete the data stored.

答案1

得分: 0

Redis或DynamoDB

这两个是不同的服务 - Redis是一个开源的内存中键值数据存储,可用作数据库、缓存、消息代理和队列。它是一个内存缓存服务,可用于提高数据库操作的性能,而DynamoDB是一个完全托管的NoSQL数据库服务。

所有Redis数据都驻留在内存中,与将数据存储在磁盘上的DynamoDB数据库相对应。DynamoDB是一个SSD数据库,而Redis是内存存储,但可以使用DAX - DynamoDB加速器,它是DynamoDB的内存缓存读取副本,可在读取密集型负载上充当加速器。

从前端获取数据并将其存储在数据库中。

如果您对基于No-SQL的数据库解决方案满意,可以使用DynamoDB。这是移动、Web、游戏、广告技术、物联网等需要在任何规模下进行低延迟数据访问的推荐数据库解决方案。

如果前端发送了一个以上的请求,然后转发存储在数据库中的数据,并在以后删除它。

DynamoDB可以自动扩展,具有两种操作模式:1. 预配置和2. 按需。

  1. 预配置 - 如果您选择预配置模式,您可以指定应用程序所需的每秒读取和写入次数。您可以使用自动缩放来根据流量变化自动调整表的预配置容量。

  2. 按需 - 这是一种灵活的计费选项,可以在不需要容量规划的情况下每秒提供数千个请求。

上述任一模式都可以用于您提到的用例。

如果前端不再发送请求,我们可以删除存储的数据。

有一个TTL(生存时间)属性 - 允许您定义每个项目的时间戳,以确定何时不再需要项目。在指定的时间戳的日期和时间之后不久,DynamoDB会从您的表中删除该项目,而不会消耗与DynamoDB表中的项相关联的写入吞吐量。

您可以利用它在一定时间后清除/删除存储的数据。

英文:

> Redis or DynamoDB

These 2 are different services - Redis is open-source, in-memory key-value data store for use as a database, cache, message broker, and queue.It is in-memory cache service that can be used to improve the performance of database operations whereas DynamoDB is fully managed NoSQL database service.

All Redis data resides in-memory, in contrast to DynamodDB databases that store data on disk. DynamoDB is a SSD Database comparing to Redis in-memory store, but it is possible to use DAX - DynamoDB accelerator which is in-memory cache read replica for DynamoDB as accelerator on read intensive load

> Get data from front-end store it in DB.

Use DynamoDB if you are fine with No-SQL based database solution. This is recommended database solution for mobile, web, gaming, ad tech, IoT, and other applications that need low-latency data access at any scale

> If the front end sends one more request, then forward the data stored
> in the database and delete it later.

DynamodDB can scale automatically with 2 operation modes 1. Provisioned and 2.On-demand

  1. Provisioned - If you choose provisioned mode, you specify the number of reads and writes per second that you require for your application. You can use auto scaling to adjust your table’s provisioned capacity automatically in response to traffic changes

  2. On-demand - This is a flexible billing option capable of serving thousands of requests per second without capacity planning.

Either of the above 2 can be used for your mentioned use case.

> if the front end does not send one more request we can delete the data
> stored.

There is a TTL (Time to live) property - which allows you to define a per-item timestamp to determine when an item is no longer needed. Shortly after the date and time of the specified timestamp, DynamoDB deletes the item from your table without consuming any write throughput- associated with Items in the DynamoDB table

You can make use of it to purge/delete the data stored after certain duration

huangapple
  • 本文由 发表于 2020年9月16日 17:11:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/63916817.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定