Search code examples
javamultithreadingdropwizard

Understanding Dropwizard JMX metric Queued Thread Pool


There are 4 metric from Queued Thread Pool

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

What do they mean? what is ideal value?


Solution

  • 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.

    source and credits nickb