R
R
Roman Mirilaczvili2021-06-26 13:14:50
Amazon Web Services
Roman Mirilaczvili, 2021-06-26 13:14:50

What are the mechanisms for limiting writes according to the IOPS ceiling?

Getting familiar with the AWS Cloud Computing Infrastructure and in particular building scalable, high-load applications using FaaS.
At one of the interviews, the task was given to develop the architecture of a certain service for registering metrics received from a variety of IoT devices and writing them to a certain database for subsequent analytics.

It is advisable not to use specialized AWS services such as MSK (Kafka) and others for working with IoT in order to be able to easily migrate to other cloud providers.

I assembled the following scheme:
API Gateway -> Lambda -> SQS -> Lambda -> DB.

In my scheme, one of the problems is opening and closing the connection to the database. This can be solved by using a shared connection pool. True, I don’t know how a common pool is made for all lambda functions.

Another problem is related to the fact that the DBMS does not collapse under the onslaught of write requests (even taking into account the write in batch) due to IOPS restrictions. Therefore, I just see that you can somehow try to regulate the receipt of messages from the SQS queue.

Are there any common practices for throttling traffic received from queues so as not to exceed the IOPS threshold when writing to the DBMS?
Suppose I empirically determine that with 1000 lambda functions, the DBMS can withstand a load of 5k IOPS.
Using the rate limit mechanism in the lambda function, checking whether the threshold is exceeded - will be expensive due to the potential downtime of the function.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2021-06-26
@inoise

In a serverless world, healthy people do not use traditional databases. We take DynamoDB. You can also read about their TimeStream.
RateLimit/Throttling is configured on the apigateway itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question