I'm new to AWS serverless applications and am looking for something like ocelot request aggregation on the AWS serverless stack.
Assume I have two AWS lambdas that return data needed by a SPA: A and B. They each take 1 second to run to load data from different sources. When the browser makes a call to the API I wish to run both concurrently and return the resulting JSON to the browser.
Two options I'm considering:
- A parallel state in a step function that runs A and B
- Have another lambda whose sole purpose is to run A and B concurrently and return the results
Testing both these I've found the step function takes an extra 220ms per call and the concurrent lambda takes an extra 500ms each call. These are both too slow for a SPA api. Is there a faster solution?