본문 바로가기

카테고리 없음

C1 C2 Compiler (JIT Compiler)

Full thread dump OpenJDK 64-Bit Server VM (17.0.13+11-Ubuntu-2ubuntu124.04 mixed mode, sharing):

Threads class SMR info:
_java_thread_list=0x00007533d8000c40, length=34, elements={
0x000075344c050ec0, 0x000075344c0522f0, 0x000075344c05b7e0, 0x000075344c05cb80,
0x000075344c05df80, 0x000075344c05f920, 0x000075344c060e40, 0x000075344c0622a0,
0x000075344c09e230, 0x000075344c0a1150, 0x000075344ce7f7a0, 0x00007533dc0039c0,
0x000075344ce80a90, 0x000075344cf4c2a0, 0x000075344d517f80, 0x000075344d3efd60,
0x000075344d81d830, 0x000075344dc970a0, 0x000075344dcf02b0, 0x000075344dd90310,
0x000075344dd67fc0, 0x000075344dc65170, 0x000075344c0177e0, 0x00007533e8066b70,
0x00007533e80e0470, 0x00007533e8152e30, 0x00007533e8193720, 0x00007533e811bc10,
0x00007533e8153e90, 0x00007533e8278cf0, 0x00007533e8173010, 0x00007533e8241370,
0x00007533e8258550, 0x00007533d8053e70
}

...

"Signal Dispatcher" #4 daemon prio=9 os_prio=0 cpu=0.29ms elapsed=81379.12s tid=0x000075344c05b7e0 nid=0x4194 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" #5 daemon prio=9 os_prio=0 cpu=134.61ms elapsed=81379.12s tid=0x000075344c05cb80 nid=0x4195 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Monitor Deflation Thread" #6 daemon prio=9 os_prio=0 cpu=10743.81ms elapsed=81379.12s tid=0x000075344c05df80 nid=0x4196 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #7 daemon prio=9 os_prio=0 cpu=52708.20ms elapsed=81379.12s tid=0x000075344c05f920 nid=0x4197 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"C1 CompilerThread0" #8 daemon prio=9 os_prio=0 cpu=6877.40ms elapsed=81379.12s tid=0x000075344c060e40 nid=0x4198 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

"Sweeper thread" #9 daemon prio=9 os_prio=0 cpu=562.10ms elapsed=81379.12s tid=0x000075344c0622a0 nid=0x4199 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Notification Thread" #10 daemon prio=9 os_prio=0 cpu=150.65ms elapsed=81379.09s tid=0x000075344c09e230 nid=0x419a runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

 

 

top -H 명령어로도 확인해보니

 

C1 C2 Compiler 가 가장 우위에 있었다. 그 이유는 뭘까 ? 

 

 

source : https://hyeinisfree.tistory.com/26

 

What is Hotspot JIT compiler?

Your application may have millions of lines of code. However only a small subset of code gets executed again & again. This small subset of code (also known as ‘Hotspot’) is responsible for your application performance. At runtime JVM uses this JIT (Just in time) compiler to optimize this hotspot code. Most of the time, code written by the application developers is not optimal. Thus, JVM’s JIT compiler optimizes the developer’s code for better performance.

To do this optimization, JIT compiler uses C1, C2 compiler threads.

 

 

Hotspot JIT 컴파일러는 애플리케이션에서 자주 실행되는 코드("핫스팟")를 런타임에 C1(클라이언트) 및 C2(서버) compiler thread 를 사용해 최적화하여 성능을 향상시키기 때문에 가장 활발하게 동작하기 때문이다.

 

 

 

 

reference : https://medium.com/@RamLakshmanan/jvm-c1-c2-compiler-thread-high-cpu-consumption-b99acc604f1d