Nodes Hot Threads API
Nodes Hot Threads API
1.0에서 도입
Nodes Hot Threads 엔드포인트는 선택한 클러스터 노드에서 바쁘게 동작 중인 JVM 스레드에 대한 정보를 제공해요. 각 노드의 활동을 독특하게 들여다볼 수 있어요.
출처: 문서
본문
엔드포인트 (Endpoints)
GET /_nodes/hot_threads
GET /_nodes/{node_id}/hot_threads
경로 매개변수 (Path parameters)
요청에 다음 선택적 경로 매개변수를 포함할 수 있어요.
| 매개변수 | 타입 | 설명 |
|---|---|---|
node_id |
String | 결과를 필터링하는 데 사용하는 쉼표로 구분된 노드 ID 목록이에요. 노드 필터를 지원해요. 기본값은 _all이에요. |
쿼리 매개변수 (Query parameters)
요청에 다음 쿼리 매개변수를 포함할 수 있어요. 모든 쿼리 매개변수는 선택 사항이에요.
| 매개변수 | 타입 | 설명 |
|---|---|---|
snapshots |
Integer | 스레드 스택 트레이스의 샘플 수예요. 기본값은 10이에요. |
interval |
Time | 연속 샘플 사이의 간격이에요. 기본값은 500ms예요. |
threads |
Integer | 정보를 반환할 가장 바쁜 스레드의 수예요. 기본값은 3이에요. |
ignore_idle_threads |
Boolean | 소켓 select를 기다리거나 빈 태스크 큐에서 가져오는 등 알려진 유휴 상태의 스레드를 표시하지 않아요. 기본값은 true예요. |
type |
String | 지원되는 스레드 타입은 cpu, wait, block이에요. 기본값은 cpu예요. |
timeout |
Time | 노드 응답의 시간 제한을 설정해요. 기본값은 30s예요. |
예시 요청 (Example request)
GET /_nodes/hot_threads
Python 클라이언트로는 이렇게 호출해요:
response = client.nodes.info(
node_id_or_metric = "hot_threads"
)
예시 응답 (Example response)
::: {opensearch}{F-ByTQzVQ3GQeYzQJArJGQ}{GxbcLdCATPWggOuQHJAoCw}{127.0.0.1}{127.0.0.1:9300}{dimr}{shard_indexing_pressure_enabled=true}
Hot threads at 2022-09-29T19:46:44.533Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
0.1% (455.5micros out of 500ms) cpu usage by thread 'ScheduledMetricCollectorsExecutor'
10/10 snapshots sharing following 2 elements
[email protected]/java.lang.Thread.sleep(Native Method)
org.opensearch.performanceanalyzer.collectors.ScheduledMetricCollectorsExecutor.run(ScheduledMetricCollectorsExecutor.java:100)
응답 형식 (Example response)
대부분의 OpenSearch API 응답과 달리 이 응답은 텍스트 형식이에요.
응답에 포함된 클러스터 노드마다 섹션이 하나씩 있어요.
각 섹션은 다음 세그먼트를 담은 한 줄로 시작해요.
| 줄 세그먼트 | 설명 |
|---|---|
::: |
줄 시작(구분되는 시각 기호) |
{global-eu-35} |
노드 이름 |
{uFPbKLDOTlOmdnwUlKW8sw} |
NodeId |
{OAM8OT5CQAyasWuIDeVyUA} |
EphemeralId |
{global-eu-35.local} |
호스트 이름 |
{[gdv2:a284:2acv:5fa6:0:3a2:7260:74cf]:9300} |
호스트 주소 |
{dimr} |
노드 역할 (d=data, i=ingest, m=cluster manager, r=remote cluster client) |
{zone=west-a2, shard_indexing_pressure_enabled=true} |
노드 속성 |
그다음에 선택한 타입의 스레드에 대한 정보가 제공돼요.
::: {global-eu-35}{uFPbKLDOTlOmdnwUlKW8sw}{OAM8OT5CQAyasWuIDeVyUA}{global-eu-35.local}{[gdv2:a284:2acv:5fa6:0:3a2:7260:74cf]:9300}{dimr}{zone=west-a2, shard_indexing_pressure_enabled=true}
Hot threads at 2022-04-01T15:15:27.658Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
0.1% (645micros out of 500ms) cpu usage by thread 'opensearch[global-eu-35][transport_worker][T#7]'
4/10 snapshots sharing following 3 elements
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
[email protected]/java.lang.Thread.run(Thread.java:829)
::: {global-eu-62}{4knOxAdERlOB19zLQIT1bQ}{HJuZs2HiQ_-8Elj0Fvi_1g}{global-eu-62.local}{[gdv2:a284:2acv:5fa6:0:3a2:bba6:fe3f]:9300}{dimr}{zone=west-a2, shard_indexing_pressure_enabled=true}
Hot threads at 2022-04-01T15:15:27.659Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
18.7% (93.4ms out of 500ms) cpu usage by thread 'opensearch[global-eu-62][transport_worker][T#3]'
6/10 snapshots sharing following 3 elements
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
[email protected]/java.lang.Thread.run(Thread.java:829)
::: {global-eu-44}{8WW3hrkcTwGvgah_L8D_jw}{Sok7spHISFyol0jFV6i0kw}{global-eu-44.local}{[gdv2:a284:2acv:5fa6:0:3a2:9120:e79e]:9300}{dimr}{zone=west-a2, shard_indexing_pressure_enabled=true}
Hot threads at 2022-04-01T15:15:27.659Z, interval=500ms, busiestThreads=3, ignoreIdleThreads=true:
42.6% (212.7ms out of 500ms) cpu usage by thread 'opensearch[global-eu-44][write][T#5]'
2/10 snapshots sharing following 43 elements
[email protected]/sun.nio.ch.IOUtil.write1(Native Method)
[email protected]/sun.nio.ch.EPollSelectorImpl.wakeup(EPollSelectorImpl.java:254)
io.netty.channel.nio.NioEventLoop.wakeup(NioEventLoop.java:787)
io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:846)
io.netty.util.concurrent.SingleThreadEventExecutor.execute(SingleThreadEventExecutor.java:815)
io.netty.channel.AbstractChannelHandlerContext.safeExecute(AbstractChannelHandlerContext.java:989)
io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:796)
io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1020)
io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:311)
org.opensearch.transport.netty4.Netty4TcpChannel.sendMessage(Netty4TcpChannel.java:159)
app//org.opensearch.transport.OutboundHan...
필요한 권한 (Required permissions)
Security 플러그인을 사용한다면 다음 권한을 설정해줘야 해요: cluster:monitor/nodes/hot_threads.