简体   繁体   中英

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);

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM