Thank you for reaching out.
We’ve reviewed the log messages you observed, including:
Host CPU threshold exceeded
Possible thread pool starvation detected
DrainMode mode enabled
These warnings are generated by the Azure Functions host monitoring system when it detects that the environment may be under resource pressure. It's important to note that these are informational warnings and do not indicate a failure in your function logic — especially since your function has completed successfully.
To proactively maintain performance and avoid potential delays or scaling limitations, we recommend trying the following optimizations:
- Throttling Concurrent Workloads
If you're using triggers such as Service Bus, Event Hub, or Queues, consider adjusting concurrency settings likemaxConcurrentCalls
to better manage throughput according to your app's resource profile.
Service Bus Trigger – Concurrency - Scale Configuration
Since you're using a Premium Plan, you may benefit from increasing the minimum instance count or upgrading to a higher SKU (e.g., EP2 or EP3) if your workload is CPU-intensive.
Azure Functions Premium Plan - Scaling - Optimize Function Code
Ensure all I/O-bound operations are properly awaited, and any CPU-heavy tasks are handled efficiently — ideally in smaller batches or offloaded to separate processes if needed.
Optimize Function Performance - Monitoring & Insights
We recommend enabling Azure Application Insights to track key metrics, such as thread pool usage, CPU load, and function execution times. This can help identify bottlenecks early and guide further optimizations.
Monitor Azure Functions with Application Insights
The same is discussed in the following GitHub post: Azure Functions - Thread Pool Starvation.
These steps are safe to implement and not interrupt your current operations. They are designed to improve your app’s stability and responsiveness, especially during peak load conditions.
Hope this helps. Do let us know if you have any further queries.
If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And if you have any further questions, let us know.