避免油门dynamoDB油门、dynamoDB

2023-09-11 11:37:29 作者:鱼爱海的蓝却不知天的湛。

我是新来的云计算,但有一个问题,如果一个机制,就是我将要描述的存在或可能创造?

I am new to cloud computing, but had a question if a mechanism as what I am about to describe exists or is possible to create?

Dynamodb已置备吞吐量(例如100写入/秒)。当然,在现实世界中的应用现实生活中的吞吐量是非常动态的,几乎不可能出现100写入您的供应量/秒。我想这将是巨大的将是某种类型的队列中的dynamodb。例如,在高峰时段我dynamodb可以接收每秒500次的写入请求(5次我所分配),并会返回错误。是不是有一些排队我可以把客户端和数据库之间,所以客户端请求进入队列,该客户端会承认他们的请求已经被处理了,那么队列吐出来的请求dynamodb以100的速度每秒/写完全,这样一来,没有错误返回,我也不需要提高的物料通过这将提高成本?

Dynamodb has provisioned throughput (eg. 100 writes/second). Of course, in real world application real life throughput is very dynamic and will almost never be your provisioned amount of 100 writes/second. I was thinking what would be great would be some type of queue for dynamodb. For example, my dynamodb during peak hours may receive 500 write requests per second (5 times what I have allocated) and would return errors. Is it there some queue I can put in between the client and database, so the client requests go to the queue, the client gets acknowledged their request has been dealt with, then the queue spits out the request to the dynamodb at a rate of 100/ writes per second exactly, so that way there are no error returned and I don't need to raise the through put which will raise my costs?

推荐答案

把AWS SQS是DynamoDB前会解决这个问题对你来说,是不是一种罕见的设计模式。 SQS已经是非常适合,因为它需要规模大,并摄取了大量与联合国predictable流动模式的消息。

Putting AWS SQS is front of DynamoDB would solve this problem for you, and is not an uncommon design pattern. SQS is already well suited to scale as big as it needs to, and ingest a large amount of messages with unpredictable flow patterns.

您既可以把所有的消息到SQS第一,或者使用SQS为溢出的缓冲区,当你超过你的DynamoDB数据库设计thoughput。

You could either put all the messages into SQS first, or use SQS as an overflow buffer when you exceed the design thoughput on your DynamoDB database.

一个或多个工作实例可以比从SQS队列中读取消息,并把它们放到DynamoDB的正是你决定的步伐。

One or more worker instances can than read messages from the SQS queue and put them into DynamoDB at exactly the the pace you decide.

如果进来的消息的顺序是非常重要的,室壁运动是另一种选择,为您摄取传入的消息,然后将其插入到DynamoDB,在他们到达相同的顺序,在您定义的速度。

If the order of the messages coming in is extremely important, Kinesis is another option for you to ingest the incoming messages and then insert them into DynamoDB, in the same order they arrived, at a pace you define.

IMO,SQS会更容易的工作,但Kineses会给你更多的灵活性,如果你的需求更加复杂。

IMO, SQS will be easier to work with, but Kineses will give you more flexibility if your needs are more complicated.