title: HttpClient best practices in Azure Functions
body: <p>I need to build an Azure Function that:</p>
  
  <ul>
  <li>Responds to a <code>HTTP POST</code> request</li>
  <li>Does 7x <code>HTTP HEAD</code> requests based on the data.</li>
  </ul>
  
  <p>I've found some guidance <a href="https://github.com/Azure/azure-functions-host/issues/1806" rel="noreferrer">here</a> and <a href="https://github.com/Azure/azure-functions-host/wiki/Managing-Connections#httpclient" rel="noreferrer">here</a></p>
  
  <p>But, it's not entirely clear what to do, and how it works?</p>
  
  <p>As in the second link, i've currently just declared a <code>private static HttpClient httpClient = new HttpClient();</code> instance, and re-used that in my 7x HTTP HEAD calls.</p>
  
  <p>My questions:</p>
  
  <ol>
  <li>Is that the most efficient use of <code>HttpClient</code> in a stateless Azure function?</li>
  <li>I'm currently just building up a <code>List&lt;Task&gt;()</code> for the http calls, then doing <code>Task.WhenAll(tasks)</code> on them to run them in parrallel. Would that be the quickest way to do these calls? Any other suggestions?</li>
  </ol>
  
  <p>This Function endpoint will be called a lot (multiple times a second), so need to be as efficient as possible to keep costs down.</p>
  
  <p>Thanks!</p>