- Newest
- Most votes
- Most comments
There is a couple of things at play here when you state that you are not seeing the expected latency:
- DynamoDB offers server-side latency in the single-digit milliseconds (measured for the full round trip).
- The single-digit millisecond latency is applicable mainly to singleton operations (such as GetItem), which is acceptable.
- This low latency can be attained when there is consistent traffic on the table since DynamoDB extensively utilizes internal metadata caching to minimize response times.
- In order to achieve this level of latency, it is essential to establish your connection outside of the request handler and enable TCP Keep-alive to allow the reuse of connections.
In summary, you measure timings for Lambda init and also the for the full round trip to DynamoDB, which includes connection establishment times etc.. You are also likely making infrequent requests which do not utilize the internal caching to reduce response timings. To measure DynamoDB's timings, its best to use SuccessfulRequestLatency metric on CloudWatch.
Hi Mitchell, you use async programming with await. So, you may also here include the time for your promise to complete as you measure it with your current logs. So, can you add an intermediate log after statement item = data.Item
to see if duration of request itself is better?
Best, Didier
Relevant content
- Accepted Answerasked 5 months ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago
Try also increasing the function's memory. The more memory you set, the more CPU your functions get.