node.js – AWS SDK object is taking longer time than expected and queueing up calls

I have an API in NodeJS server hosted in AWS EKS fargate which performs some operations(some related to AWS KMS) and then upload a BSON to S3. I have configured a load balancer timeout of 5 minutes.

Sometimes in ramdom I am getting load balancer timeout because the aws-sdk object is taking too long to complete(around 7 minutes) the S3 upload or to perform the KMS operation.

Upload size can go upto 350MB and it is very rare, otherwise the average size would be around 5MB.

The API can be used by around 20 people at a time.

Any ideas what could go wrong.

aws-sdk version: 2.719.0

I have tried removing the VPC endpoint but of no use.

Enabled logs in AWS using AWS.config.logger = console; as well, logs are printed only when it was a success operation otherwise no log is getting printed.

Read more here: Source link