Use Connection: keep-alive to improve application performance · Issue #2571 · aws/aws-sdk-js (original) (raw)

By default, NodeJS sets Connection: close and not Connection: keep-alive HTTP header which results in sub-optimal performance. Instead of reusing an already established connection between the client and the service, a new one has to be created for every operation.

It has been reported before (#146), recently publicized by an AWS Serverless Hero and it's also recommended by AWS for DynamoDB when using encryption at rest. DynamoDB itself responds with a Connection: keep-alive header.

Even though all these examples pertain to DynamoDB, I imagine other services will benefit from this change as well. For what it's worth, boto3, the official AWS SDK for Python does not explicitly set a Connection: close header.

Please consider setting keep-alive header the on the SDK level so that going forward, the whole community can benefit from this improvement.