简体   繁体   中英

how to reduce AWS Api gateway response time

response from an api from aws api gateway integrated to a lambda function takes a lot more time than compared to a regular node project on aws elasticbeanstalk

is there any way to reduce response time for aws api gateway

There's definitely more information needed to answer this question but from what you've said, your problems may be caused by the cold start time of Lambda functions. An Elastic Beanstalk stack will spin up EC2 instances (which are ready once they're spun up and until they're removed). Lambda will create instances of your handler as needed to address incoming traffic. The first time you call a Lambda, it needs to provision an environment for the function for the first time. Depending on the language used, this can take some time. Successive requests should be faster unless you wait a while (in which case the lambda needs to re-initialize).

So here's more information that would be useful in case this answer is not helpful:

  • How much slower is Lambda than your Elastic Beanstalk stack?
  • Is it slower only on the first couple requests or does it continue being slow when you keep requesting?
  • Is it slow every day or only occasionally?

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