Adaptive thread pool scaling and real-time thread monitoring