ããJVM线ç¨å æ æ¯ä¸ä¸ªç»å®æ¶é´çå¿«ç
§ï¼å®è½åä½ æä¾ææ被å建åºæ¥çJava线ç¨çå®æ´æ¸
å.
ããæ¯ä¸ä¸ªè¢«åç°çJava线ç¨é½ä¼ç»ä½ å¦ä¸ä¿¡æ¯:
ããâ 线ç¨çå称ï¼ç»å¸¸è¢«ä¸é´ä»¶ååç¨æ¥è¯å«çº¿ç¨çæ è¯ï¼ä¸è¬è¿ä¼å¸¦ä¸è¢«åé
ç线ç¨æ± å称以åç¶æ (è¿è¡ï¼é»å¡çç.)
ããâ 线ç¨ç±»å & ä¼å
级ï¼ä¾å¦ : daemon prio=3 ** ä¸é´ä»¶ç¨åºä¸è¬ä»¥åå°å®æ¤çå½¢å¼å建ä»ä»¬ç线ç¨ï¼è¿æå³çè¿äºçº¿ç¨æ¯å¨åå°è¿è¡çï¼å®ä»¬ä¼åå®ä»¬çç¨æ·æä¾æå¡ï¼ä¾å¦ï¼åä½ çJava EEåºç¨ç¨åº **
ããâ Java线ç¨IDï¼ä¾å¦ : tid=0x000000011e52a800 ** è¿æ¯éè¿ java.lang.Thread.getId() è·å¾çJava线ç¨IDï¼å®å¸¸å¸¸ç¨èªå¢é¿çé¿æ´å½¢ 1..n** å®ç°
ããâ åç线ç¨IDï¼ä¾å¦ : nid=0x251c** ï¼ä¹æ以å
³é®æ¯å 为åç线ç¨IDå¯ä»¥è®©ä½ è·å¾è¯¸å¦ä»æä½ç³»ç»çè§åº¦æ¥çé£ä¸ªçº¿ç¨å¨ä½ çJVMä¸ä½¿ç¨äºå¤§é¨åçCPUæ¶é´çè¿æ ·çç¸å
³ä¿¡æ¯. **
ããâ Java线ç¨ç¶æå详ç»ä¿¡æ¯ï¼ä¾å¦: waiting for monitor entry [0xfffffffea5afb000] java.lang.Thread.State: BLOCKED (on object monitor)
ãã** å¯ä»¥å¿«éçäºè§£å°çº¿ç¨ç¶ææå
¶å½åé»å¡çå¯è½åå **
ããâ Java线ç¨æ è·è¸ªï¼è¿æ¯ç®å为æ¢ä½ è½ä»çº¿ç¨å æ ä¸æ¾å°çæéè¦çæ°æ®. è¿ä¹æ¯ä½ è±è´¹æå¤åææ¶é´çå°æ¹ï¼å 为Javaæ è·è¸ªåæä¾äºä½ å°ä¼å¨ç¨åçç»ä¹ ç¯èäºè§£å°ç导è´è¯¸å¤ç±»åçé®é¢çæ ¹æ¬åå ï¼æéè¦ç90%çä¿¡æ¯ã
ããâ Java å å
åå解; ä»HotSpot VM 1.6çæ¬å¼å§ï¼å¨çº¿ç¨å æ çæ«å°¾å¤å¯ä»¥çå°HotSpotçå
å使ç¨æ
åµï¼æ¯å¦è¯´Javaçå å
å(YoungGen, OldGen) & PermGen 空é´ãè¿ä¸ªä¿¡æ¯å¯¹åæç±äºé¢ç¹GCèå¼èµ·çé®é¢æ¶ï¼æ¯å¾æç¨çãä½ å¯ä»¥ä½¿ç¨å·²ç¥ç线ç¨æ°æ®æ模å¼åä¸ä¸ªå¿«éçå®ä½ã
ããHeap
ããPSYoungGen total 466944K, used 178734K [0xffffffff45c00000, 0xffffffff70800000, 0xffffffff70800000)
ããeden space 233472K, 76% used [0xffffffff45c00000,0xffffffff50ab7c50,0xffffffff54000000)
ããfrom space 233472K, 0% used [0xffffffff62400000,0xffffffff62400000,0xffffffff70800000)
ããto space 233472K, 0% used [0xffffffff54000000,0xffffffff54000000,0xffffffff62400000)
ããPSOldGen total 1400832K, used 1400831K [0xfffffffef0400000, 0xffffffff45c00000, 0xffffffff45c00000)
ããobject space 1400832K, 99% used [0xfffffffef0400000,0xffffffff45bfffb8,0xffffffff45c00000)
ããPSPermGen total 262144K, used 248475K [0xfffffffed0400000, 0xfffffffee0400000, 0xfffffffef0400000)
ããobject space 262144K, 94% used [0xfffffffed0400000,0xfffffffedf6a6f08,0xfffffffee0400000)
ãã线ç¨å æ ä¿¡æ¯å¤§æ解
ãã为äºè®©å¤§å®¶æ´å¥½çç解ï¼ç»å¤§å®¶æä¾äºä¸é¢çè¿å¼ å¾ï¼å¨è¿å¼ å¾ä¸å°HotSpot VMä¸ç线ç¨å æ ä¿¡æ¯å线ç¨æ± åäºè¯¦ç»çæ解ï¼å¦ä¸å¾æ示ï¼
ããä¸å¾ä¸å¯ä»¥çåºçº¿ç¨å æ æ¯ç±å¤ä¸ªä¸åé¨åç»æçãè¿äºä¿¡æ¯å¯¹é®é¢åæé½å¾éè¦ï¼ä½å¯¹ä¸åçé®é¢æ¨¡å¼çåæä¼ä½¿ç¨ä¸åçé¨åï¼é®é¢æ¨¡å¼ä¼å¨åé¢çæç« ä¸å模æåæ¼ç¤ºãï¼
ããç°å¨éè¿è¿ä¸ªåææ ·ä¾ï¼ç»å¤§å®¶è¯¦ç»è§£éä¸ä¸HoteSpotä¸çº¿ç¨å æ ä¿¡æ¯ä¸çå个ç»æé¨åï¼
ãã# Full thread dumpæ 示符
ããâFull thread dumpâæ¯ä¸ä¸ªå
¨å±å¯ä¸çå
³é®åï¼ä½ å¯ä»¥å¨ä¸é´ä»¶ååæºçæ¬Javaç线ç¨å æ ä¿¡æ¯çè¾åºæ¥å¿ä¸æ¾å°å®ï¼æ¯å¦è¯´å¨UNIXä¸ä½¿ç¨ï¼kill -3 <PID> ï¼ãè¿æ¯çº¿ç¨å æ å¿«ç
§çå¼å§é¨åã
ããFull thread dump Java HotSpot(TM) 64-Bit Server VM (20.0-b11 mixed mode):
ãã# Java EE ä¸é´ä»¶,第ä¸æ¹ä»¥åèªå®ä¹åºç¨è½¯ä»¶ä¸ç线ç¨
ããè¿ä¸ªé¨åæ¯æ´ä¸ªçº¿ç¨å æ çæ ¸å¿é¨åï¼ä¹æ¯é常éè¦è±è´¹æå¤åææ¶é´çé¨åãå æ ä¸çº¿ç¨ç个æ°åå³ä½ 使ç¨çä¸é´ä»¶ï¼ç¬¬ä¸æ¹åºï¼å¯è½ä¼æç¬ç«çº¿ç¨ï¼ä»¥åä½ çåºç¨ç¨åºï¼å¦æå建èªå®ä¹çº¿ç¨ï¼è¿é常ä¸æ¯ä¸ä¸ªå¾å¥½çå®è·µï¼ã
ããå¨æ们ç示ä¾çº¿ç¨å æ ä¸ï¼WebLogicæ¯æ们æ使ç¨çä¸é´ä»¶ãä»Weblogic 9.2å¼å§, ä¼ä½¿ç¨ä¸ä¸ªç¨ââweblogic.kernel.Default (self-tuning)âå¯ä¸æ è¯çè½èªè¡ç®¡çç线ç¨æ±
ãã"[STANDBY] ExecuteThread: '414' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=3 tid=0x000000010916a800 nid=0x2613 in Object.wait() [0xfffffffe9edff000]
ããjava.lang.Thread.State: WAITING (on object monitor)
ããat java.lang.Object.wait(Native Method)
ãã- waiting on <0xffffffff27d44de0> (a weblogic.work.ExecuteThread)
ããat java.lang.Object.wait(Object.java:485)
ããat weblogic.work.ExecuteThread.waitForRequest(ExecuteThread.java:160)
ãã- locked <0xffffffff27d44de0> (a weblogic.work.ExecuteThread)
ããat weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
ãã# HotSpot VM 线ç¨
ããè¿æ¯ä¸ä¸ªæHotspot VM管ççå
é¨çº¿ç¨ï¼ç¨äºæ§è¡å
é¨çåçæä½ãä¸è¬ä½ ä¸ç¨å¯¹æ¤æ太å¤å¿ï¼é¤éä½ (éè¿ç¸å
³ç线ç¨å æ 以å prstatæè
åç线ç¨Id)åç°å¾é«çCPUå ç¨ç.
ãã"VM Periodic Task Thread" prio=3 tid=0x0000000101238800 nid=0x19 waiting on condition
ãã# HotSpot GC 线ç¨
ããå½ä½¿ç¨ HotSpot è¿è¡å¹¶è¡ GC (å¦ä»å¨ä½¿ç¨å¤ä¸ªç©çæ ¸å¿çç¯å¢ä¸å¾å¸¸è§), é»è®¤å建çHotSpot VM æè
æ¯ä¸ªJVM管çä¸ä¸ªæç¹å®æ è¯çGC线ç¨æ¶. è¿äºGC线ç¨å¯ä»¥è®©VM以并è¡çæ¹å¼æ§è¡å
¶å¨ææ§çGCæ¸
ç, è¿ä¼å¯¼è´GCæ¶é´çæ»ä½åå°ï¼ä¸æ¤åæ¶ç代价æ¯CPUç使ç¨æ¶é´ä¼å¢å .
ãã"GC task thread#0 (ParallelGC)" prio=3 tid=0x0000000100120000 nid=0x3 runnable
ãã"GC task thread#1 (ParallelGC)" prio=3 tid=0x0000000100131000 nid=0x4 runnable
ããâ¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦â¦
ããè¿äºé常å
³é®çæ°æ®ï¼å 为å½ä½ éå°è·GCæå
³çé®é¢ï¼è¯¸å¦è¿åº¦GCãå
åæ³é²çé®é¢æ¯ï¼ä½ å°å¯ä»¥å©ç¨è¿äºçº¿ç¨çåçIdå¼å
³èçæä½ç³»ç»æè
Java线ç¨ï¼è¿èåç°ä»»ä½å¯¹CPIæ¶é´çé«å ç¨. æªæ¥çæç« ä½ å°ä¼äºè§£å°å¦ä½è¯å«å¹¶è¯æè¿æ ·çé®é¢.
ãã# JNI å
¨å±å¼ç¨è®¡æ°
ããJNI (Java æ¬å°æ¥å£)çå
¨å±å¼ç¨å°±æ¯ä»æ¬å°ä»£ç å°ç±Javaåå¾æ¶éå¨ç®¡ççJava对象çåºæ¬ç对象å¼ç¨. å®çè§è²å°±æ¯é»æ¢å¯¹ä»ç¶å¨è¢«æ¬å°ä»£ç 使ç¨ï¼ä½æ¯ææ¯ä¸å·²ç»ä¸æ¯Java代ç ä¸çâæ´»å¨çâå¼ç¨äºç对象çåå¾æ¶é.
ããåæ¶ä¸ºäºä¾¦æµJNIç¸å
³çæ³é²èçæJNIå¼ç¨ä¹å¾éè¦. å¦æä½ çç¨åºç´æ¥ä½¿ç¨äºJNIï¼æè
åçå¬å¨è¿æ ·ç第ä¸æ¹å·¥å
·ï¼å°±å®¹æé ææ¬å°çå
åæ³é².
ããJNI global references: 1925
ãã# Java å æ 使ç¨è§å¾
ããè¿äºæ°æ®è¢«æ·»å åäº JDK 1 .6 ï¼åä½ æä¾æå
³Hotspotå æ çä¸ä¸ªç®çèå¿«éçè§å¾. æåç°å®å¨å½æå¤ç带æè¿é«CPUå ç¨çGCç¸å
³çé®é¢æ¶é常æç¨ï¼ä½ å¯ä»¥å¨ä¸ä¸ªåç¬çå¿«ç
§ä¸åæ¶çå°çº¿ç¨å æ 以åJavaå çä¿¡æ¯ï¼è®©ä½ å½æ¶å°±å¯ä»¥å¨ä¸ä¸ªç¹å®çJavaå å
å空é´ä¸è§£æï¼æè
æé¤ï¼åºä»»ä½çå
³é®ç¹. ä½ å¦å¨æ们ç示ä¾çº¿ç¨å æ ä¸æè§ï¼Java çå OldGen è¶
åºäºæ大å¼!
ããHeap
ããPSYoungGen total 466944K, used 178734K [0xffffffff45c00000, 0xffffffff70800000, 0xffffffff70800000)
ããeden space 233472K, 76% used [0xffffffff45c00000,0xffffffff50ab7c50,0xffffffff54000000)
ããfrom space 233472K, 0% used [0xffffffff62400000,0xffffffff62400000,0xffffffff70800000)
ããto space 233472K, 0% used [0xffffffff54000000,0xffffffff54000000,0xffffffff62400000)
ããPSOldGen total 1400832K, used 1400831K [0xfffffffef0400000, 0xffffffff45c00000, 0xffffffff45c00000)
ããobject space 1400832K, 99% used [0xfffffffef0400000,0xffffffff45bfffb8,0xffffffff45c00000)
ããPSPermGen total 262144K, used 248475K [0xfffffffed0400000, 0xfffffffee0400000, 0xfffffffef0400000)
ããobject space 262144K, 94% used [0xfffffffed0400000,0xfffffffedf6a6f08,0xfffffffee0400000)
ããæå¸æè¿ç¯æç« è½å¯¹ä½ ç解Hotspot VM线ç¨å æ çåºæ¬ä¿¡æ¯ææ帮å©ã
温馨提示:内容为网友见解,仅供参考