title: Azure Functions host.json Queue batchSize less than newBatchThreshold
body: <p>I have an Azure Function that calls a web service hosted on a VM. Because of this dependency it is important that no more than 8 instances of the Azure Function are ever running concurrently (the VM only has 8 cores and each call to the web service uses a single core). If more than 8 instances are spawned then the web service calls will start to backup, items from the queue that is triggering the Azure Function will start timing out, and messages will be dropped. However, I also want to utilize the available resources as much as possible to maximize the processing of the queue so I'd like there to always be 8 instances of the Azure function running whenever there are 8 or more items in the queue.  </p>
  
  <p>In order to accomplish the required throttling I have set the Azure Function plan to run on an App Service plan instead of a Consumption plan and I have set the following values in the host.json for the Azure Function service:</p>
  
  <pre><code>{
      "queues": {
          "batchSize": 1,
          "newBatchThreshold": 7
      }
  }
  </code></pre>
  
  <p>Theoretically this makes it so that as long as 7 or fewer instances of the function are running then 1 more message will be dequeued until there are 8 messages being processed. I have this running right now and it seems to be working, but I can't find anywhere in the <a href="https://github.com/Azure/azure-webjobs-sdk-script/wiki/host.json" rel="nofollow noreferrer">host.json</a> documentation or the <a href="https://github.com/Azure/azure-webjobs-sdk/wiki" rel="nofollow noreferrer">WebJobs SDK documentation</a> that says whether or not it is okay for <code>batchSize</code> to be less than <code>newBatchThreshold</code>. I only know that the recommendation is for <code>newBatchThreshold</code> to be half of <code>batchSize</code> (which is clearly not what I am doing).</p>
  
  <p>My question is: Is this configuration okay? Or is there a better way to accomplish my throttling goals?</p>