API Gateway Max Cached Response Size

0

I am testing API Gateway cache behavior for an API with Lambda integration. The documentation clearly states (here and here) that "The maximum size of a response that can be cached is 1048576 bytes," in other words just over 1 MB. I am testing by adding a header to the Lambda response containing a timestamp--if the timestamp remains the same across requests, this would indicate that the response was retrieved from the cache and the Lambda was not invoked.

The problem I'm encountering is that during testing, the API cache behavior does not seem to align with the documented response size limits--it seems to be caching responses that are over 5 MB in size. Am I misunderstanding this limit, or can anyone shed any light on what is going on here?

1 réponse
0

Hi, @jeffgardnerdev.

I think your guess is correct. very interesting.

The document below also states that the capacity varies depending on the cache instance.
Can you measure what your current maximum cache size is?

https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cache-capacity/?nc1=h_ls

Are your API Gateway resources edge-optimized? Are you regional?
In the latter case, have you additionally introduced CloudFront, etc.?
In that case, check the access log of API Gateway and check whether it is cached by CloudFront.

profile picture
EXPERT
iwasa
répondu il y a 2 ans
  • @iwasa thanks for the response. I am testing with a regional API, no CloudFront, using the minimum cache size--0.5 GB. Cache is not encrypted and TTL is set to 3600. I have tested after clearing the cache and the results are consistent.

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions