when the Azure Function determines it is getting overloaded it creates another thread which is normal behavior for Azure Functions that are on the consumption plan.
Your assumption is basically right, as the doc says,
scale controller automatically scales CPU and memory resources by adding additional instances of the Functions host, based on the number of events that its functions are triggered on
But I also see the tutorial along with the doc mentions
a single partition will only have a lease on one processor host at a time. That means multiple function instances can’t pull messages from the same partition.
Hence setting maxBatchSize to 1 is supposed to avoid concurrent in single partition reading.
If this doesn't guarantee the singleton, I suggest you add WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT
with value 1
in Application settings to ensure no more host instances will be created.
maxBatchSize
to 1 to avoid concurrent behavior but recommends the ordered batches for performance consideration. – Jerry Liu