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 Answer
0
Accepted Answer

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
answered 4 years ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions