I'm creating the backend of my application using the API Gateway with Lambda functions and I'm having problems with the response time of the requests.
It's already known that the Lambda functions have the infamous "cold start" and ok, we already accept that. But the problem I'm having seems to be is a new cold start, this time by the API Gateway. And is not a few ms
of standby time, it's seconds
(around 12-15 seconds). Oh god, this is a big problem...
This response delay occurs for 12-15 seconds on the first request and after some inactivity (approximately 1 hour).
My question is: what could be causing this delay and how to fix it?
More information:
My lambda function is configured to run on a VPC.
CloudWatch logs from API Gateway:
(01) Extended Request Id: XXXXX=
(02) Verifying Usage Plan for request: XXXXX. API Key: API Stage: XXXXX
(03) API Key authorized because method 'GET /XXXXX' does not require API Key. Request will not contribute to throttle or quota limits
(04) Usage Plan check succeeded for API Key and API Stage XXXXX/v1
(05) Starting execution for request:
(06) HTTP Method: GET, Resource Path:
(07) Method request path:
(08) Method request query string:
(09) Method request headers:
(10) Method request body before transformations:
(11) Endpoint request URI:
(12) Endpoint request headers:
(13) Endpoint request body after transformations:
(14) Sending request to XXXXX
(15) Received response. Integration latency: 14497 ms
(16) Endpoint response body before transformations:
(17) Endpoint response headers:
(18) Method response body after transformations:
(19) Method response headers:
(20) Successfully completed execution
(21) Method completed with status: 200
(22) AWS Integration Endpoint RequestId :
(23) X-ray Tracing ID :