I am using Parallel.ForEach to call a rest api service in batch mode like 1000 request at a time. My MaxDegreeOfParallelism is set to 1000 , But it seems system only creating 10-15 request at a time althoug system CPU utilization is very normal (15%)
var maxDegree = new ParallelOptions() { MaxDegreeOfParallelism = MaxDegreeOfParallelism };
Parallel.ForEach(parsedLines, maxDegree, obj =>
{
processIndividualRecord(obj);
var currentCount = Interlocked.Increment(ref paraaleCounter);
if (currentCount % 100 == 0)
{
logger.Debug("Reaming records to process is:" + (parsedLines.Count - currentCount));
}
});
Is there any way I can make 1000 request at a time to avoid large wait time in non blocking mode.