DynamicTp: A Dynamic ThreadPoolExecutor Extension for Real‑time Monitoring and Configuration
DynamicTp is a Java library that extends ThreadPoolExecutor to enable dynamic, configuration‑center‑driven adjustment of thread‑pool parameters, real‑time monitoring, alert notifications, and metric collection, providing a lightweight, zero‑intrusion solution for microservice architectures.
Background: In Java development thread pools are widely used, but setting core parameters, adjusting them after deployment, and monitoring runtime behavior are challenging.
DynamicTp addresses these pain points by allowing dynamic modification of ThreadPoolExecutor parameters at runtime via configuration centers such as Nacos, Apollo, Zookeeper, Consul, and Etcd.
Key objectives: real‑time parameter adjustment, runtime monitoring with alerting, and metric collection for dashboards like Grafana.
Features of the latest v1.0.9 release include zero‑intrusion configuration, lightweight SpringBoot starter, high extensibility via SPI, large‑scale production use (e.g., Meituan), multi‑platform alert notifications, various metric output options (JsonLog, Micrometer, custom endpoint), task wrappers for context propagation, compatibility with JUC pools and ThreadPoolTaskExecutor, and integration with third‑party component pools (Tomcat, Jetty, Undertow, Dubbo, RocketMQ, Hystrix, gRPC).
Architecture is divided into modules: configuration change listener, internal thread‑pool manager, third‑party component manager, monitoring, and notification/alert modules. Each module’s responsibilities are described.
Code structure consists of adapter, common, core, example, extension, logging, and starter modules, each handling specific concerns such as adapting third‑party pools, providing reusable utilities, core logic, examples, extensions, logging, and auto‑configuration.
Project repositories are available on Gitee (https://gitee.com/dromara/dynamic-tp) and GitHub (https://github.com/dromara/dynamic-tp).
Architect
Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.