system-top-threads

Retrieves threads with high CPU usage, sorted in descending order. Requires cluster administrator privileges.

Command properties

PropertyDescription
Command typeDriver query
Required permissionCluster administrator
License usageNot counted
Parallel executionNot supported
Distributed executionNot supported

Syntax

system-top-threads

Options

None

Output fields

FieldTypeDescription
tidlongThread ID
namestringThread name
statestringThread state. One of: NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED
priorityintegerThread priority. A value between 1 and 10; the default is 5.
usagelongCPU time measured at 1-second intervals (in nanoseconds)
stacktracestringThread stack trace (similar format to jstack)

Error codes

Parsing errors
Error codeMessageDescription
95050읽기 권한이 없습니다. 클러스터 관리자 권한이 필요합니다.The user does not have cluster administrator privileges
95051스레드 CPU 사용량 측정이 지원되지 않거나 비활성화되어 있습니다.The JVM does not support or has disabled thread CPU usage measurement
Runtime errors

N/A

Description

The system-top-threads command retrieves threads in the JVM that consume a large amount of CPU. It measures each thread's CPU time twice at a 1-second interval and returns the difference in the usage field in nanoseconds. Threads with a CPU usage of 0 or less (inactive or waiting threads) are excluded from the results.

Results are sorted in descending order by CPU usage. Use this command to diagnose which threads are consuming CPU during performance degradation.

Cluster administrator privileges are required, and the JVM must support thread CPU usage measurement.

Examples

  1. Retrieve high-CPU threads

    system-top-threads
    

    Retrieves thread information and stack traces sorted by CPU usage in descending order.

  2. Retrieve the top 10 CPU-consuming threads

    system-top-threads | limit 10
    

    Retrieves the top 10 threads with the highest CPU usage.