awslabs / route53-dynamic-dns-with-lambda

A Dynamic DNS system built with API Gateway, Lambda & Route 53.
Apache License 2.0
491 stars 167 forks source link

To low timeout on Lambda #56

Closed nsandstrom closed 5 months ago

nsandstrom commented 5 months ago

Lambda was created with a timeout of 3 seconds, causing every request to fail with a 502 status.

image

e94af20e-24ef-4a6e-8d4b-db09a9a705b0 Task timed out after 3.02 seconds

After manualy increasing timeout to 10 seconds, requests were all successful, finishing in just under 4 seconds

22f4200d-856a-41b5-9276-29d48412c78f Duration: 3757.18 ms Billed Duration: 3758 ms Memory Size: 128 MB Max Memory Used: 81 MB

exenza commented 5 months ago

thanks for reporting this, can you please let me know which region you deployed? I will try to replicate this and validate how long it takes to update records.

Do you see the execution time to be 4 seconds even when the route53 record is already up to date and the function only does a DB lookup?

nsandstrom commented 5 months ago

Deployed in Stockholm (eu-north-1)

It seems that only the update requires more time.

When it is up to date, it finishes at about 1500 ms

Attaching logs for 5 consecutive requests, where the first did an update.


timestamp message
1717500984239 INIT_START Runtime Version: python:3.12.v27 Runtime Version ARN: arn:aws:lambda:eu-north-1::runtime:7c92be91a90fbbf7e87397de7cd50893f5371d303c6fb1df81304d0ae9f60b5b
1717500984478 START RequestId: b1fce7d6-797d-4ae5-bbf5-9a6680434be0 Version: $LATEST
1717500984480 END RequestId: b1fce7d6-797d-4ae5-bbf5-9a6680434be0
1717500984480 REPORT RequestId: b1fce7d6-797d-4ae5-bbf5-9a6680434be0 Duration: 1.76 ms Billed Duration: 2 ms Memory Size: 128 MB Max Memory Used: 63 MB Init Duration: 238.90 ms
1717500984573 START RequestId: 3146a383-097e-469a-862e-623ae79b8625 Version: $LATEST
1717500988506 END RequestId: 3146a383-097e-469a-862e-623ae79b8625
1717500988506 REPORT RequestId: 3146a383-097e-469a-862e-623ae79b8625 Duration: 3932.78 ms Billed Duration: 3933 ms Memory Size: 128 MB Max Memory Used: 81 MB
1717500993292 START RequestId: 6de4a7e5-1b9d-46a1-b25f-8479562ad884 Version: $LATEST
1717500993293 END RequestId: 6de4a7e5-1b9d-46a1-b25f-8479562ad884
1717500993293 REPORT RequestId: 6de4a7e5-1b9d-46a1-b25f-8479562ad884 Duration: 1.52 ms Billed Duration: 2 ms Memory Size: 128 MB Max Memory Used: 81 MB
1717500993397 START RequestId: 2604fee2-a520-43cc-b8bb-1625a7bb4e5a Version: $LATEST
1717500994786 END RequestId: 2604fee2-a520-43cc-b8bb-1625a7bb4e5a
1717500994786 REPORT RequestId: 2604fee2-a520-43cc-b8bb-1625a7bb4e5a Duration: 1389.37 ms Billed Duration: 1390 ms Memory Size: 128 MB Max Memory Used: 81 MB
1717501104875 START RequestId: da61af43-feb1-47e4-b479-88298d27a6cc Version: $LATEST
1717501104876 END RequestId: da61af43-feb1-47e4-b479-88298d27a6cc
1717501104876 REPORT RequestId: da61af43-feb1-47e4-b479-88298d27a6cc Duration: 1.69 ms Billed Duration: 2 ms Memory Size: 128 MB Max Memory Used: 81 MB
1717501104961 START RequestId: df087bf8-bd71-452c-ae8e-24feb5946a8f Version: $LATEST
1717501106348 END RequestId: df087bf8-bd71-452c-ae8e-24feb5946a8f
1717501106348 REPORT RequestId: df087bf8-bd71-452c-ae8e-24feb5946a8f Duration: 1387.07 ms Billed Duration: 1388 ms Memory Size: 128 MB Max Memory Used: 82 MB
1717501108320 START RequestId: 78cea753-3c8d-4355-adae-d25c67ca7363 Version: $LATEST
1717501108322 END RequestId: 78cea753-3c8d-4355-adae-d25c67ca7363
1717501108322 REPORT RequestId: 78cea753-3c8d-4355-adae-d25c67ca7363 Duration: 1.45 ms Billed Duration: 2 ms Memory Size: 128 MB Max Memory Used: 82 MB
1717501108388 START RequestId: c0b6800d-560b-4e52-b3b6-9ed07c0ebca5 Version: $LATEST
1717501109888 END RequestId: c0b6800d-560b-4e52-b3b6-9ed07c0ebca5
1717501109888 REPORT RequestId: c0b6800d-560b-4e52-b3b6-9ed07c0ebca5 Duration: 1499.82 ms Billed Duration: 1500 ms Memory Size: 128 MB Max Memory Used: 82 MB

masberta commented 5 months ago

Specified a 8 seconds timeout to accommodate Route53 latency

https://github.com/awslabs/route53-dynamic-dns-with-lambda/commit/5d0ae0368cbf66bb14f6aedd967b4f31f4861d87