Description
Describe the issue
We recently updated from aws-sdk v2 to v3. We did normal testing, and everything was good. But once we pushed to production, with a production load, aws-sdk v3 started to give the error below:
WARN @smithy/node-http-handler:WARN - socket usage at capacity=50 and 766 additional requests are enqueued.
See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.
This should really be a documented change. I'm not sure what the difference is between v2 and v3, but I'd assume others are going to hit this problem.
I had to work with an AWS support engineer to resolve it, since the change isn't documented anywhere that I could find. See ticket #174544667100759.
In case other's come across this, I had to update my s3 and dynamodbdocumentclient to allow for more sockets. Default is 50. Keep alive should be enabled by default already
const s3 = new S3Client({
requestHandler: {
httpsAgent: { maxSockets: 400 }, //this is what fixed it
},
});
const client = new DynamoDBClient({
requestHandler: {
httpsAgent: { maxSockets: 400 }, //this is what fixed it
},
});
Links
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/dynamodb/
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-s3/