I have a AWS lambda function which process data and returns calculated results, then results saved to the db by java backend. Each call takes approximately 2-3 seconds. I followed this tutorial and successfully invoked lambda function from java. But my payload is big and I want to split it and call same function multiple times. One way of doing it is using many threads. My question is, is there any better way of doing this? Does aws lambda library has support for it?
Example payload:
{
user_1: data_1,
user_2: data_2,
...
user_300: data_300
}
I simply want to call lambda function for each user and finish processing of all users data less than 5 seconds.
UPDATE: One way is using Asynchronous Programming as stated in the documentation. Another way can be adding an API Gateway and doing async post request.