explaingit

dromara/dynamic-tp

4,765JavaAudience · ops devopsComplexity · 3/5LicenseSetup · moderate

TLDR

A Java library that lets you change thread pool settings while your app is running, with no restarts needed. It also adds monitoring, alerts, and visibility into pools inside Tomcat, Dubbo, RocketMQ, and other frameworks you're already using.

Mindmap

mindmap
  root((DynamicTp))
  Dynamic Tuning
    Change at runtime
    No restart needed
    Config center sync
  Config Centers
    Nacos
    Apollo
    Zookeeper
    Consul
  Monitoring
    20 plus metrics
    Prometheus export
    Spring Boot endpoint
  Alerts
    Queue full warning
    Task rejection alert
    Slow task detection
  Notification Channels
    DingTalk
    WeChat Work
    Feishu
    Email
  Third Party Pools
    Tomcat
    Dubbo
    RocketMQ
    gRPC
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Tune thread pool sizes in a running Java service without redeploying or restarting anything

USE CASE 2

Get alerts on DingTalk or Slack when a thread pool is full or starts rejecting tasks

USE CASE 3

Monitor 20+ metrics about thread activity and queue depth exported to Prometheus dashboards

USE CASE 4

Gain visibility and control over internal pools inside Tomcat, Dubbo, RocketMQ, and gRPC

Tech stack

JavaSpring BootPrometheusNacosApollo

Getting it running

Difficulty · moderate Time to first run · 30min

Four setup steps: add Maven/Gradle dependency, configure pool in your config center, annotate the startup class, inject the pool. Requires an existing config center like Nacos or Apollo.

Apache 2.0 license, free to use and modify, even in commercial products, as long as you include the license notice.

In plain English

DynamicTp is a Java library that solves a common headache with thread pools: you set the configuration at startup, it goes live, and then you discover the numbers were wrong. Changing them normally means editing code, redeploying, and restarting the service. DynamicTp lets you adjust thread pool settings while the application is running, without any downtime or redeployment. A thread pool, in this context, is how Java applications handle many tasks at once. You configure it with parameters like how many threads to keep active at minimum, how many to allow at peak, and how large the waiting queue can grow. Getting these numbers right matters for performance, but the right values often only become clear once the application is actually handling real traffic. DynamicTp stores these settings in a configuration center (it supports Nacos, Apollo, Zookeeper, Consul, Etcd, and others), so that pushing a change to the config center immediately updates the running thread pool with no restart needed. Beyond dynamic adjustment, the library adds monitoring and alerting. It collects over 20 metrics covering thread activity, queue depth, task throughput, and response time percentiles. These can be exported to Prometheus, logged as JSON, or queried via a Spring Boot endpoint. Alert rules let teams receive notifications when a thread pool hits capacity, starts rejecting tasks, or tasks begin taking too long. Alerts can be delivered via DingTalk, WeChat Work, Feishu, email, or a custom channel. The library also reaches into third-party components that manage their own internal thread pools, including Tomcat, Dubbo, RocketMQ, gRPC, RabbitMQ, and about a dozen others. Teams using those frameworks gain the same dynamic tuning and monitoring for pools they previously had no visibility into. Setup is described as four steps: add the dependency, configure the thread pool in the config center, annotate the application startup class, and inject the pool for use. Existing standard Java thread pools and Spring task executors can be brought under management by adding a single annotation.

Copy-paste prompts

Prompt 1
I use Spring Boot with a thread pool configured at startup. Show me how to add DynamicTp so I can adjust the pool size at runtime through Nacos without restarting.
Prompt 2
How do I set up DynamicTp alerts so my team gets a DingTalk message when a thread pool queue is more than 80% full?
Prompt 3
Walk me through exporting DynamicTp thread pool metrics to Prometheus and creating a basic Grafana dashboard to visualize them.
Prompt 4
I use RocketMQ in my Java app. How does DynamicTp let me monitor and tune RocketMQ's internal thread pools that I previously had no visibility into?
Open on GitHub → Explain another repo

← dromara on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.