Skip to main content
Version: v1.6.x

Monitoring DynamicTp ThreadPool

Collect and monitor the thread pool performance Metrics exposed by DynamicTp actuator.

PreRequisites

  1. Integration Using DynamicTp

DynamicTp is a lightweight dynamic thread pool based on the configuration center of the Jvm language. It has built-in monitoring and alarm functions, which can be realized through SPI custom extensions.

For integrated use, please refer to the document Quick Start

  1. Open SpringBoot Actuator Endpoint to expose DynamicTp Metric interface
management:
endpoints:
web:
exposure:
include: '*'

Test whether the access Metric interface ip:port/actuator/dynamic-tp has response json data as follows:

[
{
"poolName": "commonExecutor",
"corePoolSize": 1,
"maximumPoolSize": 1,
"queueType": "LinkedBlockingQueue",
"queueCapacity": 2147483647,
"queueSize": 0,
"fair": false,
"queueRemainingCapacity": 2147483647,
"activeCount": 0,
"taskCount": 0,
"completedTaskCount": 0,
"largestPoolSize": 0,
"poolSize": 0,
"waitTaskCount": 0,
"rejectCount": 0,
"rejectHandlerName": null,
"dynamic": false,
"runTimeoutCount": 0,
"queueTimeoutCount": 0
},
{
"maxMemory": "4GB",
"totalMemory": "444MB",
"freeMemory": "250.34 MB",
"usableMemory": "3.81GB"
}
]
  1. Add DynamicTp monitoring under HertzBeat middleware monitoring

Configuration parameters

Parameter nameParameter help description
Monitoring HostThe peer IPV4, IPV6 or domain name to be monitored. Note ⚠️Without protocol header (eg: https://, http://).
Monitoring nameThe name that identifies this monitoring, and the name needs to be unique.
PortThe port provided by the application service, the default is 8080.
Enable HTTPSWhether to access the website through HTTPS, note ⚠️Enable HTTPS, the default corresponding port needs to be changed to 443
Base PathExposed interface path prefix, default /actuator
Acquisition IntervalInterval time for monitoring periodic data collection, in seconds, the minimum interval that can be set is 30 seconds
Whether to detectWhether to detect and check the availability of monitoring before adding monitoring, and the operation of adding and modifying will continue after the detection is successful
Description RemarksMore remark information to identify and describe this monitoring, users can remark information here

Collect metrics

Metric collection: thread_pool

Metric NameMetric UnitMetric Help Description
pool_nameNoneThread pool name
core_pool_sizeNoneNumber of core threads
maximum_pool_sizeNoneMaximum number of threads
queue_typeNoneTask queue type
queue_capacityMBtask queue capacity
queue_sizeNoneThe current occupied size of the task queue
fairNoneQueue mode, SynchronousQueue will be used
queue_remaining_capacityMBtask queue remaining size
active_countNoneNumber of active threads
task_countNoneTotal number of tasks
completed_task_countNoneNumber of completed tasks
largest_pool_sizeNoneThe largest number of threads in history
pool_sizenonecurrent number of threads
wait_task_countNoneNumber of tasks waiting to be executed
reject_countNoneNumber of rejected tasks
reject_handler_nameNoneReject policy type
dynamicNoneDynamic thread pool or not
run_timeout_countNoneNumber of running timeout tasks
queue_timeout_countNoneNumber of tasks waiting for timeout