简体   繁体   中英

AWS ApiGateway Latency Issue

I am currently using AWS Lambda for my internal application to application calls using spring framework implemented with jrestless.

Application to application call is working perfect with decent latency(~10-15ms ideally)

But when I am trying to leverage same lambda function via API Gateway the latency shoots up to 700-800 ms. Even though my lambda function is taking same 10-15 ms.

Lambda Function Configurations:

VPC: open(no vpc)
Region: ap-south-1(Mumbai)
Memory: 1500 MB(Highest)
Timeout: 5 min(Highest)

API Gateway Configurations:

Region: ap-south-a(Mumbai)
Request Integration: proxy+
Request Method: ANY

No Authentication is being used and its an HTTPS call.

Has anyone faced a similar issue?

I also have faced latency issues with api gateway but I don't have exact figures on that. However as of now by design api gateway has a latency issue and it's an ongoing.

https://forums.aws.amazon.com/thread.jspa?threadID=225458

According to the engineers I think 700ms is bit more high.

Just in case there is another concern with lambda as hot start and cold start. when you first call lambda latency is bit high. And there are couple of workarounds to overcome this as mentioned in the following blog post

https://serverless.com/blog/keep-your-lambdas-warm/

  1. If you are curious where the latency is introduced, API Gateway provides two CloudWatch metrics: Latency and IntegrationLatency . Latency is the total server-side latency recorded by API Gateway, and IntegrationLatency is only the latency of the backend request/response. The difference between these two metrics is the API Gateway server-side overhead. Any difference between client-side latency and the Latency metric will be network/TLS/connection latency.
  2. We have recently launched the 'Regional' endpoint type which is an option for use cases where the client is in the same AWS region as the API itself. This should bring your latency down closer to what you get when calling Lambda directly.
  3. Latency will generally improve with volume
  4. Lambda itself will always have overhead, and they do not expose the server-side overhead (unlike API Gateway). The duration exposed by Lambda is only the function duration that you are billed for. It does not indicate the total latency.

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