system-top-threads
Retrieves threads with high CPU usage, sorted in descending order. Requires cluster administrator privileges.
Command properties
| Property | Description |
|---|---|
| Command type | Driver query |
| Required permission | Cluster administrator |
| License usage | Not counted |
| Parallel execution | Not supported |
| Distributed execution | Not supported |
Syntax
Options
None
Output fields
| Field | Type | Description |
|---|---|---|
| tid | long | Thread ID |
| name | string | Thread name |
| state | string | Thread state. One of: NEW, RUNNABLE, BLOCKED, WAITING, TIMED_WAITING, TERMINATED |
| priority | integer | Thread priority. A value between 1 and 10; the default is 5. |
| usage | long | CPU time measured at 1-second intervals (in nanoseconds) |
| stacktrace | string | Thread stack trace (similar format to jstack) |
Error codes
Parsing errors
| Error code | Message | Description |
|---|---|---|
| 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
-
Retrieve high-CPU threads
system-top-threadsRetrieves thread information and stack traces sorted by CPU usage in descending order.
-
Retrieve the top 10 CPU-consuming threads
system-top-threads | limit 10Retrieves the top 10 threads with the highest CPU usage.