In high concurrency, ThreadPool starvation causes tasks to freeze for seconds.
⚠ The Symptoms
-
Slow responses under load
-
Random spikes
-
Async operations timing out
😬 Common Cause
Task.Run(() => {
Thread.Sleep(2000); // ❌ Blocks the threadpool
});
✔ The Fix
Use true async APIs:
await Task.Delay(2000);
💡 Bonus
Use ThreadPool.GetAvailableThreads to diagnose starvation.
