DynamicTp adjusts Java thread pools at runtime via config centers, with monitoring, alerting, and middleware pool management for Spring apps.
Overview
DynamicTp is a lightweight framework that extends Java's ThreadPoolExecutor so core parameters can change at runtime without redeploying code. It targets microservices that already use distributed configuration centers to push settings live.
Thread pool definitions live in the config center. On startup, pools are created from that configuration, registered in the Spring container, and injected like ordinary beans, which the project describes as zero intrusion into business code. Supported centers include Nacos, Apollo, Zookeeper, Consul, Etcd, Polaris, and ServiceComb, with SPI hooks for more.
Monitoring collects dozens of metrics through MicroMeter, JSON logs, JMX, or Spring Boot Actuator endpoints. Alerts cover configuration changes, pool activity, queue capacity, rejections, and task timeouts, with notifications to enterprise chat tools and email. The framework also manages thread pools inside Tomcat, Jetty, Dubbo, RocketMQ, gRPC, and many other middleware components.
Several executor flavors address general, IO-intensive, scheduled, and ordered workloads. Task wrappers propagate MDC, TTL, and tracing context. Graceful shutdown drains queues when the Spring context stops.
Key features
- Runtime thread pool parameter updates
- Spring Boot integration via annotation
- Multiple configuration center backends
- Micrometer and endpoint metrics
- Chat and email alert channels
- Middleware pool tuning adapters
- Task context wrapper SPI
- Graceful pool shutdown on exit
Use cases
- Tuning pool sizes without redeploys
- Observing thread pool saturation in production
- Unified pools across Dubbo and web servers
- Alerting on rejections and queue growth