400 ms difference between APIG latency and Lambda Latency

0

We have a Lambda with multiple functions fronted by an APIG. We expect that the APIG latency for a specific lambda endpoint (resource) should be very close to the p50 latency reported by the lambda for that endpoint.

However we consistently see a ~400 ms difference between the APIG latency and the various latencies for each lambda function behind the APIG.

Two questions:

  1. What could be causing this and how can I test for this?

  2. One hypothesis was that it might be due to SSL. I expect that SSL would only add 100 ms not 400 ms. That being said how can I confirm if the is SSL between the APIG and the Lambda, and if there is how much latency that is adding?

1 回答
0
已接受的回答

There are a number of possible factors so I won't try to guess on what the cause would be. I'd recommend utilizing X-Ray tracing on API Gateway and your lambdas. This will give you insight into where the time is being spent and some hints as to what might be going on.

Some resources to get started on getting AWS X-Ray integrated:

Amazon API Gateway active tracing support

AWS Lambda and AWS X-Ray

AWS
已回答 4 年前
  • I don't feel like this answers the question. The scenario is pretty simple, and I have yet to get a clear answer on this. I have an API Gateway and an AppSync API both in the same region, both with the same Lambda functions hooked to them, both with requests coming from the same place. API Gateway is always significantly faster. I really want to use AppSync, but the performance is unacceptably slow.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则