Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why creating client from AWS SDK hangs AWS Lambda

Exactly this line hangs lambda, and causes it to timeout. Credentials and permissions seems right:

AmazonSimpleDBClient sdb = new AmazonSimpleDBClient(credentials);
like image 280
fatihpense Avatar asked Aug 09 '26 20:08

fatihpense


1 Answers

I experienced this same issue and found my solution by increasing the memory and timeout settings for my lambda.

Lambda allocates CPU resources relative to the amount of memory you allocate for your service. In my case, I kept my memory setting low because my process didn't need more, but I changed it when I realized it does need more CPU - due to the Java based cryptographic implementations (using https and AWS credentials)

It appears that the node.js AWS apis are much less CPU intensive than the Java AWS SDK. In my test, I create both a node.js and Java Lambda that simply did a Describe on an empty SimpleDB domain. From my observations, with the maximum memory setting, the best case execution time for both was around 300ms, but the worse case was 3 and 15 seconds respectively.

like image 174
Sean Bastille Avatar answered Aug 11 '26 10:08

Sean Bastille



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!