{"id":1707,"date":"2024-05-08T18:06:23","date_gmt":"2024-05-08T10:06:23","guid":{"rendered":"http:\/\/oneai.eu.org\/?p=1707"},"modified":"2024-05-08T18:06:23","modified_gmt":"2024-05-08T10:06:23","slug":"jvm%e7%b3%bb%e5%88%97%e4%b8%89jvm%e5%8f%82%e6%95%b0%e8%ae%be%e7%bd%ae%e3%80%81%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/oneai.eu.org\/?p=1707","title":{"rendered":"JVM\u7cfb\u5217\u4e09:JVM\u53c2\u6570\u8bbe\u7f6e\u3001\u5206\u6790"},"content":{"rendered":"<div id=\"cnblogs_post_body\" class=\"blogpost-body blogpost-body-html\">\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u4e0d\u7ba1\u662fYGC\u8fd8\u662fFull GC,GC\u8fc7\u7a0b\u4e2d\u90fd\u4f1a\u5bf9\u5bfc\u81f4\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u4e2d\u65ad,\u6b63\u786e\u7684\u9009\u62e9<a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/04\/2037029.html\" target=\"_blank\" rel=\"noopener\">\u4e0d\u540c\u7684GC\u7b56\u7565<\/a>,\u8c03\u6574JVM\u3001GC\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u6781\u5927\u7684\u51cf\u5c11\u7531\u4e8eGC\u5de5\u4f5c\uff0c\u800c\u5bfc\u81f4\u7684\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u65ad\u65b9\u9762\u7684\u95ee\u9898\uff0c\u8fdb\u800c\u9002\u5f53\u7684\u63d0\u9ad8Java\u7a0b\u5e8f\u7684\u5de5\u4f5c\u6548\u7387\u3002\u4f46\u662f\u8c03\u6574GC\u662f\u4ee5\u4e2a\u6781\u4e3a\u590d\u6742\u7684\u8fc7\u7a0b\uff0c\u7531\u4e8e\u5404\u4e2a\u7a0b\u5e8f\u5177\u5907\u4e0d\u540c\u7684\u7279\u70b9\uff0c\u5982\uff1aweb\u548cGUI\u7a0b\u5e8f\u5c31\u6709\u5f88\u5927\u533a\u522b\uff08Web\u53ef\u4ee5\u9002\u5f53\u7684\u505c\u987f\uff0c\u4f46GUI\u505c\u987f\u662f\u5ba2\u6237\u65e0\u6cd5\u63a5\u53d7\u7684\uff09\uff0c\u800c\u4e14\u7531\u4e8e\u8dd1\u5728\u5404\u4e2a\u673a\u5668\u4e0a\u7684\u914d\u7f6e\u4e0d\u540c\uff08\u4e3b\u8981cup\u4e2a\u6570\uff0c\u5185\u5b58\u4e0d\u540c\uff09\uff0c\u6240\u4ee5\u4f7f\u7528\u7684GC\u79cd\u7c7b\u4e5f\u4f1a\u4e0d\u540c(\u5982\u4f55\u9009\u62e9\u89c1<a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/04\/2037029.html\" target=\"_blank\" rel=\"noopener\">GC\u79cd\u7c7b\u53ca\u5982\u4f55\u9009\u62e9<\/a>)\u3002\u672c\u6587\u5c06\u6ce8\u91cd\u4ecb\u7ecdJVM\u3001GC\u7684\u4e00\u4e9b\u91cd\u8981\u53c2\u6570\u7684\u8bbe\u7f6e\u6765\u63d0\u9ad8\u7cfb\u7edf\u7684\u6027\u80fd\u3002  <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JVM\u5185\u5b58\u7ec4\u6210\u53caGC\u76f8\u5173\u5185\u5bb9\u8bf7\u89c1\u4e4b\u524d\u7684\u6587\u7ae0:<a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/04\/2036387.html\" target=\"_blank\" rel=\"noopener\">JVM\u5185\u5b58\u7ec4\u6210<\/a>&nbsp;<a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/04\/2037056.html\" rel=\"noopener\">GC\u7b56\u7565&amp;\u5185\u5b58\u7533\u8bf7<\/a>\u3002  <\/p>\n<p><strong>JVM\u53c2\u6570\u7684\u542b\u4e49 <\/strong>\u5b9e\u4f8b\u89c1<a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/05\/2038331.html\" rel=\"noopener\">\u5b9e\u4f8b\u5206\u6790<\/a> <\/p>\n<div class=\"table-wrapper\">\n<table style=\"border-collapse: collapse\" border=\"1\" cellspacing=\"0\" width=\"890\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"263\"><strong>\u53c2\u6570\u540d\u79f0<\/strong><\/td>\n<td valign=\"top\" width=\"193\"><strong>\u542b\u4e49<\/strong><\/td>\n<td valign=\"top\" width=\"86\"><strong>\u9ed8\u8ba4\u503c<\/strong><\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-Xms<\/td>\n<td valign=\"top\" width=\"193\">\u521d\u59cb\u5806\u5927\u5c0f<\/td>\n<td valign=\"top\" width=\"86\">\u7269\u7406\u5185\u5b58\u76841\/64(&lt;1GB)<\/td>\n<td valign=\"top\" width=\"346\">\u9ed8\u8ba4(MinHeapFreeRatio\u53c2\u6570\u53ef\u4ee5\u8c03\u6574)\u7a7a\u4f59\u5806\u5185\u5b58\u5c0f\u4e8e40%\u65f6\uff0cJVM\u5c31\u4f1a\u589e\u5927\u5806\u76f4\u5230-Xmx\u7684\u6700\u5927\u9650\u5236.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-Xmx<\/td>\n<td valign=\"top\" width=\"193\">\u6700\u5927\u5806\u5927\u5c0f<\/td>\n<td valign=\"top\" width=\"86\">\u7269\u7406\u5185\u5b58\u76841\/4(&lt;1GB)<\/td>\n<td valign=\"top\" width=\"346\">\u9ed8\u8ba4(MaxHeapFreeRatio\u53c2\u6570\u53ef\u4ee5\u8c03\u6574)\u7a7a\u4f59\u5806\u5185\u5b58\u5927\u4e8e70%\u65f6\uff0cJVM\u4f1a\u51cf\u5c11\u5806\u76f4\u5230 -Xms\u7684\u6700\u5c0f\u9650\u5236<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-Xmn<\/td>\n<td valign=\"top\" width=\"193\">\u5e74\u8f7b\u4ee3\u5927\u5c0f(1.4or lator)<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\"><strong>\u6ce8\u610f<\/strong>\uff1a\u6b64\u5904\u7684\u5927\u5c0f\u662f\uff08eden+ 2 survivor space).\u4e0ejmap -heap\u4e2d\u663e\u793a\u7684New gen\u662f\u4e0d\u540c\u7684\u3002<br \/>\u6574\u4e2a\u5806\u5927\u5c0f=\u5e74\u8f7b\u4ee3\u5927\u5c0f + \u5e74\u8001\u4ee3\u5927\u5c0f + \u6301\u4e45\u4ee3\u5927\u5c0f.<br \/>\u589e\u5927\u5e74\u8f7b\u4ee3\u540e,\u5c06\u4f1a\u51cf\u5c0f\u5e74\u8001\u4ee3\u5927\u5c0f.\u6b64\u503c\u5bf9\u7cfb\u7edf\u6027\u80fd\u5f71\u54cd\u8f83\u5927,Sun\u5b98\u65b9\u63a8\u8350\u914d\u7f6e\u4e3a\u6574\u4e2a\u5806\u76843\/8<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:NewSize<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6e\u5e74\u8f7b\u4ee3\u5927\u5c0f(for 1.3\/1.4)<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:MaxNewSize<\/td>\n<td valign=\"top\" width=\"193\">\u5e74\u8f7b\u4ee3\u6700\u5927\u503c(for 1.3\/1.4)<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:PermSize<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6e\u6301\u4e45\u4ee3(perm gen)\u521d\u59cb\u503c<\/td>\n<td valign=\"top\" width=\"86\">\u7269\u7406\u5185\u5b58\u76841\/64<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:MaxPermSize<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6e\u6301\u4e45\u4ee3\u6700\u5927\u503c<\/td>\n<td valign=\"top\" width=\"86\">\u7269\u7406\u5185\u5b58\u76841\/4<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-Xss<\/td>\n<td valign=\"top\" width=\"193\">\u6bcf\u4e2a\u7ebf\u7a0b\u7684\u5806\u6808\u5927\u5c0f<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">JDK5.0\u4ee5\u540e\u6bcf\u4e2a\u7ebf\u7a0b\u5806\u6808\u5927\u5c0f\u4e3a1M,\u4ee5\u524d\u6bcf\u4e2a\u7ebf\u7a0b\u5806\u6808\u5927\u5c0f\u4e3a256K.\u66f4\u5177\u5e94\u7528\u7684\u7ebf\u7a0b\u6240\u9700\u5185\u5b58\u5927\u5c0f\u8fdb\u884c \u8c03\u6574.\u5728\u76f8\u540c\u7269\u7406\u5185\u5b58\u4e0b,\u51cf\u5c0f\u8fd9\u4e2a\u503c\u80fd\u751f\u6210\u66f4\u591a\u7684\u7ebf\u7a0b.\u4f46\u662f\u64cd\u4f5c\u7cfb\u7edf\u5bf9\u4e00\u4e2a\u8fdb\u7a0b\u5185\u7684\u7ebf\u7a0b\u6570\u8fd8\u662f\u6709\u9650\u5236\u7684,\u4e0d\u80fd\u65e0\u9650\u751f\u6210,\u7ecf\u9a8c\u503c\u57283000~5000\u5de6\u53f3<br \/>\u4e00\u822c\u5c0f\u7684\u5e94\u7528\uff0c \u5982\u679c\u6808\u4e0d\u662f\u5f88\u6df1\uff0c \u5e94\u8be5\u662f128k\u591f\u7528\u7684 \u5927\u7684\u5e94\u7528\u5efa\u8bae\u4f7f\u7528256k\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u6027\u80fd\u5f71\u54cd\u6bd4\u8f83\u5927\uff0c\u9700\u8981\u4e25\u683c\u7684\u6d4b\u8bd5\u3002\uff08\u6821\u957f\uff09<br \/>\u548cthreadstacksize\u9009\u9879\u89e3\u91ca\u5f88\u7c7b\u4f3c,\u5b98\u65b9\u6587\u6863\u4f3c\u4e4e\u6ca1\u6709\u89e3\u91ca,\u5728\u8bba\u575b\u4e2d\u6709\u8fd9\u6837\u4e00\u53e5\u8bdd:\"\u201d<br \/>-Xss is translated in a VM flag named ThreadStackSize\u201d<br \/>\u4e00\u822c\u8bbe\u7f6e\u8fd9\u4e2a\u503c\u5c31\u53ef\u4ee5\u4e86\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-<em>XX:ThreadStackSize<\/em><\/td>\n<td valign=\"top\" width=\"193\">Thread Stack Size<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">(0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.]<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:NewRatio<\/td>\n<td valign=\"top\" width=\"193\">\u5e74\u8f7b\u4ee3(\u5305\u62ecEden\u548c\u4e24\u4e2aSurvivor\u533a)\u4e0e\u5e74\u8001\u4ee3\u7684\u6bd4\u503c(\u9664\u53bb\u6301\u4e45\u4ee3)<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">-XX:NewRatio=4\u8868\u793a\u5e74\u8f7b\u4ee3\u4e0e\u5e74\u8001\u4ee3\u6240\u5360\u6bd4\u503c\u4e3a1:4,\u5e74\u8f7b\u4ee3\u5360\u6574\u4e2a\u5806\u6808\u76841\/5<br \/>Xms=Xmx\u5e76\u4e14\u8bbe\u7f6e\u4e86Xmn\u7684\u60c5\u51b5\u4e0b\uff0c\u8be5\u53c2\u6570\u4e0d\u9700\u8981\u8fdb\u884c\u8bbe\u7f6e\u3002<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:SurvivorRatio<\/td>\n<td valign=\"top\" width=\"193\">Eden\u533a\u4e0eSurvivor\u533a\u7684\u5927\u5c0f\u6bd4\u503c<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">\u8bbe\u7f6e\u4e3a8,\u5219\u4e24\u4e2aSurvivor\u533a\u4e0e\u4e00\u4e2aEden\u533a\u7684\u6bd4\u503c\u4e3a2:8,\u4e00\u4e2aSurvivor\u533a\u5360\u6574\u4e2a\u5e74\u8f7b\u4ee3\u76841\/10<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:LargePageSizeInBytes<\/td>\n<td valign=\"top\" width=\"193\">\u5185\u5b58\u9875\u7684\u5927\u5c0f\u4e0d\u53ef\u8bbe\u7f6e\u8fc7\u5927\uff0c \u4f1a\u5f71\u54cdPerm\u7684\u5927\u5c0f<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">=128m<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseFastAccessorMethods<\/td>\n<td valign=\"top\" width=\"193\">\u539f\u59cb\u7c7b\u578b\u7684\u5feb\u901f\u4f18\u5316<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+DisableExplicitGC<\/td>\n<td valign=\"top\" width=\"193\">\u5173\u95edSystem.gc()<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">\u8fd9\u4e2a\u53c2\u6570\u9700\u8981\u4e25\u683c\u7684\u6d4b\u8bd5<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:MaxTenuringThreshold<\/td>\n<td valign=\"top\" width=\"193\">\u5783\u573e\u6700\u5927\u5e74\u9f84<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">\u5982\u679c\u8bbe\u7f6e\u4e3a0\u7684\u8bdd,\u5219\u5e74\u8f7b\u4ee3\u5bf9\u8c61\u4e0d\u7ecf\u8fc7Survivor\u533a,\u76f4\u63a5\u8fdb\u5165\u5e74\u8001\u4ee3. \u5bf9\u4e8e\u5e74\u8001\u4ee3\u6bd4\u8f83\u591a\u7684\u5e94\u7528,\u53ef\u4ee5\u63d0\u9ad8\u6548\u7387.\u5982\u679c\u5c06\u6b64\u503c\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u8f83\u5927\u503c,\u5219\u5e74\u8f7b\u4ee3\u5bf9\u8c61\u4f1a\u5728Survivor\u533a\u8fdb\u884c\u591a\u6b21\u590d\u5236,\u8fd9\u6837\u53ef\u4ee5\u589e\u52a0\u5bf9\u8c61\u518d\u5e74\u8f7b\u4ee3\u7684\u5b58\u6d3b \u65f6\u95f4,\u589e\u52a0\u5728\u5e74\u8f7b\u4ee3\u5373\u88ab\u56de\u6536\u7684\u6982\u7387<br \/>\u8be5\u53c2\u6570\u53ea\u6709\u5728\u4e32\u884cGC\u65f6\u624d\u6709\u6548.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+AggressiveOpts<\/td>\n<td valign=\"top\" width=\"193\">\u52a0\u5feb\u7f16\u8bd1<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseBiasedLocking<\/td>\n<td valign=\"top\" width=\"193\">\u9501\u673a\u5236\u7684\u6027\u80fd\u6539\u5584<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-Xnoclassgc<\/td>\n<td valign=\"top\" width=\"193\">\u7981\u7528\u5783\u573e\u56de\u6536<\/td>\n<td valign=\"top\" width=\"86\">&nbsp;<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:SoftRefLRUPolicyMSPerMB<\/td>\n<td valign=\"top\" width=\"193\">\u6bcf\u5146\u5806\u7a7a\u95f2\u7a7a\u95f4\u4e2dSoftReference\u7684\u5b58\u6d3b\u65f6\u95f4<\/td>\n<td valign=\"top\" width=\"86\">1s<\/td>\n<td valign=\"top\" width=\"346\">softly reachable objects will remain alive for some amount of time after the last time they were referenced. The default value is one second of lifetime per free megabyte in the heap<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:PretenureSizeThreshold<\/td>\n<td valign=\"top\" width=\"193\">\u5bf9\u8c61\u8d85\u8fc7\u591a\u5927\u662f\u76f4\u63a5\u5728\u65e7\u751f\u4ee3\u5206\u914d<\/td>\n<td valign=\"top\" width=\"86\">0<\/td>\n<td valign=\"top\" width=\"346\">\u5355\u4f4d\u5b57\u8282 \u65b0\u751f\u4ee3\u91c7\u7528Parallel Scavenge GC\u65f6\u65e0\u6548<br \/>\u53e6\u4e00\u79cd\u76f4\u63a5\u5728\u65e7\u751f\u4ee3\u5206\u914d\u7684\u60c5\u51b5\u662f\u5927\u7684\u6570\u7ec4\u5bf9\u8c61,\u4e14\u6570\u7ec4\u4e2d\u65e0\u5916\u90e8\u5f15\u7528\u5bf9\u8c61.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:TLABWasteTargetPercent<\/td>\n<td valign=\"top\" width=\"193\">TLAB\u5360eden\u533a\u7684\u767e\u5206\u6bd4<\/td>\n<td valign=\"top\" width=\"86\">1%<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+<em>CollectGen0First<\/em><\/td>\n<td valign=\"top\" width=\"193\">FullGC\u65f6\u662f\u5426\u5148YGC<\/td>\n<td valign=\"top\" width=\"86\">false<\/td>\n<td valign=\"top\" width=\"346\">&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>\u5e76\u884c\u6536\u96c6\u5668\u76f8\u5173\u53c2\u6570<\/strong><\/p>\n<div class=\"table-wrapper\">\n<table style=\"border-collapse: collapse\" border=\"1\" cellspacing=\"0\" width=\"889\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseParallelGC<\/td>\n<td valign=\"top\" width=\"193\">Full GC\u91c7\u7528parallel MSC<br \/>(\u6b64\u9879\u5f85\u9a8c\u8bc1)<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\n<p>\u9009\u62e9\u5783\u573e\u6536\u96c6\u5668\u4e3a\u5e76\u884c\u6536\u96c6\u5668.\u6b64\u914d\u7f6e\u4ec5\u5bf9\u5e74\u8f7b\u4ee3\u6709\u6548.\u5373\u4e0a\u8ff0\u914d\u7f6e\u4e0b,\u5e74\u8f7b\u4ee3\u4f7f\u7528\u5e76\u53d1\u6536\u96c6,\u800c\u5e74\u8001\u4ee3\u4ecd\u65e7\u4f7f\u7528\u4e32\u884c\u6536\u96c6.(\u6b64\u9879\u5f85\u9a8c\u8bc1)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseParNewGC<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6e\u5e74\u8f7b\u4ee3\u4e3a\u5e76\u884c\u6536\u96c6<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\u53ef\u4e0eCMS\u6536\u96c6\u540c\u65f6\u4f7f\u7528<br \/>JDK5.0\u4ee5\u4e0a,JVM\u4f1a\u6839\u636e\u7cfb\u7edf\u914d\u7f6e\u81ea\u884c\u8bbe\u7f6e,\u6240\u4ee5\u65e0\u9700\u518d\u8bbe\u7f6e\u6b64\u503c<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:ParallelGCThreads<\/td>\n<td valign=\"top\" width=\"193\">\u5e76\u884c\u6536\u96c6\u5668\u7684\u7ebf\u7a0b\u6570<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\u6b64\u503c\u6700\u597d\u914d\u7f6e\u4e0e\u5904\u7406\u5668\u6570\u76ee\u76f8\u7b49 \u540c\u6837\u9002\u7528\u4e8eCMS<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseParallelOldGC<\/td>\n<td valign=\"top\" width=\"193\">\u5e74\u8001\u4ee3\u5783\u573e\u6536\u96c6\u65b9\u5f0f\u4e3a\u5e76\u884c\u6536\u96c6(Parallel Compacting)<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\u8fd9\u4e2a\u662fJAVA 6\u51fa\u73b0\u7684\u53c2\u6570\u9009\u9879<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:MaxGCPauseMillis<\/td>\n<td valign=\"top\" width=\"193\">\u6bcf\u6b21\u5e74\u8f7b\u4ee3\u5783\u573e\u56de\u6536\u7684\u6700\u957f\u65f6\u95f4(\u6700\u5927\u6682\u505c\u65f6\u95f4)<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\u5982\u679c\u65e0\u6cd5\u6ee1\u8db3\u6b64\u65f6\u95f4,JVM\u4f1a\u81ea\u52a8\u8c03\u6574\u5e74\u8f7b\u4ee3\u5927\u5c0f,\u4ee5\u6ee1\u8db3\u6b64\u503c.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseAdaptiveSizePolicy<\/td>\n<td valign=\"top\" width=\"193\">\u81ea\u52a8\u9009\u62e9\u5e74\u8f7b\u4ee3\u533a\u5927\u5c0f\u548c\u76f8\u5e94\u7684Survivor\u533a\u6bd4\u4f8b<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\u8bbe\u7f6e\u6b64\u9009\u9879\u540e,\u5e76\u884c\u6536\u96c6\u5668\u4f1a\u81ea\u52a8\u9009\u62e9\u5e74\u8f7b\u4ee3\u533a\u5927\u5c0f\u548c\u76f8\u5e94\u7684Survivor\u533a\u6bd4\u4f8b,\u4ee5\u8fbe\u5230\u76ee\u6807\u7cfb\u7edf\u89c4\u5b9a\u7684\u6700\u4f4e\u76f8\u5e94\u65f6\u95f4\u6216\u8005\u6536\u96c6\u9891\u7387\u7b49,\u6b64\u503c\u5efa\u8bae\u4f7f\u7528\u5e76\u884c\u6536\u96c6\u5668\u65f6,\u4e00\u76f4\u6253\u5f00.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:GCTimeRatio<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6e\u5783\u573e\u56de\u6536\u65f6\u95f4\u5360\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4\u7684\u767e\u5206\u6bd4<\/td>\n<td valign=\"top\" width=\"87\">&nbsp;<\/td>\n<td valign=\"top\" width=\"344\">\u516c\u5f0f\u4e3a1\/(1+n)<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+<em>ScavengeBeforeFullGC<\/em><\/td>\n<td valign=\"top\" width=\"193\">Full GC\u524d\u8c03\u7528YGC<\/td>\n<td valign=\"top\" width=\"87\">true<\/td>\n<td valign=\"top\" width=\"344\">Do young generation GC prior to a full GC. (Introduced in 1.4.1.)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>CMS\u76f8\u5173\u53c2\u6570<\/strong><\/p>\n<div class=\"table-wrapper\">\n<table style=\"border-collapse: collapse\" border=\"1\" cellspacing=\"0\" width=\"886\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseConcMarkSweepGC<\/td>\n<td valign=\"top\" width=\"193\">\u4f7f\u7528CMS\u5185\u5b58\u6536\u96c6<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">\u6d4b\u8bd5\u4e2d\u914d\u7f6e\u8fd9\u4e2a\u4ee5\u540e,-XX:NewRatio=4\u7684\u914d\u7f6e\u5931\u6548\u4e86,\u539f\u56e0\u4e0d\u660e.\u6240\u4ee5,\u6b64\u65f6\u5e74\u8f7b\u4ee3\u5927\u5c0f\u6700\u597d\u7528-Xmn\u8bbe\u7f6e.???<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+AggressiveHeap<\/td>\n<td valign=\"top\" width=\"193\">&nbsp;<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">\u8bd5\u56fe\u662f\u4f7f\u7528\u5927\u91cf\u7684\u7269\u7406\u5185\u5b58<br \/>\u957f\u65f6\u95f4\u5927\u5185\u5b58\u4f7f\u7528\u7684\u4f18\u5316\uff0c\u80fd\u68c0\u67e5\u8ba1\u7b97\u8d44\u6e90\uff08\u5185\u5b58\uff0c \u5904\u7406\u5668\u6570\u91cf\uff09<br \/>\u81f3\u5c11\u9700\u8981256MB\u5185\u5b58<br \/>\u5927\u91cf\u7684CPU\uff0f\u5185\u5b58\uff0c \uff08\u57281.4.1\u57284CPU\u7684\u673a\u5668\u4e0a\u5df2\u7ecf\u663e\u793a\u6709\u63d0\u5347\uff09<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:CMSFullGCsBeforeCompaction<\/td>\n<td valign=\"top\" width=\"193\">\u591a\u5c11\u6b21\u540e\u8fdb\u884c\u5185\u5b58\u538b\u7f29<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">\u7531\u4e8e\u5e76\u53d1\u6536\u96c6\u5668\u4e0d\u5bf9\u5185\u5b58\u7a7a\u95f4\u8fdb\u884c\u538b\u7f29,\u6574\u7406,\u6240\u4ee5\u8fd0\u884c\u4e00\u6bb5\u65f6\u95f4\u4ee5\u540e\u4f1a\u4ea7\u751f\"\u788e\u7247\",\u4f7f\u5f97\u8fd0\u884c\u6548\u7387\u964d\u4f4e.\u6b64\u503c\u8bbe\u7f6e\u8fd0\u884c\u591a\u5c11\u6b21GC\u4ee5\u540e\u5bf9\u5185\u5b58\u7a7a\u95f4\u8fdb\u884c\u538b\u7f29,\u6574\u7406.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+CMSParallelRemarkEnabled<\/td>\n<td valign=\"top\" width=\"193\">\u964d\u4f4e\u6807\u8bb0\u505c\u987f<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX+UseCMSCompactAtFullCollection<\/td>\n<td valign=\"top\" width=\"193\">\u5728FULL GC\u7684\u65f6\u5019\uff0c \u5bf9\u5e74\u8001\u4ee3\u7684\u538b\u7f29<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">CMS\u662f\u4e0d\u4f1a\u79fb\u52a8\u5185\u5b58\u7684\uff0c \u56e0\u6b64\uff0c \u8fd9\u4e2a\u975e\u5e38\u5bb9\u6613\u4ea7\u751f\u788e\u7247\uff0c \u5bfc\u81f4\u5185\u5b58\u4e0d\u591f\u7528\uff0c \u56e0\u6b64\uff0c \u5185\u5b58\u7684\u538b\u7f29\u8fd9\u4e2a\u65f6\u5019\u5c31\u4f1a\u88ab\u542f\u7528\u3002 \u589e\u52a0\u8fd9\u4e2a\u53c2\u6570\u662f\u4e2a\u597d\u4e60\u60ef\u3002<br \/>\u53ef\u80fd\u4f1a\u5f71\u54cd\u6027\u80fd,\u4f46\u662f\u53ef\u4ee5\u6d88\u9664\u788e\u7247<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+UseCMSInitiatingOccupancyOnly<\/td>\n<td valign=\"top\" width=\"193\">\u4f7f\u7528\u624b\u52a8\u5b9a\u4e49\u521d\u59cb\u5316\u5b9a\u4e49\u5f00\u59cbCMS\u6536\u96c6<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">\u7981\u6b62hostspot\u81ea\u884c\u89e6\u53d1CMS GC<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:CMSInitiatingOccupancyFraction=70<\/td>\n<td valign=\"top\" width=\"193\">\u4f7f\u7528cms\u4f5c\u4e3a\u5783\u573e\u56de\u6536<br \/>\u4f7f\u752870\uff05\u540e\u5f00\u59cbCMS\u6536\u96c6<\/td>\n<td valign=\"top\" width=\"88\">92<\/td>\n<td valign=\"top\" width=\"340\">\u4e3a\u4e86\u4fdd\u8bc1\u4e0d\u51fa\u73b0promotion failed(\u89c1\u4e0b\u9762\u4ecb\u7ecd)\u9519\u8bef,\u8be5\u503c\u7684\u8bbe\u7f6e\u9700\u8981\u6ee1\u8db3\u4ee5\u4e0b\u516c\u5f0f<strong><a href=\"#CMSInitiatingOccupancyFraction_value\" rel=\"noopener\">CMSInitiatingOccupancyFraction\u8ba1\u7b97\u516c\u5f0f<\/a><\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:CMSInitiatingPermOccupancyFraction<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6ePerm Gen\u4f7f\u7528\u5230\u8fbe\u591a\u5c11\u6bd4\u7387\u65f6\u89e6\u53d1<\/td>\n<td valign=\"top\" width=\"88\">92<\/td>\n<td valign=\"top\" width=\"340\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+CMSIncrementalMode<\/td>\n<td valign=\"top\" width=\"193\">\u8bbe\u7f6e\u4e3a\u589e\u91cf\u6a21\u5f0f <\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">\u7528\u4e8e\u5355CPU\u60c5\u51b5<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+CMSClassUnloadingEnabled<\/td>\n<td valign=\"top\" width=\"193\">&nbsp;<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"340\">&nbsp;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>\u8f85\u52a9\u4fe1\u606f<\/strong><\/p>\n<div class=\"table-wrapper\">\n<table style=\"border-collapse: collapse\" border=\"1\" cellspacing=\"0\" width=\"885\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintGC<\/td>\n<td valign=\"top\" width=\"193\">&nbsp;<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">\n<p>\u8f93\u51fa\u5f62\u5f0f:<\/p>\n<p>[GC 118250K-&gt;113543K(130112K), 0.0094143 secs]<br \/>[Full GC 121376K-&gt;10414K(130112K), 0.0650971 secs]<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintGCDetails<\/td>\n<td valign=\"top\" width=\"193\">&nbsp;<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">\n<p>\u8f93\u51fa\u5f62\u5f0f:[GC [DefNew: 8614K-&gt;781K(9088K), 0.0123035 secs] 118250K-&gt;113543K(130112K), 0.0124633 secs]<br \/>[GC [DefNew: 8614K-&gt;8614K(9088K), 0.0000665 secs][Tenured: 112761K-&gt;10414K(121024K), 0.0433488 secs] 121376K-&gt;10414K(130112K), 0.0436268 secs]<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintGCTimeStamps<\/td>\n<td valign=\"top\" width=\"193\">&nbsp;<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintGC:PrintGCTimeStamps<\/td>\n<td valign=\"top\" width=\"193\">&nbsp;<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">\u53ef\u4e0e-XX:+PrintGC -XX:+PrintGCDetails\u6df7\u5408\u4f7f\u7528<br \/>\u8f93\u51fa\u5f62\u5f0f:11.851: [GC 98328K-&gt;93620K(130112K), 0.0082960 secs]<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintGCApplicationStoppedTime<\/td>\n<td valign=\"top\" width=\"193\">\u6253\u5370\u5783\u573e\u56de\u6536\u671f\u95f4\u7a0b\u5e8f\u6682\u505c\u7684\u65f6\u95f4.\u53ef\u4e0e\u4e0a\u9762\u6df7\u5408\u4f7f\u7528<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">\u8f93\u51fa\u5f62\u5f0f:Total time for which application threads were stopped: 0.0468229 seconds<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintGCApplicationConcurrentTime<\/td>\n<td valign=\"top\" width=\"193\">\u6253\u5370\u6bcf\u6b21\u5783\u573e\u56de\u6536\u524d,\u7a0b\u5e8f\u672a\u4e2d\u65ad\u7684\u6267\u884c\u65f6\u95f4.\u53ef\u4e0e\u4e0a\u9762\u6df7\u5408\u4f7f\u7528<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">\u8f93\u51fa\u5f62\u5f0f:Application time: 0.5291524 seconds<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintHeapAtGC<\/td>\n<td valign=\"top\" width=\"193\">\u6253\u5370GC\u524d\u540e\u7684\u8be6\u7ec6\u5806\u6808\u4fe1\u606f<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-Xloggc:filename<\/td>\n<td valign=\"top\" width=\"193\">\u628a\u76f8\u5173\u65e5\u5fd7\u4fe1\u606f\u8bb0\u5f55\u5230\u6587\u4ef6\u4ee5\u4fbf\u5206\u6790.<br \/>\u4e0e\u4e0a\u9762\u51e0\u4e2a\u914d\u5408\u4f7f\u7528<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">\n<p>-XX:+PrintClassHistogram<\/p>\n<\/td>\n<td valign=\"top\" width=\"193\">garbage collects before printing the histogram.<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">-XX:+PrintTLAB<\/td>\n<td valign=\"top\" width=\"193\">\u67e5\u770bTLAB\u7a7a\u95f4\u7684\u4f7f\u7528\u60c5\u51b5<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"263\">XX:+PrintTenuringDistribution<\/td>\n<td valign=\"top\" width=\"193\">\u67e5\u770b\u6bcf\u6b21minor GC\u540e\u65b0\u7684\u5b58\u6d3b\u5468\u671f\u7684\u9608\u503c<\/td>\n<td valign=\"top\" width=\"88\">&nbsp;<\/td>\n<td valign=\"top\" width=\"339\">\n<p>Desired survivor size 1048576 bytes, new threshold 7 (max 15)<br \/>new threshold 7\u5373\u6807\u8bc6\u65b0\u7684\u5b58\u6d3b\u5468\u671f\u7684\u9608\u503c\u4e3a7\u3002<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>GC\u6027\u80fd\u65b9\u9762\u7684\u8003\u8651<\/strong><\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u5bf9\u4e8eGC\u7684\u6027\u80fd\u4e3b\u8981\u67092\u4e2a\u65b9\u9762\u7684\u6307\u6807\uff1a\u541e\u5410\u91cfthroughput\uff08\u5de5\u4f5c\u65f6\u95f4\u4e0d\u7b97gc\u7684\u65f6\u95f4\u5360\u603b\u7684\u65f6\u95f4\u6bd4\uff09\u548c\u6682\u505cpause\uff08gc\u53d1\u751f\u65f6app\u5bf9\u5916\u663e\u793a\u7684\u65e0\u6cd5\u54cd\u5e94\uff09\u3002<\/p>\n<p>1. Total Heap  <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cvm\u4f1a\u589e\u52a0\/\u51cf\u5c11heap\u5927\u5c0f\u4ee5\u7ef4\u6301free space\u5728\u6574\u4e2avm\u4e2d\u5360\u7684\u6bd4\u4f8b\uff0c\u8fd9\u4e2a\u6bd4\u4f8b\u7531MinHeapFreeRatio\u548cMaxHeapFreeRatio\u6307\u5b9a\u3002  <\/p>\n<p>\u4e00\u822c\u800c\u8a00\uff0cserver\u7aef\u7684app\u4f1a\u6709\u4ee5\u4e0b\u89c4\u5219\uff1a  <\/p>\n<ul>\n<li>\u5bf9vm\u5206\u914d\u5c3d\u53ef\u80fd\u591a\u7684memory\uff1b  <\/li>\n<li>\u5c06Xms\u548cXmx\u8bbe\u4e3a\u4e00\u6837\u7684\u503c\u3002\u5982\u679c\u865a\u62df\u673a\u542f\u52a8\u65f6\u8bbe\u7f6e\u4f7f\u7528\u7684\u5185\u5b58\u6bd4\u8f83\u5c0f\uff0c\u8fd9\u4e2a\u65f6\u5019\u53c8\u9700\u8981\u521d\u59cb\u5316\u5f88\u591a\u5bf9\u8c61\uff0c\u865a\u62df\u673a\u5c31\u5fc5\u987b\u91cd\u590d\u5730\u589e\u52a0\u5185\u5b58\u3002  <\/li>\n<li>\u5904\u7406\u5668\u6838\u6570\u589e\u52a0\uff0c\u5185\u5b58\u4e5f\u8ddf\u7740\u589e\u5927\u3002<\/li>\n<\/ul>\n<p>2. The Young Generation  <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u53e6\u5916\u4e00\u4e2a\u5bf9\u4e8eapp\u6d41\u7545\u6027\u8fd0\u884c\u5f71\u54cd\u7684\u56e0\u7d20\u662fyoung generation\u7684\u5927\u5c0f\u3002young generation\u8d8a\u5927\uff0cminor collection\u8d8a\u5c11\uff1b\u4f46\u662f\u5728\u56fa\u5b9aheap size\u60c5\u51b5\u4e0b\uff0c\u66f4\u5927\u7684young generation\u5c31\u610f\u5473\u7740\u5c0f\u7684tenured generation\uff0c\u5c31\u610f\u5473\u7740\u66f4\u591a\u7684major collection(major collection\u4f1a\u5f15\u53d1minor collection)\u3002  <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NewRatio\u53cd\u6620\u7684\u662fyoung\u548ctenured generation\u7684\u5927\u5c0f\u6bd4\u4f8b\u3002NewSize\u548cMaxNewSize\u53cd\u6620\u7684\u662fyoung generation\u5927\u5c0f\u7684\u4e0b\u9650\u548c\u4e0a\u9650\uff0c\u5c06\u8fd9\u4e24\u4e2a\u503c\u8bbe\u4e3a\u4e00\u6837\u5c31\u56fa\u5b9a\u4e86young generation\u7684\u5927\u5c0f\uff08\u540cXms\u548cXmx\u8bbe\u4e3a\u4e00\u6837\uff09\u3002  <\/p>\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u5982\u679c\u5e0c\u671b\uff0cSurvivorRatio\u4e5f\u53ef\u4ee5\u4f18\u5316survivor\u7684\u5927\u5c0f\uff0c\u4e0d\u8fc7\u8fd9\u5bf9\u4e8e\u6027\u80fd\u7684\u5f71\u54cd\u4e0d\u662f\u5f88\u5927\u3002SurvivorRatio\u662feden\u548csurvior\u5927\u5c0f\u6bd4\u4f8b\u3002  <\/p>\n<p>\u4e00\u822c\u800c\u8a00\uff0cserver\u7aef\u7684app\u4f1a\u6709\u4ee5\u4e0b\u89c4\u5219\uff1a  <\/p>\n<ul>\n<li>\u9996\u5148\u51b3\u5b9a\u80fd\u5206\u914d\u7ed9vm\u7684\u6700\u5927\u7684heap size\uff0c\u7136\u540e\u8bbe\u5b9a\u6700\u4f73\u7684young generation\u7684\u5927\u5c0f\uff1b  <\/li>\n<li>\u5982\u679cheap size\u56fa\u5b9a\u540e\uff0c\u589e\u52a0young generation\u7684\u5927\u5c0f\u610f\u5473\u7740\u51cf\u5c0ftenured generation\u5927\u5c0f\u3002\u8ba9tenured generation\u5728\u4efb\u4f55\u65f6\u5019\u591f\u5927\uff0c\u80fd\u591f\u5bb9\u7eb3\u6240\u6709live\u7684data\uff08\u755910%-20%\u7684\u7a7a\u4f59\uff09\u3002<\/li>\n<\/ul>\n<p><strong>\u7ecf\u9a8c&amp;&amp;\u89c4\u5219<\/strong><\/p>\n<ol>\n<li>\u5e74\u8f7b\u4ee3\u5927\u5c0f\u9009\u62e9\n<ul>\n<li>\u54cd\u5e94\u65f6\u95f4\u4f18\u5148\u7684\u5e94\u7528:\u5c3d\u53ef\u80fd\u8bbe\u5927,\u76f4\u5230\u63a5\u8fd1\u7cfb\u7edf\u7684\u6700\u4f4e\u54cd\u5e94\u65f6\u95f4\u9650\u5236(\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u9009\u62e9).\u5728\u6b64\u79cd\u60c5\u51b5\u4e0b,\u5e74\u8f7b\u4ee3\u6536\u96c6\u53d1\u751f\u7684\u9891\u7387\u4e5f\u662f\u6700\u5c0f\u7684.\u540c\u65f6,\u51cf\u5c11\u5230\u8fbe\u5e74\u8001\u4ee3\u7684\u5bf9\u8c61.  <\/li>\n<li>\u541e\u5410\u91cf\u4f18\u5148\u7684\u5e94\u7528:\u5c3d\u53ef\u80fd\u7684\u8bbe\u7f6e\u5927,\u53ef\u80fd\u5230\u8fbeGbit\u7684\u7a0b\u5ea6.\u56e0\u4e3a\u5bf9\u54cd\u5e94\u65f6\u95f4\u6ca1\u6709\u8981\u6c42,\u5783\u573e\u6536\u96c6\u53ef\u4ee5\u5e76\u884c\u8fdb\u884c,\u4e00\u822c\u9002\u54088CPU\u4ee5\u4e0a\u7684\u5e94\u7528.  <\/li>\n<li>\u907f\u514d\u8bbe\u7f6e\u8fc7\u5c0f.\u5f53\u65b0\u751f\u4ee3\u8bbe\u7f6e\u8fc7\u5c0f\u65f6\u4f1a\u5bfc\u81f4:1.YGC\u6b21\u6570\u66f4\u52a0\u9891\u7e41 2.\u53ef\u80fd\u5bfc\u81f4YGC\u5bf9\u8c61\u76f4\u63a5\u8fdb\u5165\u65e7\u751f\u4ee3,\u5982\u679c\u6b64\u65f6\u65e7\u751f\u4ee3\u6ee1\u4e86,\u4f1a\u89e6\u53d1FGC.<\/li>\n<\/ul>\n<\/li>\n<li>\u5e74\u8001\u4ee3\u5927\u5c0f\u9009\u62e9\n<ol>\n<li>\u54cd\u5e94\u65f6\u95f4\u4f18\u5148\u7684\u5e94\u7528:\u5e74\u8001\u4ee3\u4f7f\u7528\u5e76\u53d1\u6536\u96c6\u5668,\u6240\u4ee5\u5176\u5927\u5c0f\u9700\u8981\u5c0f\u5fc3\u8bbe\u7f6e,\u4e00\u822c\u8981\u8003\u8651\u5e76\u53d1\u4f1a\u8bdd\u7387\u548c\u4f1a\u8bdd\u6301\u7eed\u65f6\u95f4\u7b49\u4e00\u4e9b\u53c2\u6570.\u5982\u679c\u5806\u8bbe\u7f6e\u5c0f\u4e86,\u53ef\u4ee5\u4f1a\u9020\u6210\u5185\u5b58\u788e \u7247,\u9ad8\u56de\u6536\u9891\u7387\u4ee5\u53ca\u5e94\u7528\u6682\u505c\u800c\u4f7f\u7528\u4f20\u7edf\u7684\u6807\u8bb0\u6e05\u9664\u65b9\u5f0f;\u5982\u679c\u5806\u5927\u4e86,\u5219\u9700\u8981\u8f83\u957f\u7684\u6536\u96c6\u65f6\u95f4.\u6700\u4f18\u5316\u7684\u65b9\u6848,\u4e00\u822c\u9700\u8981\u53c2\u8003\u4ee5\u4e0b\u6570\u636e\u83b7\u5f97:<br \/>\u5e76\u53d1\u5783\u573e\u6536\u96c6\u4fe1\u606f\u3001\u6301\u4e45\u4ee3\u5e76\u53d1\u6536\u96c6\u6b21\u6570\u3001\u4f20\u7edfGC\u4fe1\u606f\u3001\u82b1\u5728\u5e74\u8f7b\u4ee3\u548c\u5e74\u8001\u4ee3\u56de\u6536\u4e0a\u7684\u65f6\u95f4\u6bd4\u4f8b\u3002  <\/li>\n<li>\u541e\u5410\u91cf\u4f18\u5148\u7684\u5e94\u7528:\u4e00\u822c\u541e\u5410\u91cf\u4f18\u5148\u7684\u5e94\u7528\u90fd\u6709\u4e00\u4e2a\u5f88\u5927\u7684\u5e74\u8f7b\u4ee3\u548c\u4e00\u4e2a\u8f83\u5c0f\u7684\u5e74\u8001\u4ee3.\u539f\u56e0\u662f,\u8fd9\u6837\u53ef\u4ee5\u5c3d\u53ef\u80fd\u56de\u6536\u6389\u5927\u90e8\u5206\u77ed\u671f\u5bf9\u8c61,\u51cf\u5c11\u4e2d\u671f\u7684\u5bf9\u8c61,\u800c\u5e74\u8001\u4ee3\u5c3d\u5b58\u653e\u957f\u671f\u5b58\u6d3b\u5bf9\u8c61.<\/li>\n<\/ol>\n<\/li>\n<li>\u8f83\u5c0f\u5806\u5f15\u8d77\u7684\u788e\u7247\u95ee\u9898<br \/>\u56e0\u4e3a\u5e74\u8001\u4ee3\u7684\u5e76\u53d1\u6536\u96c6\u5668\u4f7f\u7528\u6807\u8bb0,\u6e05\u9664\u7b97\u6cd5,\u6240\u4ee5\u4e0d\u4f1a\u5bf9\u5806\u8fdb\u884c\u538b\u7f29.\u5f53\u6536\u96c6\u5668\u56de\u6536\u65f6,\u4ed6\u4f1a\u628a\u76f8\u90bb\u7684\u7a7a\u95f4\u8fdb\u884c\u5408\u5e76,\u8fd9\u6837\u53ef\u4ee5\u5206\u914d\u7ed9\u8f83\u5927\u7684\u5bf9\u8c61.\u4f46\u662f,\u5f53\u5806\u7a7a\u95f4\u8f83\u5c0f\u65f6,\u8fd0\u884c\u4e00\u6bb5\u65f6\u95f4\u4ee5\u540e,\u5c31\u4f1a\u51fa\u73b0\"\u788e\u7247\",\u5982\u679c\u5e76\u53d1\u6536\u96c6\u5668\u627e\u4e0d\u5230\u8db3\u591f\u7684\u7a7a\u95f4,\u90a3\u4e48\u5e76\u53d1\u6536\u96c6\u5668\u5c06\u4f1a\u505c\u6b62,\u7136\u540e\u4f7f\u7528\u4f20\u7edf\u7684\u6807\u8bb0,\u6e05\u9664\u65b9\u5f0f\u8fdb\u884c\u56de\u6536.\u5982\u679c\u51fa\u73b0\"\u788e\u7247\",\u53ef\u80fd\u9700\u8981\u8fdb\u884c\u5982\u4e0b\u914d\u7f6e:<br \/>-XX:+UseCMSCompactAtFullCollection:\u4f7f\u7528\u5e76\u53d1\u6536\u96c6\u5668\u65f6,\u5f00\u542f\u5bf9\u5e74\u8001\u4ee3\u7684\u538b\u7f29.<br \/>-XX:CMSFullGCsBeforeCompaction=0:\u4e0a\u9762\u914d\u7f6e\u5f00\u542f\u7684\u60c5\u51b5\u4e0b,\u8fd9\u91cc\u8bbe\u7f6e\u591a\u5c11\u6b21Full GC\u540e,\u5bf9\u5e74\u8001\u4ee3\u8fdb\u884c\u538b\u7f29  <\/li>\n<li>\u752864\u4f4d\u64cd\u4f5c\u7cfb\u7edf\uff0cLinux\u4e0b64\u4f4d\u7684jdk\u6bd432\u4f4djdk\u8981\u6162\u4e00\u4e9b\uff0c\u4f46\u662f\u5403\u5f97\u5185\u5b58\u66f4\u591a\uff0c\u541e\u5410\u91cf\u66f4\u5927  <\/li>\n<li>XMX\u548cXMS\u8bbe\u7f6e\u4e00\u6837\u5927\uff0cMaxPermSize\u548cMinPermSize\u8bbe\u7f6e\u4e00\u6837\u5927\uff0c\u8fd9\u6837\u53ef\u4ee5\u51cf\u8f7b\u4f38\u7f29\u5806\u5927\u5c0f\u5e26\u6765\u7684\u538b\u529b  <\/li>\n<li><strong><\/strong>\u4f7f\u7528CMS\u7684\u597d\u5904\u662f\u7528\u5c3d\u91cf\u5c11\u7684\u65b0\u751f\u4ee3\uff0c\u7ecf\u9a8c\u503c\u662f128M\uff0d256M\uff0c \u7136\u540e\u8001\u751f\u4ee3\u5229\u7528CMS\u5e76\u884c\u6536\u96c6\uff0c \u8fd9\u6837\u80fd\u4fdd\u8bc1\u7cfb\u7edf\u4f4e\u5ef6\u8fdf\u7684\u541e\u5410\u6548\u7387\u3002 \u5b9e\u9645\u4e0acms\u7684\u6536\u96c6\u505c\u987f\u65f6\u95f4\u975e\u5e38\u7684\u77ed\uff0c2G\u7684\u5185\u5b58\uff0c \u5927\u7ea620\uff0d80ms\u7684\u5e94\u7528\u7a0b\u5e8f\u505c\u987f\u65f6\u95f4  <\/li>\n<li>\u7cfb\u7edf\u505c\u987f\u7684\u65f6\u5019\u53ef\u80fd\u662fGC\u7684\u95ee\u9898\u4e5f\u53ef\u80fd\u662f\u7a0b\u5e8f\u7684\u95ee\u9898\uff0c\u591a\u7528jmap\u548cjstack\u67e5\u770b\uff0c\u6216\u8005killall -3 java\uff0c\u7136\u540e\u67e5\u770bjava\u63a7\u5236\u53f0\u65e5\u5fd7\uff0c\u80fd\u770b\u51fa\u5f88\u591a\u95ee\u9898\u3002(\u76f8\u5173\u5de5\u5177\u7684\u4f7f\u7528\u65b9\u6cd5\u5c06\u5728\u540e\u9762\u7684blog\u4e2d\u4ecb\u7ecd)  <\/li>\n<li>\u4ed4\u7ec6\u4e86\u89e3\u81ea\u5df1\u7684\u5e94\u7528\uff0c\u5982\u679c\u7528\u4e86\u7f13\u5b58\uff0c\u90a3\u4e48\u5e74\u8001\u4ee3\u5e94\u8be5\u5927\u4e00\u4e9b\uff0c\u7f13\u5b58\u7684HashMap\u4e0d\u5e94\u8be5\u65e0\u9650\u5236\u957f\uff0c\u5efa\u8bae\u91c7\u7528LRU\u7b97\u6cd5\u7684Map\u505a\u7f13\u5b58\uff0cLRUMap\u7684\u6700\u5927\u957f\u5ea6\u4e5f\u8981\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u8bbe\u5b9a\u3002  <\/li>\n<li>\u91c7\u7528\u5e76\u53d1\u56de\u6536\u65f6\uff0c\u5e74\u8f7b\u4ee3\u5c0f\u4e00\u70b9\uff0c\u5e74\u8001\u4ee3\u8981\u5927\uff0c\u56e0\u4e3a\u5e74\u8001\u5927\u7528\u7684\u662f\u5e76\u53d1\u56de\u6536\uff0c\u5373\u4f7f\u65f6\u95f4\u957f\u70b9\u4e5f\u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u7a0b\u5e8f\u7ee7\u7eed\u8fd0\u884c\uff0c\u7f51\u7ad9\u4e0d\u4f1a\u505c\u987f  <\/li>\n<li>JVM\u53c2\u6570\u7684\u8bbe\u7f6e(\u7279\u522b\u662f \u2013Xmx \u2013Xms \u2013Xmn -XX:SurvivorRatio&nbsp; -XX:MaxTenuringThreshold\u7b49\u53c2\u6570\u7684\u8bbe\u7f6e\u6ca1\u6709\u4e00\u4e2a\u56fa\u5b9a\u7684\u516c\u5f0f\uff0c\u9700\u8981\u6839\u636ePV old\u533a\u5b9e\u9645\u6570\u636e YGC\u6b21\u6570\u7b49\u591a\u65b9\u9762\u6765\u8861\u91cf\u3002\u4e3a\u4e86\u907f\u514dpromotion faild\u53ef\u80fd\u4f1a\u5bfc\u81f4xmn\u8bbe\u7f6e\u504f\u5c0f\uff0c\u4e5f\u610f\u5473\u7740YGC\u7684\u6b21\u6570\u4f1a\u589e\u591a\uff0c\u5904\u7406\u5e76\u53d1\u8bbf\u95ee\u7684\u80fd\u529b\u4e0b\u964d\u7b49\u95ee\u9898\u3002\u6bcf\u4e2a\u53c2\u6570\u7684\u8c03\u6574\u90fd\u9700\u8981\u7ecf\u8fc7\u8be6\u7ec6\u7684\u6027\u80fd\u6d4b\u8bd5\uff0c\u624d\u80fd\u627e\u5230\u7279\u5b9a\u5e94\u7528\u7684\u6700\u4f73\u914d\u7f6e\u3002<\/li>\n<\/ol>\n<p><strong>promotion failed:<\/strong><\/p>\n<p>\u5783\u573e\u56de\u6536\u65f6promotion failed\u662f\u4e2a\u5f88\u5934\u75db\u7684\u95ee\u9898\uff0c\u4e00\u822c\u53ef\u80fd\u662f\u4e24\u79cd\u539f\u56e0\u4ea7\u751f\uff0c\u7b2c\u4e00\u4e2a\u539f\u56e0\u662f\u6551\u52a9\u7a7a\u95f4\u4e0d\u591f\uff0c\u6551\u52a9\u7a7a\u95f4\u91cc\u7684\u5bf9\u8c61\u8fd8\u4e0d\u5e94\u8be5\u88ab\u79fb\u52a8\u5230\u5e74\u8001\u4ee3\uff0c\u4f46\u5e74\u8f7b\u4ee3\u53c8\u6709\u5f88\u591a\u5bf9\u8c61\u9700\u8981\u653e\u5165\u6551\u52a9\u7a7a\u95f4\uff1b\u7b2c\u4e8c\u4e2a\u539f\u56e0\u662f\u5e74\u8001\u4ee3\u6ca1\u6709\u8db3\u591f\u7684\u7a7a\u95f4\u63a5\u7eb3\u6765\u81ea\u5e74\u8f7b\u4ee3\u7684\u5bf9\u8c61\uff1b\u8fd9\u4e24\u79cd\u60c5\u51b5\u90fd\u4f1a\u8f6c\u5411Full GC\uff0c\u7f51\u7ad9\u505c\u987f\u65f6\u95f4\u8f83\u957f\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u65b9\u6848\u4e00\uff1a<\/p>\n<p><em>\u7b2c\u4e00\u4e2a\u539f\u56e0\u6211\u7684\u6700\u7ec8\u89e3\u51b3\u529e\u6cd5\u662f\u53bb\u6389\u6551\u52a9\u7a7a\u95f4\uff0c\u8bbe\u7f6e-XX:SurvivorRatio=65536 -XX:MaxTenuringThreshold=0\u5373\u53ef\uff0c\u7b2c\u4e8c\u4e2a\u539f\u56e0\u6211\u7684\u89e3\u51b3\u529e\u6cd5\u662f\u8bbe\u7f6eCMSInitiatingOccupancyFraction\u4e3a\u67d0\u4e2a\u503c\uff08\u5047\u8bbe70\uff09\uff0c\u8fd9\u6837\u5e74\u8001\u4ee3\u7a7a\u95f4\u523070%\u65f6\u5c31\u5f00\u59cb\u6267\u884cCMS\uff0c\u5e74\u8001\u4ee3\u6709\u8db3\u591f\u7684\u7a7a\u95f4\u63a5\u7eb3\u6765\u81ea\u5e74\u8f7b\u4ee3\u7684\u5bf9\u8c61\u3002<\/em><\/p>\n<p>\u89e3\u51b3\u65b9\u6848\u4e00\u7684\u6539\u8fdb\u65b9\u6848\uff1a<\/p>\n<p><em>\u53c8\u6709\u6539\u8fdb\u4e86\uff0c\u4e0a\u9762\u65b9\u6cd5\u4e0d\u592a\u597d\uff0c\u56e0\u4e3a\u6ca1\u6709\u7528\u5230\u6551\u52a9\u7a7a\u95f4\uff0c\u6240\u4ee5\u5e74\u8001\u4ee3\u5bb9\u6613\u6ee1\uff0cCMS\u6267\u884c\u4f1a\u6bd4\u8f83\u9891\u7e41\u3002\u6211\u6539\u5584\u4e86\u4e00\u4e0b\uff0c\u8fd8\u662f\u7528\u6551\u52a9\u7a7a\u95f4\uff0c\u4f46\u662f\u628a\u6551\u52a9\u7a7a\u95f4\u52a0\u5927\uff0c\u8fd9\u6837\u4e5f\u4e0d\u4f1a\u6709promotion failed\u3002\u5177\u4f53\u64cd\u4f5c\u4e0a\uff0c32\u4f4dLinux\u548c64\u4f4dLinux\u597d\u50cf\u4e0d\u4e00\u6837\uff0c64\u4f4d\u7cfb\u7edf\u4f3c\u4e4e\u53ea\u8981\u914d\u7f6eMaxTenuringThreshold\u53c2\u6570\uff0cCMS\u8fd8\u662f\u6709\u6682\u505c\u3002\u4e3a\u4e86\u89e3\u51b3\u6682\u505c\u95ee\u9898\u548cpromotion failed\u95ee\u9898\uff0c\u6700\u540e\u6211\u8bbe\u7f6e-XX:SurvivorRatio=1 \uff0c\u5e76\u628aMaxTenuringThreshold\u53bb\u6389\uff0c\u8fd9\u6837\u5373\u6ca1\u6709\u6682\u505c\u53c8\u4e0d\u4f1a\u6709promotoin failed\uff0c\u800c\u4e14\u66f4\u91cd\u8981\u7684\u662f\uff0c\u5e74\u8001\u4ee3\u548c\u6c38\u4e45\u4ee3\u4e0a\u5347\u975e\u5e38\u6162\uff08\u56e0\u4e3a\u597d\u591a\u5bf9\u8c61\u5230\u4e0d\u4e86\u5e74\u8001\u4ee3\u5c31\u88ab\u56de\u6536\u4e86\uff09\uff0c\u6240\u4ee5CMS\u6267\u884c\u9891\u7387\u975e\u5e38\u4f4e\uff0c\u597d\u51e0\u4e2a\u5c0f\u65f6\u624d\u6267\u884c\u4e00\u6b21\uff0c\u8fd9\u6837\uff0c\u670d\u52a1\u5668\u90fd\u4e0d\u7528\u91cd\u542f\u4e86\u3002<\/em>  <\/p>\n<p>-Xmx4000M -Xms4000M -Xmn600M -XX:PermSize=500M -XX:MaxPermSize=500M -Xss256K -XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintClassHistogram -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:log\/gc.log  <\/p>\n<p>&nbsp; <\/p>\n<p id=\"CMSInitiatingOccupancyFraction_value\"><strong>CMSInitiatingOccupancyFraction\u503c\u4e0eXmn\u7684\u5173\u7cfb\u516c\u5f0f<\/strong>  <\/p>\n<p>\u4e0a\u9762\u4ecb\u7ecd\u4e86promontion faild\u4ea7\u751f\u7684\u539f\u56e0\u662fEDEN\u7a7a\u95f4\u4e0d\u8db3\u7684\u60c5\u51b5\u4e0b\u5c06EDEN\u4e0eFrom survivor\u4e2d\u7684\u5b58\u6d3b\u5bf9\u8c61\u5b58\u5165To survivor\u533a\u65f6,To survivor\u533a\u7684\u7a7a\u95f4\u4e0d\u8db3\uff0c\u518d\u6b21\u664b\u5347\u5230old gen\u533a\uff0c\u800cold gen\u533a\u5185\u5b58\u4e5f\u4e0d\u591f\u7684\u60c5\u51b5\u4e0b\u4ea7\u751f\u4e86promontion faild\u4ece\u800c\u5bfc\u81f4full gc.\u90a3\u53ef\u4ee5\u63a8\u65ad\u51fa\uff1aeden+from survivor &lt; old gen\u533a\u5269\u4f59\u5185\u5b58\u65f6\uff0c\u4e0d\u4f1a\u51fa\u73b0promontion faild\u7684\u60c5\u51b5\uff0c\u5373\uff1a<br \/>(Xmx-Xmn)*(1-CMSInitiatingOccupancyFraction\/100)&gt;=(Xmn-Xmn\/(SurvivorRatior+2))&nbsp; \u8fdb\u800c\u63a8\u65ad\u51fa\uff1a  <\/p>\n<p>CMSInitiatingOccupancyFraction &lt;=((Xmx-Xmn)-(Xmn-Xmn\/(SurvivorRatior+2)))\/(Xmx-Xmn)*100  <\/p>\n<p>\u4f8b\u5982\uff1a  <\/p>\n<p>\u5f53xmx=128 xmn=36 SurvivorRatior=1\u65f6 CMSInitiatingOccupancyFraction&lt;=((128.0-36)-(36-36\/(1+2)))\/(128-36)*100 =73.913  <\/p>\n<p>\u5f53xmx=128 xmn=24 SurvivorRatior=1\u65f6 CMSInitiatingOccupancyFraction&lt;=((128.0-24)-(24-24\/(1+2)))\/(128-24)*100=84.615\u2026  <\/p>\n<p>\u5f53xmx=3000 xmn=600 SurvivorRatior=1\u65f6&nbsp; CMSInitiatingOccupancyFraction&lt;=((3000.0-600)-(600-600\/(1+2)))\/(3000-600)*100=83.33  <\/p>\n<p>CMSInitiatingOccupancyFraction\u4f4e\u4e8e70% \u9700\u8981\u8c03\u6574xmn\u6216SurvivorRatior\u503c\u3002  <\/p>\n<p>\u4ee4\uff1a  <\/p>\n<p><a href=\"http:\/\/bbs.weblogicfans.net\/archiver\/tid-2835.html\" target=\"_blank\" rel=\"noopener\">\u7f51\u4e0a\u4e00\u7ae5\u978b<\/a>\u63a8\u65ad\u51fa\u7684\u516c\u5f0f\u662f\uff1a:(Xmx-Xmn)*(100-CMSInitiatingOccupancyFraction)\/100&gt;=Xmn \u8fd9\u4e2a\u516c\u5f0f\u4e2a\u4eba\u8ba4\u4e3a\u4e0d\u662f\u5f88\u4e25\u8c28\uff0c\u5728\u5185\u5b58\u5c0f\u7684\u65f6\u5019\u4f1a\u5f71\u54cdxmn\u7684\u8ba1\u7b97\u3002  <\/p>\n<p>&nbsp; <\/p>\n<p>\u5173\u4e8e\u5b9e\u9645\u73af\u5883\u7684GC\u53c2\u6570\u914d\u7f6e\u89c1:<a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/05\/2038331.html\" rel=\"noopener\">\u5b9e\u4f8b\u5206\u6790<\/a>&nbsp;&nbsp; <a href=\"http:\/\/www.cnblogs.com\/redcreen\/archive\/2011\/05\/09\/2040977.html\" target=\"_blank\" rel=\"noopener\">\u76d1\u6d4b\u5de5\u5177\u89c1JVM\u76d1\u6d4b<\/a>  <\/p>\n<p>\u53c2\u8003\uff1a<\/p>\n<p>JAVA HOTSPOT VM\uff08<a href=\"http:\/\/www.helloying.com\/blog\/archives\/164\" rel=\"noopener\">http:\/\/www.helloying.com\/blog\/archives\/164<\/a>\uff09<\/p>\n<p><a href=\"http:\/\/www.iteye.com\/wiki\/jvm\/2870-JVM\" target=\"_blank\" rel=\"noopener\">JVM \u51e0\u4e2a\u91cd\u8981\u7684\u53c2\u6570<\/a> (\u6821\u957f)<\/p>\n<p><a href=\"http:\/\/hi.baidu.com\/sdausea\/blog\/item\/c599ef13fcd3a7dbf6039e12.html\" target=\"_blank\" rel=\"noopener\">java jvm \u53c2\u6570 -Xms -Xmx -Xmn -Xss \u8c03\u4f18\u603b\u7ed3<\/a><\/p>\n<p><a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/tech\/vmoptions-jsp-140102.html\" target=\"_blank\" rel=\"noopener\">Java HotSpot VM Options<\/a><\/p>\n<p><a href=\"http:\/\/bbs.weblogicfans.net\/archiver\/tid-2835.html\" rel=\"noopener\">http:\/\/bbs.weblogicfans.net\/archiver\/tid-2835.html<\/a><\/p>\n<p><a href=\"http:\/\/www.oracle.com\/technetwork\/java\/hotspotfaq-138619.html\" target=\"_blank\" rel=\"noopener\">Frequently Asked Questions About the Java HotSpot VM<\/a><\/p>\n<p><a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/tech\/index-jsp-136373.html\" target=\"_blank\" rel=\"noopener\">Java SE HotSpot at a Glance<\/a><\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/yang_net\/archive\/2010\/08\/22\/5830820.aspx\" target=\"_blank\" rel=\"noopener\">Java\u6027\u80fd\u8c03\u4f18\u7b14\u8bb0<\/a>(\u5185\u9644\u6d4b\u8bd5\u4f8b\u5b50 \u5f88\u6709\u7528)<\/p>\n<p><a href=\"http:\/\/blog.bluedavy.com\/?p=70\" target=\"_blank\" rel=\"noopener\">\u8bf4\u8bf4MaxTenuringThreshold\u8fd9\u4e2a\u53c2\u6570<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u76f8\u5173\u6587\u7ae0\u63a8\u8350:<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/pigeon21\/archive\/2011\/01\/27\/6166217.aspx\" target=\"_blank\" rel=\"noopener\">GC\u8c03\u4f18\u65b9\u6cd5\u603b\u7ed3<\/a><\/p>\n<p><a href=\"http:\/\/kenwublog.com\/docs\/java6-jvm-options-chinese-edition.htm\" target=\"_blank\" rel=\"noopener\">Java 6 JVM\u53c2\u6570\u9009\u9879\u5927\u5168\uff08\u4e2d\u6587\u7248\uff09<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \u4e0d\u7ba1\u662fYGC\u8fd8\u662fFull GC,GC\u8fc7\u7a0b\u4e2d\u90fd\u4f1a\u5bf9\u5bfc\u81f4\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u4e2d\u65ad,\u6b63\u786e\u7684\u9009\u62e9\u4e0d\u540c\u7684GC\u7b56\u7565,\u8c03\u6574JVM\u3001GC\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u6781\u5927\u7684\u51cf\u5c11\u7531\u4e8eGC\u5de5\u4f5c\uff0c\u800c\u5bfc\u81f4\u7684\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u65ad\u65b9\u9762\u7684\u95ee\u9898\uff0c\u8fdb\u800c\u9002\u5f53\u7684\u63d0\u9ad8Java\u7a0b\u5e8f\u7684\u5de5\u4f5c\u6548\u7387\u3002\u4f46\u662f\u8c03\u6574GC\u662f\u4ee5\u4e2a\u6781\u4e3a\u590d\u6742\u7684\u8fc7\u7a0b\uff0c\u7531\u4e8e\u5404\u4e2a\u7a0b\u5e8f\u5177\u5907\u4e0d\u540c\u7684\u7279\u70b9\uff0c\u5982\uff1aweb\u548cGUI\u7a0b\u5e8f\u5c31\u6709\u5f88\u5927\u533a\u522b\uff08Web\u53ef\u4ee5\u9002\u5f53\u7684\u505c\u987f\uff0c\u4f46GUI\u505c\u987f\u662f\u5ba2\u6237\u65e0\u6cd5\u63a5\u53d7\u7684\uff09\uff0c\u800c\u4e14\u7531\u4e8e\u8dd1\u5728\u5404\u4e2a\u673a\u5668\u4e0a\u7684\u914d\u7f6e\u4e0d\u540c\uff08\u4e3b\u8981cup\u4e2a\u6570\uff0c\u5185\u5b58\u4e0d\u540c\uff09\uff0c\u6240\u4ee5\u4f7f\u7528\u7684GC\u79cd\u7c7b\u4e5f\u4f1a\u4e0d\u540c(\u5982\u4f55\u9009\u62e9\u89c1GC\u79cd\u7c7b\u53ca\u5982\u4f55\u9009\u62e9)\u3002\u672c\u6587\u5c06\u6ce8\u91cd\u4ecb\u7ecdJVM\u3001GC\u7684\u4e00\u4e9b\u91cd\u8981\u53c2\u6570\u7684\u8bbe\u7f6e\u6765\u63d0\u9ad8\u7cfb\u7edf\u7684\u6027\u80fd\u3002 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JVM\u5185\u5b58\u7ec4\u6210\u53caGC\u76f8\u5173\u5185\u5bb9\u8bf7\u89c1\u4e4b\u524d\u7684\u6587\u7ae0:JVM\u5185\u5b58\u7ec4\u6210&nbsp;GC\u7b56\u7565&amp;\u5185\u5b58\u7533\u8bf7\u3002 JVM\u53c2\u6570\u7684\u542b\u4e49 \u5b9e\u4f8b\u89c1\u5b9e\u4f8b\u5206\u6790 \u53c2\u6570\u540d\u79f0 \u542b\u4e49 \u9ed8\u8ba4\u503c &nbsp; -Xms \u521d\u59cb\u5806\u5927\u5c0f \u7269\u7406\u5185\u5b58\u76841\/64(&lt;1GB) \u9ed8\u8ba4(MinHeapFreeRatio\u53c2\u6570\u53ef\u4ee5\u8c03\u6574)\u7a7a\u4f59\u5806\u5185\u5b58\u5c0f\u4e8e40%\u65f6\uff0cJVM\u5c31\u4f1a\u589e\u5927\u5806\u76f4\u5230-Xmx\u7684\u6700\u5927\u9650\u5236. -Xmx \u6700\u5927\u5806\u5927\u5c0f \u7269\u7406\u5185\u5b58\u76841\/4(&lt;1GB) \u9ed8\u8ba4(MaxHeapFreeRatio\u53c2\u6570\u53ef\u4ee5\u8c03\u6574)\u7a7a\u4f59\u5806\u5185\u5b58\u5927\u4e8e70%\u65f6\uff0cJVM\u4f1a\u51cf\u5c11\u5806\u76f4\u5230 -Xms\u7684\u6700\u5c0f\u9650\u5236 -Xmn \u5e74\u8f7b\u4ee3\u5927\u5c0f(1.4or lator) &nbsp; \u6ce8\u610f\uff1a\u6b64\u5904\u7684\u5927\u5c0f\u662f\uff08eden+ 2 survivor space).\u4e0ejmap -heap\u4e2d\u663e\u793a\u7684New gen\u662f\u4e0d\u540c\u7684\u3002\u6574\u4e2a\u5806\u5927\u5c0f=\u5e74\u8f7b\u4ee3\u5927\u5c0f + \u5e74\u8001\u4ee3\u5927\u5c0f + \u6301\u4e45\u4ee3\u5927\u5c0f.\u589e\u5927\u5e74\u8f7b\u4ee3\u540e,\u5c06\u4f1a\u51cf\u5c0f\u5e74\u8001\u4ee3\u5927\u5c0f.\u6b64\u503c\u5bf9\u7cfb\u7edf\u6027\u80fd\u5f71\u54cd\u8f83\u5927,Sun\u5b98\u65b9\u63a8\u8350\u914d\u7f6e\u4e3a\u6574\u4e2a\u5806\u76843\/8 -XX:NewSize \u8bbe\u7f6e\u5e74\u8f7b\u4ee3\u5927\u5c0f(for 1.3\/1.4) &nbsp; &nbsp; -XX:MaxNewSize \u5e74\u8f7b\u4ee3\u6700\u5927\u503c(for 1.3\/1.4) &nbsp; &nbsp; -XX:PermSize \u8bbe\u7f6e\u6301\u4e45\u4ee3(perm gen)\u521d\u59cb\u503c \u7269\u7406\u5185\u5b58\u76841\/64 &nbsp; -XX:MaxPermSize \u8bbe\u7f6e\u6301\u4e45\u4ee3\u6700\u5927\u503c \u7269\u7406\u5185\u5b58\u76841\/4 &nbsp; -Xss \u6bcf\u4e2a\u7ebf\u7a0b\u7684\u5806\u6808\u5927\u5c0f &nbsp; JDK5.0\u4ee5\u540e\u6bcf\u4e2a\u7ebf\u7a0b\u5806\u6808\u5927\u5c0f\u4e3a1M,\u4ee5\u524d\u6bcf\u4e2a\u7ebf\u7a0b\u5806\u6808\u5927\u5c0f\u4e3a256K.\u66f4\u5177\u5e94\u7528\u7684\u7ebf\u7a0b\u6240\u9700\u5185\u5b58\u5927\u5c0f\u8fdb\u884c \u8c03\u6574.\u5728\u76f8\u540c\u7269\u7406\u5185\u5b58\u4e0b,\u51cf\u5c0f\u8fd9\u4e2a\u503c\u80fd\u751f\u6210\u66f4\u591a\u7684\u7ebf\u7a0b.\u4f46\u662f\u64cd\u4f5c\u7cfb\u7edf\u5bf9\u4e00\u4e2a\u8fdb\u7a0b\u5185\u7684\u7ebf\u7a0b\u6570\u8fd8\u662f\u6709\u9650\u5236\u7684,\u4e0d\u80fd\u65e0\u9650\u751f\u6210,\u7ecf\u9a8c\u503c\u57283000~5000\u5de6\u53f3\u4e00\u822c\u5c0f\u7684\u5e94\u7528\uff0c \u5982\u679c\u6808\u4e0d\u662f\u5f88\u6df1\uff0c \u5e94\u8be5\u662f128k\u591f\u7528\u7684 \u5927\u7684\u5e94\u7528\u5efa\u8bae\u4f7f\u7528256k\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u6027\u80fd\u5f71\u54cd\u6bd4\u8f83\u5927\uff0c\u9700\u8981\u4e25\u683c\u7684\u6d4b\u8bd5\u3002\uff08\u6821\u957f\uff09\u548cthreadstacksize\u9009\u9879\u89e3\u91ca\u5f88\u7c7b\u4f3c,\u5b98\u65b9\u6587\u6863\u4f3c\u4e4e\u6ca1\u6709\u89e3\u91ca,\u5728\u8bba\u575b\u4e2d\u6709\u8fd9\u6837\u4e00\u53e5\u8bdd:&#8221;\u201d-Xss is translated in a VM flag named ThreadStackSize\u201d\u4e00\u822c\u8bbe\u7f6e\u8fd9\u4e2a\u503c\u5c31\u53ef\u4ee5\u4e86\u3002 -XX:ThreadStackSize Thread Stack Size &nbsp; (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] -XX:NewRatio \u5e74\u8f7b\u4ee3(\u5305\u62ecEden\u548c\u4e24\u4e2aSurvivor\u533a)\u4e0e\u5e74\u8001\u4ee3\u7684\u6bd4\u503c(\u9664\u53bb\u6301\u4e45\u4ee3) &nbsp; -XX:NewRatio=4\u8868\u793a\u5e74\u8f7b\u4ee3\u4e0e\u5e74\u8001\u4ee3\u6240\u5360\u6bd4\u503c\u4e3a1:4,\u5e74\u8f7b\u4ee3\u5360\u6574\u4e2a\u5806\u6808\u76841\/5Xms=Xmx\u5e76\u4e14\u8bbe\u7f6e\u4e86Xmn\u7684\u60c5\u51b5\u4e0b\uff0c\u8be5\u53c2\u6570\u4e0d\u9700\u8981\u8fdb\u884c\u8bbe\u7f6e\u3002 -XX:SurvivorRatio Eden\u533a\u4e0eSurvivor\u533a\u7684\u5927\u5c0f\u6bd4\u503c &nbsp; \u8bbe\u7f6e\u4e3a8,\u5219\u4e24\u4e2aSurvivor\u533a\u4e0e\u4e00\u4e2aEden\u533a\u7684\u6bd4\u503c\u4e3a2:8,\u4e00\u4e2aSurvivor\u533a\u5360\u6574\u4e2a\u5e74\u8f7b\u4ee3\u76841\/10 -XX:LargePageSizeInBytes \u5185\u5b58\u9875\u7684\u5927\u5c0f\u4e0d\u53ef\u8bbe\u7f6e\u8fc7\u5927\uff0c \u4f1a\u5f71\u54cdPerm\u7684\u5927\u5c0f &nbsp; =128m -XX:+UseFastAccessorMethods \u539f\u59cb\u7c7b\u578b\u7684\u5feb\u901f\u4f18\u5316 &nbsp; &nbsp; -XX:+DisableExplicitGC \u5173\u95edSystem.gc() &nbsp; \u8fd9\u4e2a\u53c2\u6570\u9700\u8981\u4e25\u683c\u7684\u6d4b\u8bd5 -XX:MaxTenuringThreshold \u5783\u573e\u6700\u5927\u5e74\u9f84 &nbsp; \u5982\u679c\u8bbe\u7f6e\u4e3a0\u7684\u8bdd,\u5219\u5e74\u8f7b\u4ee3\u5bf9\u8c61\u4e0d\u7ecf\u8fc7Survivor\u533a,\u76f4\u63a5\u8fdb\u5165\u5e74\u8001\u4ee3&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","footnotes":""},"categories":[101,80],"tags":[],"class_list":["post-1707","post","type-post","status-publish","format-standard","hentry","category-101","category-80"],"_links":{"self":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1707"}],"version-history":[{"count":1,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1707\/revisions"}],"predecessor-version":[{"id":1708,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/1707\/revisions\/1708"}],"wp:attachment":[{"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oneai.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}