title: Performing concurrently http requests using httpclient in .NET C#
body: <p>I have made a console application which basically performs large amount of requests towards my server. 10-15000 requests per user.</p>
  
  <p>So I've written this code which uses .NET's HTTP Client library:     </p>
  
  <pre><code>public async Task&lt;string&gt; DoRequest(string token)
  {
  
  var request = new HttpRequestMessage(HttpMethod.Post, "mysite.com");
  string requestXML = "my xml request goes her...";
  request.Content = new StringContent(requestXML, Encoding.UTF8, "text/xml");
  var response = await httpClient.SendAsync(request);
  return await response.Content.ReadAsStringAsync();
  }
  </code></pre>
  
  <p>So now I'm trying to perform as much as HTTP requests that I can per 1 second... I don't know whats the upper limit of this so I've used parallel for loop to speed this:</p>
  
  <pre><code>Parallel.For(0,list.Count(),items=&gt;{
  DoRequest(item.Token);
  });
  </code></pre>
  
  <p>But I'm not very happy with the speed of the code and how the requests are being made...</p>
  
  <p>Is there any way that I can speed things up n do maybe up to 10-100 requests per 1 second ? Or what is the maximum limit ?</p>
  
  <p>Can someone help me out ?</p>
  
  <p>P.S. guys I created only one instance of httpclient class because I read that it's a good practice to make only one since each time a new object of this class is made the connection gets closed, which is not what we want no ?</p>