Optimze DynamoDB operations by enabling HTTP keep-alive

August 25, 2020

Instruct the Node.js AWS SDK to reuse client connections to avoid the overhead of creating new TCP connections:

  name: aws
  runtime: nodejs12.x

Now, with above environment variable set - and while the Lambda function remains “warm” - outgoing HTTP connections can be reused and that will speed up e.g. DynamoDB DocumentClient operations.

I’ve set up a quick test myself doing both put and get operations and I can confirm the performance gains that Yan writes about in more detail. The time spent executing those database operations is down to approximately 1/3.


Søren Andersen

Digital garden of Søren Andersen.
Posts on tech that I use and learn.