Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can/will AWS API Gateway -> Lambda performance be improved?

Has anyone found a solution to API Gateway latency issues?

With a simple function testing API Gateway -> Lambda interaction, I regularly see cold starts in the 2.5s range, and once "warmed," response times in the 900ms - 1.1s range are typical.

I understand the TLS handshake has its own overhead, but testing similar resources (AWS-based or general sites that I believe are not geo-distributed) from my location shows results that are half that, ~500ms.

Is good news coming soon from AWS?

(I've read everything I could find before posting.)

like image 453
SexxLuthor Avatar asked Jan 26 '17 03:01

SexxLuthor


People also ask

Do we need API gateway for Lambda?

You can create a web API with an HTTP endpoint for your Lambda function by using Amazon API Gateway. API Gateway provides tools for creating and documenting web APIs that route HTTP requests to Lambda functions. You can secure access to your API with authentication and authorization controls.

How do I speed up my AWS Lambda processor?

Adding more memory proportionally increases the amount of CPU, increasing the overall computational power available. If a function is CPU-, network- or memory-bound, then changing the memory setting can dramatically improve its performance.


1 Answers

engineer with the API Gateway team here.

You said you've read "everything", but for context for others I want to link to a number of threads on our forums where I've documented publicly where a lot of this perceived latency when executing a single API call comes from:

  • Forum Post 1
  • Forum Post 2

In general, as you increase your call rates, your average latency will shrink as connection reuse mechanisms between your clients and CloudFront as well as between CloudFront and API Gateway can be leveraged. Additionally, a higher call rate will ensure your Lambda is "warm" and ready to serve requests.

That being said, we are painfully aware that we are not meeting the performance bar for a lot of our customers and are making strides towards improving this:

  • The Lambda team is constantly working on improving cold start times as well as attempting to remove them for functions that are seeing continuous load.

  • On API Gateway, we are currently in the process of rolling out improved connection reuse between CloudFront and API Gateway, where customers will be able to benefit from connections established via other APIs. This should mean that the percentage of requests that need to do a full TLS handshake between CloudFront and API Gateway should be reduced.

like image 107
Bob Kinney Avatar answered Nov 15 '22 08:11

Bob Kinney