HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Strategies to work around 30 sec timeout

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
aroundtimeoutsecworkstrategies

Problem

I received a timeout when trying to perform 7000 * 3 inserts into MariaDB in 30 seconds with AWS Python Lambda. I have three ideas how to get around the 30 second API Gateway timeout:

-
Convert the data to a file which MariaDB can import using LOAD_DATA_INFILE and let the Lambda do that.

-
Write the data in a file to S3 and let another function write the data from S3 to MariaDB which then will not have the API Gateway timeout limit.

-
Let the web client convert the file in JavaScript.

I am leaning towards the first strategy, to try and use LOAD_DATA_INFILE from the Lambda function. Do you agree?

Solution

A variation of method 2 is infinitely scalable:

  • write the data to s3.



  • from s3 trigger lambda to break s3 file into sqs queue events of good size



  • from sqs queue trigger lambdas to insert



  • sqs can be fifo queue if it matters.

Context

StackExchange DevOps Q#5678, answer score: 2

Revisions (0)

No revisions yet.