ä»åãååã®è¨äºã«ã¤ã¥ããJava8ã«ããå¤æ´ç¹ã§æªã ãã¾ãç´¹ä»ããã¦ããªããã¤ã³ããè¨äºã«ãããã¨æãã ä»åã¯Java8ã®HotSpotVMã®è©±ãJava8ã§ã¯JEP122ãåãè¾¼ã¾ããVMã®ã¡ã¢ãªã¢ãã«ãå¤æ´ããããJEP122ã®ã¿ã¤ãã«ãRemove the Permanent Generationãããæ³åã§ããã¨ãããJava8ã®HotSpotVMããã¯å¾æ¥ã®Permanenté åãç¡ããªã£ãã ãªãããããã£ãå¤æ´ãè¡ãããã®ã ãããï¼ã¾ããå ã Permanenté åã«æ ¼ç´ããã¦ããæ å ±ã¯ä½å¦ã«ãã£ã¦ãã¾ã£ãã®ãï¼JVMä»å±ã®ãã¼ã«ã«ã©ããã£ãå½±é¿ãããã®ãï¼ ä»åã®è¨äºã§ã¯ãã®ç¹ãã¾ã¨ãã¦ãããã¨æãã ãªããHotSpotVMã®ã¡ã¢ãªã¢ãã«ã«ã¤ãã¦è©³ãããªãæ¹ã¯ãå ã«ãã¡ãã®é çªï¼ãè£è¶³ â HotSpotVMã®ã¡ã¢ãªæ§é æ¦èª¬ï¼ãèªãã§ããã ãã¨ã¹ã ã¼ãºã«èªã¿é²ããããã
JavaVMã®ç¶æ³ãç°¡æåºåããjstat Javaã«ã¯ãã°ã©ãã£ã«ã«ãªãã©ããåºåããç°å¢ããªã½ã¼ã¹ããªãå ´åãæ³å®ãããã¼ã«ãç¨æããã¦ãã¾ããjstatï¼Java 1.4以åã¯jvmstatï¼ã¨å¼ã°ãããã¼ã«ã§ãã使ãæ¹ã¯ç°¡åã§ãã jstat -åºåãªãã·ã§ã³ï¼-h[ãããã¼ãåºåããè¡éé]ï¼ [ããã»ã¹çªå·] [åºåééï¼ããªç§ï¼] [注] åºåãªãã·ã§ã³ã«ã¤ãã¦ã¯[Java ä»®æ³ãã·ã³çµ±è¨ãã¼ã¿ç£è¦ãã¼ã«]ãåèã«ãã¦ãã ããã ä¾ãã°ã C:\>jstat -gcutil -h5 6684 1000 ãå ¥åããã¨ã次ã®ããã«åºåããã¾ãã åºåãªãã·ã§ã³: gcutilã§æå®ããããã©ã¼ãããã§ããããã¼ã5è¡ééã1ç§ééã§åºåãã¾ãã S0 S1 E O P YGC YGCT FGC FGCT GCT 87.58 0.00 74.95 69.37 99.47 302 0
ããªãã¨ã¹ã¬ãããã³ã - ã¹ã¬ãããã³ãå ¥é - ãã®å½ã§ã¯ç¬ã ãé常ã«ãããããããèªåã§ããã°ã¨ã³ããªãæ¸ãå¿ è¦ã¯ãªãããOracle Database ã Linux ã®æ§è½åæã«æºããè ã®è¦³ç¹ãã Java ã®ã¹ã¬ãããã³ãã«ã¤ãã¦æ´çãã¦ã¿ããå ·ä½çãªã¹ã¬ãããã³ãã®åææ¹æ³ã¯ãµãã¼ãã¨ã³ã¸ãã¢ãèªãWebLogic Serverãã©ãã«ã·ã¥ã¼ãã®ãã¦ãã¦ãã¨ã¦ãããããããã WebLogic ã®ã¹ã¬ãããã³ãã®è¦æ¹ã«ã¤ãã¦ã¯ id:yamadamn ããã® ã¹ã¬ãããã³ãããè¦ãWebLogic Serverã®ä¸ç #javaee - yamadamnã®ã¯ã¦ãªæ¥è¨ ãããããããã ã¹ã¬ãããã³ãã¨ã¯ Javaã®ã¹ã¬ããã®ã¹ãããã·ã§ããã åå¾ããç¬éã®Javaä»®æ³ãã·ã³(JVM)å ã«åå¨ããã¹ã¬ããï¼IDãååãç¶æ ãã¿ã¤ããªã©ï¼ã¨ã³ã¼ã«ã¹ã¿ãã¯ãè¦ããã¨ãã§ããã
ãã¤ãã£ãã»ã¡ã¢ãªã¼ã»ãã©ããã³ã°(NMT)ã¯ãJava HotSpot VMã®å é¨ã¡ã¢ãªã¼ä½¿ç¨ç¶æ³ã追跡ããJava HotSpot VMæ©è½ã§ããNMTã®ã¹ã³ã¼ããNMTãæå¹ã«ããæ¹æ³ãããã³ãã®ä»ã®ä½¿ç¨ã®è©³ç´°ã¯ããã¤ãã£ãã»ã¡ã¢ãªã¼ã»ãã©ããã³ã°ãåç §ãã¦ãã ããã NMTã§ã¯ãéJVMã³ã¼ãã«ããã¡ã¢ãªã¼ã®å²å½ã¦ã追跡ããªãã®ã§ããã¤ãã£ãã»ã³ã¼ãã®ã¡ã¢ãªã¼ã»ãªã¼ã¯ãæ¤åºããã«ã¯ããªãã¬ã¼ãã£ã³ã°ã»ã·ã¹ãã ã§ãµãã¼ãããããã¼ã«ã®ä½¿ç¨ãå¿ è¦ã«ãªãå ´åãããã¾ãã 次ã®é ã§ã¯ãVMå é¨ã¡ã¢ãªã¼å²å½ã¦ã®ã¢ãã¿ã¼ããã³VMã¡ã¢ãªã¼ã»ãªã¼ã¯ã®è¨ºææ¹æ³ã«ã¤ãã¦èª¬æãã¾ãã NMTã«ããã¡ã¢ãªã¼ã»ãªã¼ã¯ã®æ¤åº VMå é¨ã¡ã¢ãªã¼ãã¢ãã¿ã¼ããæ¹æ³ NMTã®ã¡ã¢ãªã¼ã»ã«ãã´ãª 2.7.1 NMTã«ããã¡ã¢ãªã¼ã»ãªã¼ã¯ã®æ¤åº ã¡ã¢ãªã¼ã»ãªã¼ã¯ãæ¤åºããã«ã¯ã次ã®æé ãå®è¡ãã¾ãã 次ã®ã³ãã³ãã©ã¤
Javaã¢ããªã±ã¼ã·ã§ã³ã¯ã©ã®ãããªè¦ç´ ã§æ§æããã¦ããã ããã¾ã§ã¯ãJavaã«ãã£ã¦å®ç¾ãã¦ããé¨åããJavaã¢ããªã±ã¼ã·ã§ã³ãã¨ãã¦ãã¾ããããåé¡çºçæã«ã¯ããã®æ§æè¦ç´ ã®ãã¡ã®ã©ãã«åé¡ããããã©ãã«åé¡ããªãã®ããåãåããªãã¨ããã¾ããã å³1ãJavaã¢ããªã±ã¼ã·ã§ã³ã®æ§æè¦ç´ Javaã¢ããªã±ã¼ã·ã§ã³ã¯ã大ãããã¢ããªã±ã¼ã·ã§ã³ãã¨ãJavaä»®æ³ãã·ã³ãã«åãããã¾ãï¼å³1ä¸å¤®â ï¼â ãã¾ããã¢ããªã±ã¼ã·ã§ã³ã®ã¢ã¼ããã¯ãã£ã«ãã£ã¦ã¯ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãä¸ã§ã¢ããªã±ã¼ã·ã§ã³ãåããã¾ãï¼å³1å³â ï¼â ã ã¢ããªã±ã¼ã·ã§ã³ï½ãã¾ãã¾ãªãªã½ã¼ã¹ã使ç¨ãã¦ãµã¼ãã¹ãæä¾ãã ã¢ããªã±ã¼ã·ã§ã³ã«ã¯ãããã¾ã§ç´¹ä»ããWebã¢ããªã±ã¼ã·ã§ã³ã ãã§ã¯ãªãããããããã¤ã¯ããµã¼ãã¹ãªã©ããã¾ãã¾ãªå½¢æ ã®ãã®ãããã¾ããã¾ããJavaã ãã§ã¯ãªããJVMä¸ã§åä½ãããã¾ãã¾ãªè¨èªã§ã¢ããª
åé¡ãåãåããããã«ã¯ãæ å ±ãåå¾ããªãã¨ããã¾ãããå®è¡ä¸ã®Javaã¢ããªã±ã¼ã·ã§ã³ããæ å ±ãåå¾ããæ¹æ³ã¯ããããããã¾ããããã使ããã¦ããæ¹æ³ã¨ãã¦ããã°åºåãJMXã¨MBeanããã³ãã®3ã¤ãç´¹ä»ãã¾ãã å³1ããã使ãããæ å ±ã®åå¾æ¹æ³ æ å ±ãåå¾ããæ¹æ³ã¨ãã¦ãã»ãã«ã以ä¸ã®ãããªãã®ãåå¨ãã¾ãã Javaã®ä»æ§ã«åã£ãæ¹æ³ï¼JVMTIï¼Java Virtual Machine Tool Interfaceã使ã£ã¦Java VMã¸æ¥ç¶ããããªã©ï¼ JVMãAPãµã¼ãã®å®è£ ã«åºæã®æ©è½ã使ãæ¹æ³ ããããä¸è¬çã«ä½¿ãããæ¹æ³ã§ã¯ãªãã£ãããå¿ è¦æä½éã®æ å ±ãåå¾ããã«ã¯è² è·ãé«ããã¦å®éç¨ã«èããããªãã£ããã使ç¨ããããã«ã¦ã§ã¢ã«ä¾åããæ©è½ã§ãããããæ¬é£è¼ã§ã¯åãæ±ãã¾ããã ãã°ãåºåãã ãã©ã®ãããªç¶æ³ã§ãã©ã®ãããªå¦çãè¡ã£ãããããã°ã¨ãã¦åºåãããã¨ã¯ãJ
J2EEãããã·ã§ã³ã¯ãªãã£ã«ã«ãªåéã«é©ç¨ãããããã«ãªããJavaã®ããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°ã®éè¦æ§ã¯ããã«é«ã¾ã£ã¦ãã¾ããããã©ã¼ãã³ã¹ãã¥ã¼ãã³ã°ã«ã¯ãã¾ãã¾ãªãã©ã¡ã¼ã¿ãããã¾ãããä¸ã§ãJava VMã«é¢é£ãããã¥ã¼ãã³ã°ã®å¹æã¯å¤§ããã¨ãããã¦ãã¾ããæ¬ç¨¿ã¯ãJava VMã«é¢é£ãããã¥ã¼ãã³ã°ææ³ãå¦ã¶ããã®åæç¥èãæä¾ãããã¨ãç®çã«ãã¦ãã¾ãï¼ç·¨éé¨ï¼ã Java VMã«é¢é£ãããã¥ã¼ãã³ã°ãè¡ããJ2EEã¢ããªã±ã¼ã·ã§ã³ã®ããã©ã¼ãã³ã¹ãä¸ããããã«ã¯ãJava VMã«ã¤ãã¦è©³ããç¥ãå¿ è¦ãããã¾ããæ¬ç¨¿ã¯2åã«æ¸¡ã£ã¦Java VMã®åºæ¬æ§é ã¨åä½åçã詳細ã«è§£èª¬ãã¾ãããå 容ãç解ããããã«ã¯ããã°ã©ã ãã³ã³ãã¥ã¼ã¿ä¸ã§åä½ããåºæ¬åçã¨Java VMã®åºæ¬ç¨èªãç¥ã£ã¦ããå¿ è¦ãããã¾ããJava VMã®åºæ¬ç¨èªã«é¢ãã¦ã¯ããå®è¡ã¹ãã¼ãã«ææ¦ããJavaã¢ã¼ã
Javaã§ãããã°ãã«ãã3ã¤ã®å ´é¢ Javaã¢ããªã±ã¼ã·ã§ã³ã§æ§ç¯ãããã·ã¹ãã ã®é害ãæ§è½åé¡ãçºçããå ´åã大åã¯ãããã¬ããããã¡ã¤ã©ãããã«ã¦ã§ã¢ããµã¼ããã¼ãã£ãæä¾ãããã¼ã«ãç¨ãããã¨ã§è§£æã§ãã¦ãã¾ãã¾ãã ãããã以ä¸ã®ãããªç¶æ³ã§ã¯Javaã®ä¸çããã®ã¢ããã¼ãããã«ãããé常ã®ãããã°ãã¦ãã¦ã使ããªããã¨ãããã¾ãã ããã»ã¹åèµ·åã許ãããªãã·ã¹ãã ã§ã®æ å ±åå¾ããããã¨ã æ¬çªç°å¢ã§ããçºçããããã¹ãç°å¢ã§ãããã°ã§ããªãåé¡ã®å ´å GCï¼ã¬ãã¼ã¸ã»ã³ã¬ã¯ã·ã§ã³ï¼ãã°ï¼-Xloggcãªã©ï¼ã®ããã«ãjavaã³ãã³ãèµ·åãªãã·ã§ã³ãä¸ããªããã°åå¾ã§ããªãæ å ±ãå¿ è¦ãªå ´å ã½ã¼ã¹å¤æ´ã許ãããªãå ´åã«ãç¹å®ç¶æ³ä¸ã®æ å ±ãåå¾ãããã¨ã ããç¹å®ã®ã¡ã½ãããªã©ãå®è¡ãããç¬éã®ã¹ã¬ãããã³ããã¹ã¿ãã¯ãã¬ã¼ã¹ãªã©ãå¿ è¦ãªå ´å ã½ã¼ã¹ã®å¤æ´ãã§ããªããç°å¢ã®å¶ç´ãª
play java ã®ã¢ãã¿ãªã³ã°ããããã¦ãã±ã£ã¨çµã¿åããã¦ã§ãããã®ã ä½ããªãããã¯ãã·ã¨ããã¬ãã«ã§ãzabbixã§ç£è¦ããä½è£ããªãã¨ã客å ã®ç°å¢ã«æ軽ã«ãã£ã¨ããããã¨ããããããç¶æ³åãã Jolokiaã¨hawtioãçµã¿åããã¾ããï¼ã©ã¡ãããã£ã¨é©ãã使ãæ¹ãããæ°ããã¦ãªããªãã»ã»ã»ï¼ https://jolokia.org/index.html http://hawt.io/ Jolokiaã®è¨å® agentã®ãã¦ã³ãã¼ã å ¬å¼ãµã¤ããããjolokia-jvm-x.x.x-agent.jarãå ¥æã https://jolokia.org/download.html playã®èµ·åã¹ã¯ãªããã«javaagentã®è¨å®è¿½å playã®ãã«ãã§ä½ãããã¢ããªã®ã¹ã¯ãªããã®ä¸ã«ããªãã·ã§ã³ã®æ¸¡ãæ¹ã«ã¤ãã¦ã®ã³ã¡ã³ããä¸è¨ã®ããã«ããã¾ãã # jvm options
ããã«ã¡ã¯ã寺岡ã§ãã ãã®è¨äºã¯ TECHSCORE Advent Calendar 2016 ã® 13 æ¥ç®ã®è¨äºã§ãã JConsole 使ã£ã¦ã¾ããï¼ JConsoleã使ãã¨ãCPUãã¡ã¢ãªã®ã¡ããªã¯ã¹ãJMXã®MBeanã使ã£ãã«ã¹ã¿ã ã¡ããªã¯ã¹ã®åå¾ã管çç³»ã®æä½ãå¼ã³åºããã¨ãã§ãã¾ãã JMXã¯JSR3ã¨ããæ´å²ãæããããä»æ§ã ããã£ã¦ãæ¢åã®ãã¬ã¼ã ã¯ã¼ã¯ãã©ã¤ãã©ãªã«ãå¤ãæ¡ç¨ããã¦ãã¾ãã GCãå¼ã³åºããããTomcatã®ã»ãã·ã§ã³æ å ±ãè¦ãããâ¦â¦ããã¨ãªãã§ãã§ãã¦ãã¾ãã¾ãã JConsoleã®å©ç¨æã¯ã対象ã®Javaããã»ã¹å ã§JMX Serverãèµ·åãã¦ããå¿ è¦ãããã¾ãã ãã¼ã«ã«ç°å¢ããããããèµ·åãªãã·ã§ã³ã§JMX Serverã®è¨å®ããã¦ããå ´åãJConsoleãç«ã¡ä¸ãã¦æ¥ç¶å ãé¸æããã ãã§OKã§ãã ä»åã¯ãä½ã®æºåããã¦ããªããµã¼ã
JavaVMãç£è¦ãããã¼ã«ç¾¤ ä»åã¯ãJava EEã¢ããªã±ã¼ã·ã§ã³ããã¥ã¼ãã³ã°ããéã«ä¾¿å©ãªãã¼ã«ãç´¹ä»ãã¾ããJavaVMã®ç¶æ ãç£è¦ï¼ã¬ãã¼ããããã¼ã«ã¯ãããªã¼ã»ã½ããã¦ã¨ã¢ã製åãå«ããããã¤ãæä¾ããã¦ãã¾ããç±³Oracleï¼ç±³Sun Microsystemsï¼ã®Javaç°å¢ã«ããæ¨æºã§ä¾¿å©ãªãã¼ã«ç¾¤ãä»ãã¦ãã¾ããæ¬è¨äºã§ã¯ãæ¨æºãã¼ã«ã§ããjconsoleã¨jstatã®2ã¤ãç´¹ä»ãã¾ãã 表1: 主ãªJavaVMç£è¦ï¼ã¬ãã¼ãã£ã³ã°ã»ãã¼ã« 製åå ç¹å¾´
Java 8 ã§ã Oracle ã® JVM ãåæã¨ãã話ã§ãã Java ã®ã¡ã¢ãªç®¡ç ãããç¥ã£ã¦ãããªãã¨ã OOME ãèµ·ãã£ã¦ããã¡ã¢ãªå ã§ä½ãèµ·ãã£ã¦ãã¦ãã©ãã調æ»ãã¹ãã§ãã©ã®ããã«å¯¾å¦ãããããã®ããå¤æã§ããªãã ãªã®ã§ãã¾ãã¯ããããã Java ãã©ããã£ã¦ã¡ã¢ãªã管çãã¦ããã®ããç¥ãã ããããå®é調ã¹ã¦ã¿ããäºæ³éãã¨ããããªãã¨ããããéãå¤ããªã£ã¦ãã¾ã£ãã ãªã®ã§ãåã ã®ç¨èªã®èª¬æã¯æ«å°¾ã® ç¨èªé ã«æ¼ãè¾¼ããã®ã§ãããã§ã¯ãã£ããã¨ããæ¦è¦ã ãè¨è¼ããã ã¡ã¢ãªã®æ§é è¶ ãã£ããã¨ãããã¡ã¢ãªæ§é ã表ããå³ã ããããããã¼ãï¼Heapï¼é åã¨ãã¤ãã£ãï¼Nativeï¼é åã®ï¼ã¤ã®é åãããã ãã¼ã㯠Java ããã°ã©ã ã使ãé åã§ãããã°ã©ã ä¸ã§çæãããªãã¸ã§ã¯ãã¯ããã®ãã¼ãé åã«é ç½®ãããã ä¸æ¹ããã¤ãã£ãé å㯠JVM ãåãã®ã«å¿ è¦
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}