简体   繁体   中英

Migrating an API to a serverless architecture with aws lambda

I have an API that:

  1. Get data from another API (isn't mine)
  2. Use that data
  3. Return processed data to the user

I want to migrate my API to a serverless architecture with lambda, the issue is that getting that information from the API that isn't mine could take 2 seconds, and my operations with that data take 0,3 seconds. In lambda we must pay for the processing time that we use, but I'm just waiting most of the time. Is there any way to mitigate this issue?

The pricing in AWS Lambda is a factor of

  • Number of requests
  • Actual execution time
  • Max memory footprint that you configured

In your case you cannot do much about the 2 second wait time for calling your other API

Regarding your own processing time you can try out different memory footprint options to optimise the cost. Keep in mind that with increased memory you will be charged more but at the same time you get more processing power. So eventually it might even turn out to be cheaper because your execution might get over quickly (although that may vary from case to case basis).

So the crux is that you might be able to optimise your own processing time by playing around with different memory footprints but you can't do much about the waiting that you have to do for the other API call

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