Hot Threads API
editHot Threads API
editThe hot threads API gets the current hot threads for Logstash. A hot thread is a Java thread that has high CPU usage and executes for a longer than normal period of time.
curl -XGET 'localhost:9600/_node/hot_threads?pretty'
The output is a JSON document that contains a breakdown of the top hot threads for Logstash.
Example response:
{ "hot_threads" : { "time" : "2017-06-06T18:25:28-07:00", "busiest_threads" : 3, "threads" : [ { "name" : "Ruby-0-Thread-7", "percent_of_cpu_time" : 0.0, "state" : "timed_waiting", "path" : "/path/to/logstash-7.17.26/vendor/bundle/jruby/1.9/gems/puma-2.16.0-java/lib/puma/thread_pool.rb:187", "traces" : [ "java.lang.Object.wait(Native Method)", "org.jruby.RubyThread.sleep(RubyThread.java:1002)", "org.jruby.RubyKernel.sleep(RubyKernel.java:803)" ] }, { "name" : "[test2]>worker3", "percent_of_cpu_time" : 0.85, "state" : "waiting", "traces" : [ "sun.misc.Unsafe.park(Native Method)", "java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)", "java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)" ] }, { "name" : "[test2]>worker2", "percent_of_cpu_time" : 0.85, "state" : "runnable", "traces" : [ "org.jruby.RubyClass.allocate(RubyClass.java:225)", "org.jruby.RubyClass.newInstance(RubyClass.java:856)", "org.jruby.RubyClass$INVOKER$i$newInstance.call(RubyClass$INVOKER$i$newInstance.gen)" ] } ] } }
The parameters allowed are:
|
The number of hot threads to return. The default is 10. |
|
The depth of the stack trace to report for each thread. The default is 50. |
|
If true, returns plain text instead of JSON format. The default is false. |
|
If true, does not return idle threads. The default is true. |
See Common Options for a list of options that can be applied to all Logstash monitoring APIs.
You can use the ?human
parameter to return the document in a human-readable format.
curl -XGET 'localhost:9600/_node/hot_threads?human=true'
Example of a human-readable response:
::: {} Hot threads at 2017-06-06T18:31:17-07:00, busiestThreads=3: ================================================================================ 0.0 % of cpu usage, state: timed_waiting, thread name: 'Ruby-0-Thread-7' /path/to/logstash-7.17.26/vendor/bundle/jruby/1.9/gems/puma-2.16.0-java/lib/puma/thread_pool.rb:187 java.lang.Object.wait(Native Method) org.jruby.RubyThread.sleep(RubyThread.java:1002) org.jruby.RubyKernel.sleep(RubyKernel.java:803) -------------------------------------------------------------------------------- 0.0 % of cpu usage, state: waiting, thread name: 'defaultEventExecutorGroup-5-4' sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) -------------------------------------------------------------------------------- 0.05 % of cpu usage, state: timed_waiting, thread name: '[test]-pipeline-manager' java.lang.Object.wait(Native Method) java.lang.Thread.join(Thread.java:1253) org.jruby.internal.runtime.NativeThread.join(NativeThread.java:75)