I recently played with Lambda and am working on creating an API using the Gateway and Lambda APIs. I have a lambda function that returns JSON and the endpoint of the API gateway that calls this function. Everything works well with this simple setup.
I tried loading the API gateway endpoint using the loadtest npm module. Although Lambda handles concurrent requests (albeit with an increase in average latency during execution), when I send 40 requests per second or so, it starts throwing errors, only partially filling in the requests.
I read in the documentation that by default, Lambda invocation is of type RequestResponse (which is what the API is doing now), which is synchronous in nature and does not seem to block. For an asynchronous call, the type of call is an event. But lambda resets the return type for asynchronous calls, and the API returns nothing.
Is there something that I am missing with either sync, async or concurrency definitions regarding AWS? Is there a better way to approach this problem? Any insight is helpful. Thank!
source
share