We got a requirement to execute bulk API request(more than 1000 calls) and save response data in database.
Initially we got 10-20 API calls requirement. For these requests we used simple 'for loop' with single instance of HTTPClient to fetched data and saved it to database.
Later we got 100-200 API calls requirement. For these requests we used Parallel.ForEach with single HTTPClient instance but we are getting socket issues. so we created new instance for each request. even this approach causing issue on server .
Now requirement is to execute 1000+ API calls.
With single HTTPClient instance using 'await' taking hours to complete the operation.
Is there any way or good practice for doing 1000+ api call with very good performance and without loosing data in C#?