title: Throttle async tasks?
body: <p>I would like to know if we should throttle async tasks if the number of tasks to complete is big. Say you have 1000 URLs, do you fire all the requests at once and wait for all:</p>
  
  <pre><code>var tasks = urlList.Select(url =&gt; downloadAsync(url));
  await Task.WhenAll(tasks);
  </code></pre>
  
  <p>Or do you batch the requests and process one batch after another:</p>
  
  <pre><code>foreach (var urlBatch in urlList.BatchEnumerable(BatchSize)){
      var tasks = urlBatch.Select(url =&gt; downloadAsync(url));
      await Task.WhenAll(tasks);
  }
  </code></pre>
  
  <p>I thought that batching is not necessary, because the first approach (firing all requests at once) will create tasks that are scheduled by the <code>ThreadPool</code>, so we should let the <code>ThreadPool</code> decide when to execute each task. However, I was told that in practice that only works if the tasks are compute tasks. When the the tasks involve network requests, the first approach could cause the host machine to hang ??? Why is that ?</p>