了解 Dropwizard JMX 指标队列线程池

Understanding Dropwizard JMX metric Queued Thread Pool

队列线程池中有 4 个指标

jmx.metrics.org.eclipse.jetty.util.thread.QueuedThreadPool.dw.size.Value
jmx.metrics.org.eclipse.jetty.util.thread.QueuedThreadPool.dw.jobs.Value
jmx.metrics.org.eclipse.jetty.util.thread.QueuedThreadPool.dw.utilization.max.Value
jmx.metrics.org.eclipse.jetty.util.thread.QueuedThreadPool.dw.utilization.Value

它们是什么意思?什么是理想值?

org.eclipse.jetty.util.thread.QueuedThreadPool.dw.jobs

“Number of jobs queued waiting for a thread”. This metric you want as low as possible as you don’t want requests waiting to be served. You may get the occasional 1, but that is when the metric grabbed it’s value, during the miniscule amount of time a single job is in the queue, and it is nothing to worry about, as all requests have to be served from the queue.

Ideal: Ideally this value should be close to 0. Whenever this number will go up and dw.size < maxThreads, dropwizard will spun up new thread. Thus resetting waiting to 0.

org.eclipse.jetty.util.thread.QueuedThreadPool.dw.size

The number of threads currently in the pool”. These are the threads in the (Jetty) web server that are servicing requests.

Ideal: this number will be less than maxThreads (default 1024) that you define in your config.yml. If you see this metric going close to maxThreads and QueuedThreadPool.dw.jobs is not decreasing you should investigate why so many threads are being used and try to increase it, if your machines can support it.

org.eclipse.jetty.util.thread.QueuedThreadPool.dw.utilization

the number of threads currently being used in the pool (eg. how many threads currently in the pool are not idle)

org.eclipse.jetty.util.thread.QueuedThreadPool.dw.utilization-max

the number of threads currently being used compared to what the maximum number of threads the pool can grow to.

Ideal: this should be less than 1. If this is constantly 1 then you should increase maxthread count.

来源和学分nickb