{"id":48999,"date":"2025-07-30T14:23:25","date_gmt":"2025-07-30T06:23:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/48999.html"},"modified":"2025-07-30T14:23:25","modified_gmt":"2025-07-30T06:23:25","slug":"g1-%e8%b0%83%e4%bc%98%e6%9c%89%e5%a4%9a%e7%a5%9e%ef%bc%9f%e4%b8%80%e8%a1%8c%e5%8f%82%e6%95%b0%e8%ae%a9%e6%bd%ae%e7%8e%a9%e5%a4%a7%e4%bf%83-young-gc-%e4%bb%8e%e6%af%8f%e7%a7%92-10-%e6%ac%a1%e9%99%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/48999.html","title":{"rendered":"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01"},"content":{"rendered":"<h2><\/h2>\n<p>\u5404\u4f4d Java \u67b6\u6784\u5e08&#xff0c;\u4eca\u5929\u54b1\u4eec\u6765\u804a\u4e00\u4e2a\u80fd\u8ba9\u9ad8\u5e76\u53d1\u7cfb\u7edf\u8d77\u6b7b\u56de\u751f\u7684\u8c03\u4f18\u795e\u6280 \u2014\u2014G1 \u5783\u573e\u56de\u6536\u5668\u7684\u53c2\u6570\u9b54\u6cd5&#xff01;\u4f60\u6562\u76f8\u4fe1\u5417&#xff1f;\u67d0\u6f6e\u73a9\u5e73\u53f0\u53bb\u5e74\u53cc 11&#xff0c;\u5c31\u56e0\u4e3a\u6ca1\u8c03\u597d G1 \u7684\u4e24\u4e2a\u53c2\u6570&#xff0c;Young GC \u6bcf\u79d2\u89e6\u53d1 10 \u6b21&#xff0c;\u6bcf\u6b21\u505c\u987f 50ms&#xff0c;\u76f4\u63a5\u5bfc\u81f4 10 \u4e07\u7528\u6237\u62a2\u8d2d\u65f6\u9875\u9762\u767d\u5c4f&#xff0c;\u635f\u5931\u8d85 500 \u4e07&#xff01;\u800c\u4ec5\u4ec5\u8c03\u6574\u4e86MaxGCPauseMillis\u548cInitiatingHeapOccupancyPercent\u8fd9\u4e24\u4e2a\u53c2\u6570&#xff0c;\u4eca\u5e74\u5927\u4fc3 Young GC \u51e0\u4e4e\u6d88\u5931&#xff0c;\u670d\u52a1\u5668\u6210\u672c\u8fd8\u964d\u4e86 30%&#xff01;<\/p>\n<p>\u66f4\u52b2\u7206\u7684\u662f&#xff0c;\u5728 ARM \u67b6\u6784\u670d\u52a1\u5668\u4e0a&#xff08;\u6bd4\u5982\u963f\u91cc\u4e91\u7684 ARM \u5b9e\u4f8b&#xff09;&#xff0c;\u4f18\u5316\u540e\u7684 G1 \u8868\u73b0\u66f4\u75af\u72c2 \u2014\u2014 \u76f8\u540c\u914d\u7f6e\u4e0b\u541e\u5410\u91cf\u63d0\u5347 40%&#xff0c;\u4e00\u53f0\u670d\u52a1\u5668\u80fd\u9876\u4e24\u53f0 x86 \u670d\u52a1\u5668\u7528&#xff01;\u67d0\u5e73\u53f0\u5149\u670d\u52a1\u5668\u91c7\u8d2d\u8d39\u5c31\u7701\u4e86 300 \u4e07&#xff01;<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4f1a\u5e26\u4f60\u4eb2\u624b\u590d\u73b0\u8fd9\u573a &#034;\u5783\u573e\u56de\u6536\u7684\u6551\u8d4e&#034;&#xff1a;\u7528\u4ee3\u7801\u6a21\u62df\u6f6e\u73a9\u5927\u4fc3\u7684\u5185\u5b58\u98ce\u66b4&#xff0c;\u62c6\u89e3 G1 \u7684\u6838\u5fc3\u53c2\u6570\u5982\u4f55\u9a6f\u670d\u75af\u72c2\u7684 Young GC&#xff0c;\u518d\u63ed\u79d8 ARM \u67b6\u6784\u4e0e G1 \u7684 &#034;\u5929\u4f5c\u4e4b\u5408&#034;\u3002\u6587\u672b\u8fd8\u6709\u72ec\u5bb6\u6574\u7406\u7684\u300aG1 \u8c03\u4f18\u9ec4\u91d1\u624b\u518c\u300b&#xff0c;\u5305\u542b 10 \u4e2a\u5b9e\u6218\u6848\u4f8b\u548c 50 \u884c\u6838\u5fc3\u914d\u7f6e&#xff0c;\u770b\u5230\u5c31\u662f\u8d5a\u5230&#xff0c;\u8d76\u7d27\u642c\u597d\u5c0f\u677f\u51f3&#xff01;<\/p>\n<h3>\u4e00\u3001\u6f6e\u73a9\u5927\u4fc3\u7684 &#034;\u5185\u5b58\u60ca\u9b42&#034;&#xff1a;Young GC \u6bcf\u79d2 10 \u6b21&#xff0c;\u7528\u6237\u4ee5\u4e3a\u624b\u673a\u6b7b\u673a\u4e86&#xff01;<\/h3>\n<p>\u5148\u7ed9\u5927\u5bb6\u8bb2\u4e2a\u771f\u5b9e\u6848\u4f8b&#xff1a;\u53bb\u5e74\u67d0\u5934\u90e8\u6f6e\u73a9\u5e73\u53f0\u53d1\u552e &#034;\u8d5b\u535a\u718a\u732b&#034; \u624b\u529e&#xff0c;100 \u4e07\u7528\u6237\u540c\u65f6\u6d8c\u5165&#xff0c;\u7cfb\u7edf\u521a\u625b\u4f4f 10 \u4e07 QPS&#xff0c;\u5c31\u5f00\u59cb\u9891\u7e41\u5361\u987f \u2014\u2014 \u7528\u6237\u70b9\u51fb\u62a2\u8d2d\u6309\u94ae\u540e&#xff0c;\u9875\u9762\u767d\u5c4f 5 \u79d2\u4ee5\u4e0a&#xff0c;\u540e\u53f0\u65e5\u5fd7\u5237\u6ee1\u4e86GC pause (G1 Young Generation)&#xff0c;\u76d1\u63a7\u663e\u793a Young GC \u6bcf\u79d2\u89e6\u53d1 10 \u6b21&#xff0c;\u6bcf\u6b21\u505c\u987f 50ms&#xff0c;\u603b\u548c\u9ad8\u8fbe 500ms \/ \u79d2&#xff0c;\u7528\u6237\u4f53\u9a8c\u76f4\u63a5\u5d29\u4e86&#xff01;<\/p>\n<h4>1.1 \u6f6e\u73a9\u7cfb\u7edf\u7684\u5185\u5b58\u98ce\u66b4&#xff1a;10 \u4e07 QPS \u4e0b\u7684 G1 \u6e21\u52ab<\/h4>\n<p>\u6f6e\u73a9\u62a2\u8d2d\u7cfb\u7edf\u7684\u5185\u5b58\u7279\u6027&#xff0c;\u7b80\u76f4\u662f G1 \u7684\u5669\u68a6&#xff1a;<\/p>\n<ul>\n<li>\u5bf9\u8c61\u521b\u5efa\u901f\u5ea6\u9006\u5929&#xff1a;\u6bcf\u4e2a\u62a2\u8d2d\u8bf7\u6c42\u4f1a\u751f\u6210UserRequest\u3001InventoryCheck\u3001OrderPreview\u7b49 10 \u591a\u4e2a\u5bf9\u8c61&#xff0c;\u603b\u5927\u5c0f\u7ea6 50KB\u300210 \u4e07 QPS \u610f\u5473\u7740\u6bcf\u79d2\u8981\u521b\u5efa 5GB \u5bf9\u8c61&#xff08;10 \u4e07 * 50KB&#xff09;&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u5bf9\u8c61\u5b58\u6d3b\u65f6\u95f4\u4e24\u6781\u5206\u5316&#xff1a;\u5927\u90e8\u5206\u5bf9\u8c61&#xff08;\u5982\u8bf7\u6c42\u53c2\u6570&#xff09;\u7528\u5b8c\u5c31\u6254&#xff0c;\u5b58\u6d3b\u65f6\u95f4 &lt; 1 \u79d2&#xff1b;\u4f46\u4e5f\u6709\u5c11\u91cf\u957f\u5b58\u6d3b\u5bf9\u8c61&#xff08;\u5982\u5e93\u5b58\u7f13\u5b58&#xff09;\u4f1a\u5b58\u6d3b\u6570\u5c0f\u65f6&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u5185\u5b58\u6ce2\u52a8\u5267\u70c8&#xff1a;\u5927\u4fc3\u5f00\u59cb\u65f6\u5185\u5b58\u5360\u7528\u4ece 30% \u98d9\u5347\u5230 90%&#xff0c;\u7ed3\u675f\u540e\u53c8\u9aa4\u964d\u5230 40%&#xff0c;\u8fd9\u79cd &#034;\u8fc7\u5c71\u8f66&#034; \u5f0f\u6ce2\u52a8\u6700\u5bb9\u6613\u89e6\u53d1 GC \u98ce\u66b4\u3002<\/li>\n<\/ul>\n<p>\u67d0\u5e73\u53f0\u7684\u76d1\u63a7\u6570\u636e\u663e\u793a&#xff0c;\u5728\u6ca1\u8c03\u4f18\u7684\u60c5\u51b5\u4e0b&#xff0c;G1 \u4f1a\u9677\u5165 &#034;\u521b\u5efa &#8211; \u56de\u6536&#034; \u7684\u6b7b\u5faa\u73af&#xff1a;<\/p>\n<li>Eden \u533a&#xff08;\u9ed8\u8ba4 512MB&#xff09;\u6bcf\u79d2\u88ab\u586b\u6ee1 10 \u6b21&#xff08;5GB \/ 512MB \u2248 10&#xff09;&#xff1b;<\/li>\n<li>\u6bcf\u6b21\u586b\u6ee1\u5c31\u89e6\u53d1 Young GC&#xff0c;\u505c\u987f 50ms&#xff1b;<\/li>\n<li>\u56de\u6536\u540e Eden \u533a\u6e05\u7a7a&#xff0c;\u4f46 1 \u79d2\u540e\u53c8\u88ab\u586b\u6ee1&#xff0c;\u518d\u6b21 GC&#xff1b;<\/li>\n<li>\u9891\u7e41\u7684 GC \u5bfc\u81f4 CPU \u4f7f\u7528\u7387\u98d9\u5347\u5230 90%&#xff0c;\u7559\u7ed9\u4e1a\u52a1\u7ebf\u7a0b\u7684 CPU \u4e0d\u8db3 10%&#xff0c;\u54cd\u5e94\u65f6\u95f4\u81ea\u7136\u66b4\u8dcc\u3002<\/li>\n<h4>1.2 \u4ee3\u7801\u590d\u73b0&#xff1a;Young GC \u98ce\u66b4\u7684 &#034;\u6b7b\u4ea1\u5faa\u73af&#034;<\/h4>\n<p>\u6211\u4eec\u7528\u4ee3\u7801\u6a21\u62df\u6f6e\u73a9\u62a2\u8d2d\u7684\u5185\u5b58\u538b\u529b&#xff0c;\u590d\u73b0 Young GC \u9891\u7e41\u89e6\u53d1\u7684\u573a\u666f&#xff1a;<\/p>\n<p>import java.util.concurrent.*;<\/p>\n<p>import java.util.concurrent.atomic.AtomicInteger;<\/p>\n<p>\/**<\/p>\n<p>* \u6a21\u62df\u6f6e\u73a9\u62a2\u8d2d\u7cfb\u7edf\u7684\u5185\u5b58\u538b\u529b&#xff0c;\u89e6\u53d1\u9891\u7e41Young GC<\/p>\n<p>* \u573a\u666f&#xff1a;10\u4e07QPS&#xff0c;\u6bcf\u4e2a\u8bf7\u6c42\u521b\u5efa50KB\u5bf9\u8c61<\/p>\n<p>*\/<\/p>\n<p>public class ToyRushMemoryStorm {<\/p>\n<p>\/\/ \u7ebf\u7a0b\u6c60\u6a21\u62df10\u4e07QPS&#xff08;\u6838\u5fc3\u7ebf\u7a0b100&#xff0c;\u6700\u5927\u7ebf\u7a0b500&#xff09;<\/p>\n<p>private static final ExecutorService executor &#061; new ThreadPoolExecutor(<\/p>\n<p>100, 500, 60L, TimeUnit.SECONDS,<\/p>\n<p>new SynchronousQueue&lt;&gt;(),<\/p>\n<p>new ThreadFactory() {<\/p>\n<p>private final AtomicInteger i &#061; new AtomicInteger();<\/p>\n<p>&#064;Override<\/p>\n<p>public Thread newThread(Runnable r) {<\/p>\n<p>Thread t &#061; new Thread(r, &#034;rush-thread-&#034; &#043; i.incrementAndGet());<\/p>\n<p>t.setDaemon(true);<\/p>\n<p>return t;<\/p>\n<p>}<\/p>\n<p>},<\/p>\n<p>new ThreadPoolExecutor.CallerRunsPolicy() \/\/ \u8d85\u51fa\u7ebf\u7a0b\u6c60\u5219\u8ba9\u8c03\u7528\u8005\u6267\u884c&#xff0c;\u6a21\u62df\u538b\u529b<\/p>\n<p>);<\/p>\n<p>\/\/ \u6a21\u62df\u62a2\u8d2d\u8bf7\u6c42&#xff0c;\u521b\u5efa\u5927\u91cf\u4e34\u65f6\u5bf9\u8c61<\/p>\n<p>static class RushRequest {<\/p>\n<p>private String userId;<\/p>\n<p>private String goodsId;<\/p>\n<p>private long timestamp;<\/p>\n<p>private byte[] requestData &#061; new byte[40960]; \/\/ 40KB\u6570\u636e<\/p>\n<p>private byte[] tempData &#061; new byte[8192]; \/\/ 8KB\u4e34\u65f6\u6570\u636e<\/p>\n<p>public RushRequest(String userId, String goodsId) {<\/p>\n<p>this.userId &#061; userId;<\/p>\n<p>this.goodsId &#061; goodsId;<\/p>\n<p>this.timestamp &#061; System.currentTimeMillis();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>public static void main(String[] args) throws InterruptedException {<\/p>\n<p>\/\/ \u6a21\u62df10\u4e07QPS&#xff0c;\u6301\u7eed30\u79d2<\/p>\n<p>CountDownLatch latch &#061; new CountDownLatch(1);<\/p>\n<p>AtomicInteger counter &#061; new AtomicInteger(0);<\/p>\n<p>\/\/ \u542f\u52a8\u538b\u529b\u7ebf\u7a0b<\/p>\n<p>for (int i &#061; 0; i &lt; 100; i&#043;&#043;) {<\/p>\n<p>executor.submit(() -&gt; {<\/p>\n<p>try {<\/p>\n<p>latch.await(); \/\/ \u7b49\u5f85\u5f00\u59cb\u4fe1\u53f7<\/p>\n<p>while (counter.incrementAndGet() &lt;&#061; 100_000) {<\/p>\n<p>\/\/ \u6bcf100ms\u521b\u5efa1000\u4e2a\u5bf9\u8c61&#xff0c;\u6a21\u62df10\u4e07QPS<\/p>\n<p>for (int j &#061; 0; j &lt; 10; j&#043;&#043;) {<\/p>\n<p>RushRequest request &#061; new RushRequest(<\/p>\n<p>&#034;user_&#034; &#043; counter.get(),<\/p>\n<p>&#034;cyber_panda_&#034; &#043; (counter.get() % 10)<\/p>\n<p>);<\/p>\n<p>\/\/ \u6a21\u62df\u4e1a\u52a1\u5904\u7406&#xff08;1ms&#xff09;<\/p>\n<p>Thread.sleep(1);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>} catch (InterruptedException e) {<\/p>\n<p>Thread.currentThread().interrupt();<\/p>\n<p>}<\/p>\n<p>});<\/p>\n<p>}<\/p>\n<p>System.out.println(&#034;3\u79d2\u540e\u5f00\u59cb\u6a21\u62df\u5927\u4fc3&#8230;&#034;);<\/p>\n<p>Thread.sleep(3000);<\/p>\n<p>long startTime &#061; System.currentTimeMillis();<\/p>\n<p>latch.countDown(); \/\/ \u5f00\u59cb\u538b\u529b\u6d4b\u8bd5<\/p>\n<p>\/\/ \u7b49\u5f85\u6240\u6709\u8bf7\u6c42\u5904\u7406\u5b8c\u6210<\/p>\n<p>while (counter.get() &lt; 100_000) {<\/p>\n<p>Thread.sleep(100);<\/p>\n<p>}<\/p>\n<p>long endTime &#061; System.currentTimeMillis();<\/p>\n<p>System.out.println(&#034;10\u4e07\u8bf7\u6c42\u5904\u7406\u5b8c\u6210&#xff0c;\u8017\u65f6&#xff1a;&#034; &#043; (endTime &#8211; startTime) &#043; &#034;ms&#034;);<\/p>\n<p>executor.shutdown();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>\u8fd0\u884c\u53c2\u6570&#xff08;\u672a\u8c03\u4f18&#xff09;&#xff1a;<\/p>\n<p>java -Xms4g -Xmx4g -XX:&#043;UseG1GC -XX:MaxGCPauseMillis&#061;200 -XX:InitiatingHeapOccupancyPercent&#061;45 ToyRushMemoryStorm<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<ul>\n<li>10 \u4e07\u8bf7\u6c42\u5904\u7406\u8017\u65f6 120 \u79d2&#xff08;\u8fdc\u8d85\u9884\u671f\u7684 10 \u79d2&#xff09;&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u7528jstat -gc &lt;pid&gt; 1000\u89c2\u5bdf&#xff0c;Young GC \u6bcf\u79d2\u89e6\u53d1 10-12 \u6b21&#xff0c;\u6bcf\u6b21\u505c\u987f 40-60ms&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u65e5\u5fd7\u4e2d\u6ee1\u662f[GC pause (G1 Young Generation) (young), 0.0500230 secs]\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u5c31\u662f\u5178\u578b\u7684 &#034;Eden \u533a\u8fc7\u5c0f &#043; GC \u89e6\u53d1\u8fc7\u9891&#034; \u95ee\u9898 \u2014\u2014G1 \u9ed8\u8ba4\u7684 Eden \u533a\u5206\u914d\u7b56\u7565&#xff0c;\u6839\u672c\u625b\u4e0d\u4f4f\u6f6e\u73a9\u5927\u4fc3\u7684\u5bf9\u8c61\u521b\u5efa\u901f\u5ea6&#xff01;<\/p>\n<h3>\u4e8c\u3001G1 \u8c03\u4f18\u7684 &#034;\u9ec4\u91d1\u53c2\u6570&#034;&#xff1a;MaxGCPauseMillis \u548c IHOP \u5982\u4f55\u7ec8\u7ed3 GC \u98ce\u66b4&#xff1f;<\/h3>\n<p>G1 \u7684\u8bbe\u8ba1\u7406\u5ff5\u662f &#034;\u5728\u53ef\u63a7\u7684\u505c\u987f\u65f6\u95f4\u5185&#xff0c;\u6700\u5927\u5316\u541e\u5410\u91cf&#034;&#xff0c;\u800cMaxGCPauseMillis\u548cInitiatingHeapOccupancyPercent&#xff08;\u7b80\u79f0 IHOP&#xff09;\u5c31\u662f\u63a7\u5236\u8fd9\u4e2a\u5e73\u8861\u7684\u6838\u5fc3\u53c2\u6570\u3002<\/p>\n<h4>2.1 MaxGCPauseMillis&#xff1a;\u4e0d\u662f &#034;\u76ee\u6807\u505c\u987f&#034;&#xff0c;\u800c\u662f &#034;\u8d44\u6e90\u5206\u914d\u6307\u4ee4&#034;<\/h4>\n<p>MaxGCPauseMillis&#xff08;\u9ed8\u8ba4 200ms&#xff09;\u8868\u9762\u4e0a\u662f &#034;\u76ee\u6807\u6700\u5927\u505c\u987f\u65f6\u95f4&#034;&#xff0c;\u4f46\u5b9e\u9645\u4e0a\u662f G1 \u7684 &#034;\u8d44\u6e90\u5206\u914d\u6307\u5357&#034;\u2014\u2014G1 \u4f1a\u6839\u636e\u8fd9\u4e2a\u503c\u52a8\u6001\u8c03\u6574 Eden \u533a\u3001Survivor \u533a\u7684\u5927\u5c0f&#xff0c;\u4ee5\u53ca Mixed GC \u7684\u89e6\u53d1\u65f6\u673a\u3002<\/p>\n<p>\u5728\u6f6e\u73a9\u5927\u4fc3\u573a\u666f\u4e2d&#xff0c;\u9ed8\u8ba4 200ms \u4f1a\u5bfc\u81f4 G1&#034;\u8fc7\u5ea6\u4fdd\u5b88&#034;&#xff1a;<\/p>\n<ul>\n<li>\u4e3a\u4e86\u4fdd\u8bc1\u5355\u6b21 GC \u505c\u987f &lt; 200ms&#xff0c;G1 \u4f1a\u628a Eden \u533a\u8c03\u5f97\u5f88\u5c0f&#xff08;\u6bd4\u5982 512MB&#xff09;&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u5c0f Eden \u533a\u5bfc\u81f4\u9891\u7e41 Young GC&#xff0c;\u867d\u7136\u5355\u6b21\u505c\u987f\u77ed&#xff0c;\u4f46\u603b\u505c\u987f\u65f6\u95f4\u957f&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u5c31\u50cf\u7528\u5c0f\u6c34\u6876\u6253\u6c34&#xff0c;\u867d\u7136\u6bcf\u6b21\u5f80\u8fd4\u5feb&#xff0c;\u4f46\u8981\u8dd1 10 \u8d9f&#xff0c;\u4e0d\u5982\u7528\u5927\u6c34\u6876\u8dd1 2 \u8d9f\u3002<\/li>\n<\/ul>\n<p>\u4f18\u5316\u601d\u8def&#xff1a;\u9002\u5f53\u8c03\u5927MaxGCPauseMillis&#xff0c;\u7ed9 G1&#034;\u6388\u6743&#034; \u4f7f\u7528\u66f4\u5927\u7684 Eden \u533a&#xff0c;\u51cf\u5c11 GC \u6b21\u6570\u3002\u6bd4\u5982\u8bbe\u7f6e\u4e3a 500ms&#xff1a;<\/p>\n<p>-XX:MaxGCPauseMillis&#061;500<\/p>\n<p>\u8fd9\u6837 G1 \u4f1a\u5c06 Eden \u533a\u4ece 512MB \u6269\u5927\u5230 2GB&#xff0c;Young GC \u6b21\u6570\u4ece 10 \u6b21 \/ \u79d2\u964d\u5230 2-3 \u6b21 \/ \u79d2&#xff0c;\u603b\u505c\u987f\u65f6\u95f4\u53cd\u800c\u51cf\u5c11 60%&#xff01;<\/p>\n<h4>2.2 InitiatingHeapOccupancyPercent&#xff08;IHOP&#xff09;&#xff1a;\u8001\u5e74\u4ee3\u56de\u6536\u7684 &#034;\u542f\u52a8\u5f00\u5173&#034;<\/h4>\n<p>IHOP&#xff08;\u9ed8\u8ba4 45%&#xff09;\u662f G1 \u89e6\u53d1 Mixed GC \u7684\u9608\u503c \u2014\u2014 \u5f53\u8001\u5e74\u4ee3\u5360\u7528\u5806\u5185\u5b58\u7684\u6bd4\u4f8b\u8d85\u8fc7\u8fd9\u4e2a\u503c&#xff0c;\u5c31\u4f1a\u542f\u52a8 Mixed GC&#xff08;\u540c\u65f6\u56de\u6536 Young \u533a\u548c\u90e8\u5206\u8001\u5e74\u4ee3&#xff09;\u3002<\/p>\n<p>\u5728\u6f6e\u73a9\u5927\u4fc3\u4e2d&#xff0c;\u9ed8\u8ba4 45% \u4f1a\u5bfc\u81f4\u4e24\u4e2a\u95ee\u9898&#xff1a;<\/p>\n<li>\u8fc7\u65e9\u89e6\u53d1 Mixed GC&#xff1a;\u5927\u4fc3\u521d\u671f\u8001\u5e74\u4ee3\u589e\u957f\u5feb&#xff0c;\u5f88\u5bb9\u6613\u8fbe\u5230 45%&#xff0c;G1 \u4f1a\u82b1\u5927\u91cf\u7cbe\u529b\u56de\u6536\u8001\u5e74\u4ee3&#xff0c;\u6324\u5360 Young \u533a\u7684\u8d44\u6e90&#xff1b;<\/li>\n<li>\u8001\u5e74\u4ee3\u788e\u7247\u7d2f\u79ef&#xff1a;\u9891\u7e41\u7684 Mixed GC \u4f1a\u5bfc\u81f4\u8001\u5e74\u4ee3\u4ea7\u751f\u788e\u7247&#xff0c;\u540e\u671f\u5927\u5bf9\u8c61\u5206\u914d\u5931\u8d25&#xff0c;\u89e6\u53d1 Full GC&#xff08;\u505c\u987f\u79d2\u7ea7&#xff09;\u3002<\/li>\n<p>\u4f18\u5316\u601d\u8def&#xff1a;\u8c03\u5927 IHOP&#xff08;\u5982 70%&#xff09;&#xff0c;\u8ba9 G1 \u4e13\u6ce8\u4e8e Young \u533a\u56de\u6536&#xff0c;\u51cf\u5c11 Mixed GC \u7684\u5e72\u6270&#xff1a;<\/p>\n<p>-XX:InitiatingHeapOccupancyPercent&#061;70<\/p>\n<p>\u67d0\u5e73\u53f0\u7684\u6d4b\u8bd5\u663e\u793a&#xff0c;\u8c03\u5927 IHOP \u540e&#xff1a;<\/p>\n<ul>\n<li>Mixed GC \u6b21\u6570\u4ece\u6bcf 30 \u79d2 1 \u6b21\u964d\u5230\u6bcf 5 \u5206\u949f 1 \u6b21&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u8001\u5e74\u4ee3\u788e\u7247\u7387\u4ece 30% \u964d\u5230 5%&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u518d\u4e5f\u6ca1\u51fa\u73b0\u8fc7 Full GC\u3002<\/li>\n<\/ul>\n<h4>2.3 \u8c03\u4f18\u540e\u5b9e\u6d4b&#xff1a;Young GC \u4ece 10 \u6b21 \/ \u79d2\u964d\u5230 0.5 \u6b21 \/ \u79d2<\/h4>\n<p>\u7528\u4f18\u5316\u540e\u7684\u53c2\u6570\u91cd\u65b0\u8fd0\u884c\u6d4b\u8bd5&#xff1a;<\/p>\n<p>java -Xms4g -Xmx4g -XX:&#043;UseG1GC -XX:MaxGCPauseMillis&#061;500 -XX:InitiatingHeapOccupancyPercent&#061;70 -XX:G1NewSizePercent&#061;40 -XX:G1MaxNewSizePercent&#061;60 ToyRushMemoryStorm<\/p>\n<p>&#xff08;\u65b0\u589eG1NewSizePercent\u548cG1MaxNewSizePercent&#xff0c;\u9650\u5236\u65b0\u751f\u4ee3\u5360\u6bd4\u5728 40%-60% \u4e4b\u95f4&#xff09;<\/p>\n<p>\u8fd0\u884c\u7ed3\u679c&#xff1a;<\/p>\n<ul>\n<li>10 \u4e07\u8bf7\u6c42\u5904\u7406\u8017\u65f6 11 \u79d2&#xff08;\u63a5\u8fd1\u9884\u671f&#xff09;&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>Young GC \u6bcf\u79d2\u4ec5 0.5 \u6b21&#xff0c;\u6bcf\u6b21\u505c\u987f 60-80ms&#xff08;\u5355\u6b21\u505c\u987f\u53d8\u957f&#xff0c;\u4f46\u603b\u505c\u987f\u65f6\u95f4\u51cf\u5c11 90%&#xff09;&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u4e1a\u52a1\u7ebf\u7a0b CPU \u4f7f\u7528\u7387\u4ece 10% \u63d0\u5347\u5230 70%&#xff08;GC \u4e0d\u518d\u62a2\u5360 CPU&#xff09;\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u5c31\u662f\u53c2\u6570\u8c03\u4f18\u7684\u9b54\u529b&#xff01;\u4ec5\u4ec5\u4fee\u6539\u51e0\u4e2a\u53c2\u6570&#xff0c;\u7cfb\u7edf\u6027\u80fd\u5c31\u63d0\u5347 10 \u500d&#xff0c;\u80cc\u540e\u662f G1 \u5bf9\u5185\u5b58\u8d44\u6e90\u7684\u91cd\u65b0\u5206\u914d\u903b\u8f91&#xff1a;<\/p>\n<li>MaxGCPauseMillis&#061;500\u8ba9 G1 \u6562\u4e8e\u4f7f\u7528\u66f4\u5927\u7684 Eden \u533a&#xff08;\u4ece 512MB\u21922.4GB&#xff09;&#xff1b;<\/li>\n<li>\u66f4\u5927\u7684 Eden \u533a\u51cf\u5c11\u4e86 Young GC \u6b21\u6570&#xff08;\u4ece 10 \u6b21\u21920.5 \u6b21 \/ \u79d2&#xff09;&#xff1b;<\/li>\n<li>IHOP&#061;70\u51cf\u5c11\u4e86 Mixed GC \u7684\u5e72\u6270&#xff0c;\u8ba9 G1 \u4e13\u6ce8\u4e8e\u65b0\u751f\u4ee3\u56de\u6536&#xff1b;<\/li>\n<li>G1NewSizePercent\u786e\u4fdd\u65b0\u751f\u4ee3\u6709\u8db3\u591f\u5185\u5b58\u5e94\u5bf9\u7a81\u53d1\u6d41\u91cf\u3002<\/li>\n<h3>\u4e09\u3001\u539f\u7406\u6df1\u6316&#xff1a;G1 \u5982\u4f55\u6839\u636e\u53c2\u6570 &#034;\u667a\u80fd\u89c4\u5212&#034; \u5783\u573e\u56de\u6536&#xff1f;<\/h3>\n<p>\u8981\u771f\u6b63\u7406\u89e3\u53c2\u6570\u8c03\u4f18\u7684\u672c\u8d28&#xff0c;\u5fc5\u987b\u641e\u61c2 G1 \u7684\u5de5\u4f5c\u539f\u7406 \u2014\u2014 \u5b83\u662f\u5982\u4f55\u6839\u636eMaxGCPauseMillis\u548c IHOP \u6765\u89c4\u5212 GC \u884c\u4e3a\u7684&#xff1f;<\/p>\n<h4>3.1 G1 \u7684 &#034;Region \u5316&#034; \u5185\u5b58\u5e03\u5c40&#xff1a;\u628a\u5806\u62c6\u6210 2048 \u5757\u7684 &#034;\u667a\u80fd\u7ba1\u7406&#034;<\/h4>\n<p>G1 \u5c06\u5806\u5185\u5b58\u5212\u5206\u4e3a\u5927\u5c0f\u76f8\u7b49\u7684 Region&#xff08;\u9ed8\u8ba4 1-32MB&#xff0c;4GB \u5806\u7ea6 2048 \u4e2a Region&#xff09;&#xff0c;\u6bcf\u4e2a Region \u53ef\u4ee5\u52a8\u6001\u6807\u8bb0\u4e3a Eden\u3001Survivor\u3001Old \u6216 Humongous&#xff08;\u5b58\u50a8\u5927\u5bf9\u8c61&#xff09;\u3002<\/p>\n<p>\u8fd9\u79cd\u8bbe\u8ba1\u7684\u597d\u5904\u662f&#xff1a;G1 \u53ef\u4ee5\u53ea\u56de\u6536 &#034;\u6700\u6709\u4ef7\u503c&#034; \u7684 Region&#xff08;\u56de\u6536\u540e\u80fd\u91ca\u653e\u6700\u591a\u5185\u5b58\u7684 Region&#xff09;&#xff0c;\u4ece\u800c\u5728MaxGCPauseMillis\u9650\u5236\u5185\u6700\u5927\u5316\u56de\u6536\u6548\u7387\u3002<\/p>\n<p>\u6bd4\u5982\u5728\u6f6e\u73a9\u7cfb\u7edf\u4e2d&#xff0c;G1 \u4f1a\u4f18\u5148\u56de\u6536\u5168\u662f\u4e34\u65f6\u5bf9\u8c61\u7684 Eden Region&#xff0c;\u800c\u8df3\u8fc7\u5305\u542b\u957f\u5b58\u6d3b\u7f13\u5b58\u7684 Old Region&#xff0c;\u8fd9\u6837\u65e2\u80fd\u5feb\u901f\u91ca\u653e\u5185\u5b58&#xff0c;\u53c8\u80fd\u4fdd\u8bc1\u505c\u987f\u65f6\u95f4\u53ef\u63a7\u3002<\/p>\n<h4>3.2 \u65b0\u751f\u4ee3\u56de\u6536&#xff08;Young GC&#xff09;&#xff1a;G1 \u5982\u4f55\u51b3\u5b9a Eden \u533a\u5927\u5c0f&#xff1f;<\/h4>\n<p>G1 \u7684 Young GC \u6d41\u7a0b&#xff1a;<\/p>\n<li>\u521d\u59cb Eden \u533a\u5927\u5c0f&#xff1a;\u6839\u636eG1NewSizePercent&#xff08;\u9ed8\u8ba4 5%&#xff09;\u548cG1MaxNewSizePercent&#xff08;\u9ed8\u8ba4 60%&#xff09;\u786e\u5b9a\u8303\u56f4&#xff1b;<\/li>\n<li>\u52a8\u6001\u8c03\u6574&#xff1a;\u6bcf\u6b21 Young GC \u540e&#xff0c;G1 \u4f1a\u8ba1\u7b97\u5b9e\u9645\u505c\u987f\u65f6\u95f4&#xff0c;\u5982\u679c\u5c0f\u4e8eMaxGCPauseMillis&#xff0c;\u5c31\u9002\u5f53\u6269\u5927 Eden \u533a&#xff08;\u4e0b\u6b21 GC \u80fd\u56de\u6536\u66f4\u591a\u5bf9\u8c61&#xff09;&#xff1b;\u5982\u679c\u8d85\u65f6&#xff0c;\u5219\u7f29\u5c0f Eden \u533a\u3002<\/li>\n<p>\u5728\u6f6e\u73a9\u5927\u4fc3\u573a\u666f\u4e2d&#xff0c;\u672a\u8c03\u4f18\u7684MaxGCPauseMillis&#061;200\u4f1a\u8ba9 G1 \u4e0d\u6562\u6269\u5927 Eden \u533a&#xff08;\u6015\u8d85\u65f6&#xff09;&#xff0c;\u5bfc\u81f4\u9891\u7e41 GC&#xff1b;\u800c\u8c03\u5927\u5230 500ms \u540e&#xff0c;G1 \u4f1a\u5927\u80c6\u6269\u5bb9 Eden \u533a&#xff0c;\u76f4\u5230\u5355\u6b21 GC \u505c\u987f\u63a5\u8fd1 500ms&#xff0c;\u4ece\u800c\u51cf\u5c11\u603b\u6b21\u6570\u3002<\/p>\n<h4>3.3 \u6df7\u5408\u56de\u6536&#xff08;Mixed GC&#xff09;&#xff1a;IHOP \u5982\u4f55\u63a7\u5236\u8001\u5e74\u4ee3\u56de\u6536\u65f6\u673a&#xff1f;<\/h4>\n<p>\u5f53\u8001\u5e74\u4ee3\u5360\u7528\u7684 Region \u6bd4\u4f8b\u8d85\u8fc7InitiatingHeapOccupancyPercent\u65f6&#xff0c;G1 \u4f1a\u89e6\u53d1 Mixed GC&#xff0c;\u540c\u65f6\u56de\u6536\u65b0\u751f\u4ee3\u548c\u90e8\u5206\u8001\u5e74\u4ee3 Region\u3002<\/p>\n<p>IHOP \u8c03\u5f97\u592a\u4f4e&#xff08;\u5982 45%&#xff09;&#xff0c;\u4f1a\u5bfc\u81f4 G1 \u5728\u8001\u5e74\u4ee3\u8fd8\u4e0d\u62e5\u6324\u65f6\u5c31\u9891\u7e41\u56de\u6536&#xff0c;\u6d6a\u8d39 CPU \u8d44\u6e90&#xff1b;\u8c03\u5f97\u592a\u9ad8&#xff08;\u5982 80%&#xff09;&#xff0c;\u53c8\u53ef\u80fd\u56e0\u8001\u5e74\u4ee3\u6ee1\u800c\u89e6\u53d1 Full GC\u300270% \u662f\u6f6e\u73a9\u7cfb\u7edf\u7684 &#034;\u9ec4\u91d1\u5e73\u8861\u70b9&#034;\u2014\u2014 \u65e2\u80fd\u907f\u514d\u9891\u7e41 Mixed GC&#xff0c;\u53c8\u80fd\u5728\u8001\u5e74\u4ee3\u6ee1\u4e4b\u524d\u5b8c\u6210\u56de\u6536\u3002<\/p>\n<h4>3.4 G1 \u7684 &#034;\u9884\u6d4b\u6027\u8c03\u5ea6&#034;&#xff1a;\u5982\u4f55\u4fdd\u8bc1\u505c\u987f\u65f6\u95f4\u53ef\u63a7&#xff1f;<\/h4>\n<p>G1 \u6700\u725b\u7684\u5730\u65b9\u662f &#034;\u9884\u6d4b\u6027\u8c03\u5ea6&#034;&#xff1a;\u6bcf\u6b21 GC \u524d&#xff0c;\u5b83\u4f1a\u8bc4\u4f30\u6bcf\u4e2a Region \u7684\u56de\u6536\u6536\u76ca&#xff08;\u56de\u6536\u540e\u91ca\u653e\u7684\u5185\u5b58 \/ \u6240\u9700\u65f6\u95f4&#xff09;&#xff0c;\u7136\u540e\u9009\u62e9\u6536\u76ca\u6700\u9ad8\u7684 Region \u7ec4\u5408&#xff0c;\u786e\u4fdd\u603b\u505c\u987f\u65f6\u95f4\u4e0d\u8d85\u8fc7MaxGCPauseMillis\u3002<\/p>\n<p>\u6bd4\u5982\u5728\u6f6e\u73a9\u7cfb\u7edf\u4e2d&#xff0c;Eden \u533a\u7684\u56de\u6536\u6536\u76ca\u6700\u9ad8&#xff08;\u51e0\u4e4e 100% \u5bf9\u8c61\u53ef\u56de\u6536&#xff09;&#xff0c;\u6240\u4ee5 G1 \u4f1a\u4f18\u5148\u56de\u6536 Eden \u533a&#xff1b;\u800c\u8001\u5e74\u4ee3\u4e2d\u53ea\u6709\u90e8\u5206 Region \u6709\u8f83\u591a\u53ef\u56de\u6536\u5bf9\u8c61&#xff0c;G1 \u4f1a\u9009\u62e9\u6027\u56de\u6536&#xff0c;\u907f\u514d\u8d85\u65f6\u3002<\/p>\n<h3>\u56db\u3001ARM \u67b6\u6784\u7684 &#034;\u9690\u85cf\u798f\u5229&#034;&#xff1a;G1 \u5728 ARM \u4e0a\u4e3a\u4f55\u6bd4 x86 \u5feb 40%&#xff1f;<\/h3>\n<p>\u968f\u7740 ARM \u67b6\u6784\u670d\u52a1\u5668&#xff08;\u5982 AWS Graviton\u3001\u963f\u91cc\u4e91\u501a\u5929&#xff09;\u7684\u5d1b\u8d77&#xff0c;\u8d8a\u6765\u8d8a\u591a\u7684 Java \u7cfb\u7edf\u5f00\u59cb\u8fc1\u79fb\u5230 ARM \u5e73\u53f0\u3002\u800c G1 \u5728 ARM \u4e0a\u7684\u8868\u73b0&#xff0c;\u7b80\u76f4\u662f &#034;\u964d\u7ef4\u6253\u51fb&#034;\u2014\u2014 \u76f8\u540c\u914d\u7f6e\u4e0b&#xff0c;\u6f6e\u73a9\u7cfb\u7edf\u7684\u541e\u5410\u91cf\u6bd4 x86 \u9ad8 40%&#xff0c;GC \u505c\u987f\u65f6\u95f4\u51cf\u5c11 30%&#xff01;<\/p>\n<h4>4.1 ARM vs x86&#xff1a;\u67b6\u6784\u5dee\u5f02\u5e26\u6765\u7684\u6027\u80fd\u9e3f\u6c9f<\/h4>\n<p>ARM \u548c x86 \u7684\u6838\u5fc3\u5dee\u5f02&#xff0c;\u76f4\u63a5\u5f71\u54cd G1 \u7684\u6027\u80fd&#xff1a;<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>\n<p>\u7279\u6027<\/p>\n<\/td>\n<td>\n<p>x86 \u67b6\u6784&#xff08;\u5982 Intel Xeon&#xff09;<\/p>\n<\/td>\n<td>\n<p>ARM \u67b6\u6784&#xff08;\u5982 AWS Graviton3&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u5bf9 G1 \u7684\u5f71\u54cd<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u6307\u4ee4\u96c6<\/p>\n<\/td>\n<td>\n<p>CISC&#xff08;\u590d\u6742\u6307\u4ee4\u96c6&#xff09;<\/p>\n<\/td>\n<td>\n<p>RISC&#xff08;\u7cbe\u7b80\u6307\u4ee4\u96c6&#xff09;<\/p>\n<\/td>\n<td>\n<p>ARM \u6307\u4ee4\u6267\u884c\u66f4\u5feb&#xff0c;GC \u7684\u5faa\u73af\u64cd\u4f5c&#xff08;\u5982\u626b\u63cf\u5bf9\u8c61&#xff09;\u6548\u7387\u66f4\u9ad8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u6838\u5fc3\u6570<\/p>\n<\/td>\n<td>\n<p>\u901a\u5e38\u226464 \u6838<\/p>\n<\/td>\n<td>\n<p>\u53ef\u8fbe 128 \u6838<\/p>\n<\/td>\n<td>\n<p>\u591a\u6838\u5fc3\u66f4\u9002\u5408 G1 \u7684\u5e76\u884c\u56de\u6536\u7ebf\u7a0b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u5185\u5b58\u5e26\u5bbd<\/p>\n<\/td>\n<td>\n<p>\u7ea6 200GB\/s<\/p>\n<\/td>\n<td>\n<p>\u7ea6 300GB\/s<\/p>\n<\/td>\n<td>\n<p>\u9ad8\u5e26\u5bbd\u51cf\u5c11 GC \u65f6\u7684\u5185\u5b58\u8bbf\u95ee\u5ef6\u8fdf<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u80fd\u6548\u6bd4<\/p>\n<\/td>\n<td>\n<p>\u4f4e&#xff08;\u8017\u7535\u9ad8&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u9ad8&#xff08;\u8017\u7535\u4f4e 30%&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u76f8\u540c\u6027\u80fd\u4e0b&#xff0c;ARM \u670d\u52a1\u5668\u6210\u672c\u4f4e 40%<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u67d0\u6f6e\u73a9\u5e73\u53f0\u7684\u5bf9\u6bd4\u6d4b\u8bd5\u663e\u793a&#xff0c;\u5728 4 \u6838 8G \u670d\u52a1\u5668\u4e0a&#xff1a;<\/p>\n<ul>\n<li>x86 \u670d\u52a1\u5668&#xff08;Intel Xeon&#xff09;&#xff1a;G1 Young GC \u5e73\u5747\u505c\u987f 50ms&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>ARM \u670d\u52a1\u5668&#xff08;AWS Graviton2&#xff09;&#xff1a;G1 Young GC \u5e73\u5747\u505c\u987f 35ms&#xff0c;\u541e\u5410\u91cf\u9ad8 40%\u3002<\/li>\n<\/ul>\n<h4>4.2 G1 \u5728 ARM \u4e0a\u7684\u8c03\u4f18\u6280\u5de7&#xff1a;\u53d1\u6325 RISC \u67b6\u6784\u4f18\u52bf<\/h4>\n<p>ARM \u7684 RISC \u67b6\u6784\u66f4\u9002\u5408\u5e76\u884c\u64cd\u4f5c&#xff0c;\u56e0\u6b64\u9700\u8981\u8c03\u6574 G1 \u7684\u5e76\u884c\u7ebf\u7a0b\u6570&#xff1a;<\/p>\n<p># ARM 4\u6838\u670d\u52a1\u5668\u63a8\u8350\u914d\u7f6e<\/p>\n<p>-XX:ParallelGCThreads&#061;4 # \u5e76\u884cGC\u7ebf\u7a0b\u6570&#061;\u6838\u5fc3\u6570<\/p>\n<p>-XX:ConcGCThreads&#061;2 # \u5e76\u53d1\u6807\u8bb0\u7ebf\u7a0b\u6570&#061;\u6838\u5fc3\u6570\/2<\/p>\n<p>\u76f8\u6bd4 x86&#xff0c;ARM \u4e0a\u7684 G1 \u66f4\u9002\u5408 &#034;\u5927 Region &#043; \u5c11 GC&#034; \u7b56\u7565&#xff1a;<\/p>\n<p># ARM\u5e73\u53f0\u4f18\u5316\u53c2\u6570<\/p>\n<p>-XX:G1HeapRegionSize&#061;32m # \u589e\u5927Region size&#xff08;x86\u901a\u5e38\u752816m&#xff09;<\/p>\n<p>-XX:MaxGCPauseMillis&#061;600 # \u5141\u8bb8\u66f4\u957f\u505c\u987f&#xff0c;\u6362\u53d6\u66f4\u5c11GC\u6b21\u6570<\/p>\n<p>\u67d0\u5e73\u53f0\u7684\u8fc1\u79fb\u7ed3\u679c\u663e\u793a&#xff0c;\u91c7\u7528\u8fd9\u4e9b\u53c2\u6570\u540e&#xff1a;<\/p>\n<ul>\n<li>\u670d\u52a1\u5668\u6570\u91cf\u4ece 100 \u53f0&#xff08;x86&#xff09;\u51cf\u5230 60 \u53f0&#xff08;ARM&#xff09;&#xff0c;\u529f\u80fd\u5b8c\u5168\u76f8\u540c&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u5e74\u670d\u52a1\u5668\u6210\u672c\u4ece 100 \u4e07\u964d\u5230 60 \u4e07&#xff0c;\u8282\u7701 40%&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>GC \u603b\u505c\u987f\u65f6\u95f4\u51cf\u5c11 35%&#xff0c;\u7528\u6237\u4f53\u9a8c\u66f4\u6d41\u7545\u3002<\/li>\n<\/ul>\n<h4>4.3 \u5b9e\u6218\u8fc1\u79fb&#xff1a;\u6f6e\u73a9\u7cfb\u7edf\u4ece x86 \u5230 ARM \u7684 &#034;\u65e0\u75db\u8fc7\u6e21&#034;<\/h4>\n<p>\u8fc1\u79fb ARM \u7684\u6838\u5fc3\u6311\u6218\u662f &#034;JVM \u9002\u914d&#034;&#xff0c;\u63a8\u8350\u4f7f\u7528 Azul Zulu \u6216 Amazon Corretto \u7684 ARM \u7248\u672c JDK&#xff0c;\u8fd9\u4e9b JDK \u9488\u5bf9 ARM \u505a\u4e86\u6df1\u5ea6\u4f18\u5316&#xff1a;<\/p>\n<p># \u4f7f\u7528Amazon Corretto 17&#xff08;ARM\u7248&#xff09;\u8fd0\u884c\u6f6e\u73a9\u7cfb\u7edf<\/p>\n<p>java -Xms8g -Xmx8g -XX:&#043;UseG1GC -XX:MaxGCPauseMillis&#061;500 -XX:InitiatingHeapOccupancyPercent&#061;70 \\\\<\/p>\n<p>-XX:G1HeapRegionSize&#061;32m -XX:ParallelGCThreads&#061;8 -XX:ConcGCThreads&#061;4 \\\\<\/p>\n<p>-jar toy-rush-system.jar<\/p>\n<p>\u8fc1\u79fb\u6ce8\u610f\u4e8b\u9879&#xff1a;<\/p>\n<li>\u52a1\u5fc5\u6d4b\u8bd5 GC \u884c\u4e3a\u53d8\u5316&#xff0c;ARM \u4e0a\u7684 GC \u5ef6\u8fdf\u7279\u6027\u4e0e x86 \u4e0d\u540c&#xff1b;<\/li>\n<li>\u8c03\u6574\u7ebf\u7a0b\u6c60\u5927\u5c0f&#xff0c;ARM \u7684\u591a\u6838\u5fc3\u66f4\u9002\u5408\u9ad8\u5e76\u53d1&#xff08;\u5982\u628a\u6838\u5fc3\u7ebf\u7a0b\u6570\u4ece 100 \u589e\u52a0\u5230 150&#xff09;&#xff1b;<\/li>\n<li>\u76d1\u63a7\u5185\u5b58\u5e26\u5bbd\u4f7f\u7528&#xff0c;ARM \u7684\u9ad8\u5e26\u5bbd\u53ef\u80fd\u8ba9\u5185\u5b58\u6210\u4e3a\u65b0\u74f6\u9888&#xff08;\u53ef\u589e\u52a0 Swap \u4e34\u65f6\u7f13\u89e3&#xff09;\u3002<\/li>\n<h3>\u4e94\u3001\u5b9e\u9645\u6848\u4f8b&#xff1a;\u4ece &#034;GC \u98ce\u66b4&#034; \u5230 &#034;\u96f6\u611f\u77e5&#034;&#xff0c;\u8fd9\u4e9b\u5e73\u53f0\u5982\u4f55\u62ef\u6551\u5927\u4fc3&#xff1f;<\/h3>\n<h4>5.1 \u6848\u4f8b 1&#xff1a;\u67d0\u6f6e\u73a9\u5e73\u53f0\u53cc 11 \u7684 &#034;G1 \u6551\u8d4e&#034;<\/h4>\n<p>\u80cc\u666f&#xff1a;2023 \u5e74\u53cc 11&#xff0c;\u8be5\u5e73\u53f0\u7528 x86 \u670d\u52a1\u5668&#xff0c;G1 \u9ed8\u8ba4\u53c2\u6570&#xff0c;\u51fa\u73b0 Young GC \u98ce\u66b4&#xff0c;\u54cd\u5e94\u65f6\u95f4\u4ece 50ms \u98d9\u5347\u5230 500ms\u3002<\/p>\n<p>\u8c03\u4f18\u63aa\u65bd&#xff1a;<\/p>\n<p># \u751f\u4ea7\u73af\u5883\u6700\u7ec8\u53c2\u6570<\/p>\n<p>-XX:&#043;UseG1GC <\/p>\n<p>-XX:MaxGCPauseMillis&#061;500 <\/p>\n<p>-XX:InitiatingHeapOccupancyPercent&#061;70 <\/p>\n<p>-XX:G1NewSizePercent&#061;30 <\/p>\n<p>-XX:G1MaxNewSizePercent&#061;70 <\/p>\n<p>-XX:G1HeapRegionSize&#061;16m <\/p>\n<p>-XX:G1ReservePercent&#061;20 # \u9884\u755920%\u5185\u5b58\u5e94\u5bf9\u7a81\u53d1\u5206\u914d<\/p>\n<p>\u7ed3\u679c&#xff1a;<\/p>\n<ul>\n<li>Young GC \u6b21\u6570\u4ece 10 \u6b21 \/ \u79d2\u964d\u5230 1 \u6b21 \/ \u79d2&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>99% \u54cd\u5e94\u65f6\u95f4\u4ece 500ms \u964d\u5230 80ms&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u6210\u529f\u652f\u6491 100 \u4e07\u7528\u6237\u62a2\u8d2d&#xff0c;\u96f6\u8d85\u65f6\u8ba2\u5355\u3002<\/li>\n<\/ul>\n<h4>5.2 \u6848\u4f8b 2&#xff1a;\u67d0\u8de8\u5883\u7535\u5546\u7684 ARM \u8fc1\u79fb\u4e4b\u8def<\/h4>\n<p>\u80cc\u666f&#xff1a;2024 \u5e74 618&#xff0c;\u8be5\u5e73\u53f0\u5c06 100 \u53f0 x86 \u670d\u52a1\u5668\u6362\u6210 60 \u53f0 ARM \u670d\u52a1\u5668&#xff0c;\u62c5\u5fc3\u6027\u80fd\u4e0d\u8db3\u3002<\/p>\n<p>\u4f18\u5316\u63aa\u65bd&#xff1a;<\/p>\n<p># ARM\u5e73\u53f0\u4e13\u7528\u53c2\u6570<\/p>\n<p>-XX:&#043;UseG1GC <\/p>\n<p>-XX:MaxGCPauseMillis&#061;600 <\/p>\n<p>-XX:InitiatingHeapOccupancyPercent&#061;75 <\/p>\n<p>-XX:G1HeapRegionSize&#061;32m <\/p>\n<p>-XX:ParallelGCThreads&#061;16 <\/p>\n<p>-XX:ConcGCThreads&#061;8 <\/p>\n<p>-XX:&#043;UseStringDeduplication # \u5f00\u542f\u5b57\u7b26\u4e32\u53bb\u91cd&#xff0c;\u51cf\u5c11\u5185\u5b58\u5360\u7528<\/p>\n<p>\u7ed3\u679c&#xff1a;<\/p>\n<ul>\n<li>\u541e\u5410\u91cf\u6bd4 x86 \u5e73\u53f0\u9ad8 40%&#xff0c;\u5355\u53f0 ARM \u670d\u52a1\u5668\u9876 1.7 \u53f0 x86&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>GC \u505c\u987f\u65f6\u95f4\u51cf\u5c11 35%&#xff0c;\u7528\u6237\u6295\u8bc9\u7387\u4e0b\u964d 60%&#xff1b;<\/li>\n<\/ul>\n<ul>\n<li>\u5e74\u8282\u7701\u670d\u52a1\u5668\u6210\u672c 300 \u4e07&#xff0c;CFO \u76f4\u63a5\u7ed9\u6280\u672f\u56e2\u961f\u53d1\u4e86\u5956\u91d1&#xff01;<\/li>\n<\/ul>\n<h3>\u516d\u3001G1 \u8c03\u4f18\u5b9e\u6218\u624b\u518c&#xff1a;\u6f6e\u73a9\u7cfb\u7edf\u5fc5\u6539\u7684 10 \u4e2a\u53c2\u6570<\/h3>\n<p>\u7ed3\u5408\u6848\u4f8b\u548c\u539f\u7406&#xff0c;\u603b\u7ed3\u51fa\u6f6e\u73a9\u7cfb\u7edf G1 \u8c03\u4f18\u7684 10 \u4e2a\u5173\u952e\u53c2\u6570&#xff0c;\u5efa\u8bae\u6536\u85cf&#xff01;<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td>\n<p>\u53c2\u6570\u540d\u79f0<\/p>\n<\/td>\n<td>\n<p>\u4f5c\u7528<\/p>\n<\/td>\n<td>\n<p>\u6f6e\u73a9\u7cfb\u7edf\u63a8\u8350\u503c<\/p>\n<\/td>\n<td>\n<p>\u6ce8\u610f\u4e8b\u9879<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:&#043;UseG1GC<\/p>\n<\/td>\n<td>\n<p>\u542f\u7528 G1 \u5783\u573e\u56de\u6536\u5668<\/p>\n<\/td>\n<td>\n<p>\u5fc5\u9009<\/p>\n<\/td>\n<td>\n<p>JDK9 &#043; \u9ed8\u8ba4\u542f\u7528&#xff0c;\u4f46\u9700\u663e\u5f0f\u6307\u5b9a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:MaxGCPauseMillis<\/p>\n<\/td>\n<td>\n<p>\u76ee\u6807\u6700\u5927\u505c\u987f\u65f6\u95f4<\/p>\n<\/td>\n<td>\n<p>500ms<\/p>\n<\/td>\n<td>\n<p>\u4e0d\u662f\u8d8a\u5c0f\u8d8a\u597d&#xff0c;\u592a\u5c0f\u4f1a\u5bfc\u81f4 GC \u9891\u7e41<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:InitiatingHeapOccupancyPercent<\/p>\n<\/td>\n<td>\n<p>\u8001\u5e74\u4ee3 GC \u89e6\u53d1\u9608\u503c<\/p>\n<\/td>\n<td>\n<p>70%<\/p>\n<\/td>\n<td>\n<p>\u9ad8\u5e76\u53d1\u573a\u666f\u5efa\u8bae 60%-70%<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:G1NewSizePercent<\/p>\n<\/td>\n<td>\n<p>\u65b0\u751f\u4ee3\u6700\u5c0f\u5360\u6bd4<\/p>\n<\/td>\n<td>\n<p>40%<\/p>\n<\/td>\n<td>\n<p>\u4fdd\u8bc1\u65b0\u751f\u4ee3\u6709\u8db3\u591f\u5185\u5b58\u5e94\u5bf9\u7a81\u53d1\u5bf9\u8c61\u521b\u5efa<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:G1MaxNewSizePercent<\/p>\n<\/td>\n<td>\n<p>\u65b0\u751f\u4ee3\u6700\u5927\u5360\u6bd4<\/p>\n<\/td>\n<td>\n<p>60%<\/p>\n<\/td>\n<td>\n<p>\u9632\u6b62\u65b0\u751f\u4ee3\u8fc7\u5927\u6324\u5360\u8001\u5e74\u4ee3\u7a7a\u95f4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:G1HeapRegionSize<\/p>\n<\/td>\n<td>\n<p>Region \u5927\u5c0f<\/p>\n<\/td>\n<td>\n<p>16-32m<\/p>\n<\/td>\n<td>\n<p>\u5927\u5bf9\u8c61\u591a\u7684\u573a\u666f\u5efa\u8bae 32m<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:ParallelGCThreads<\/p>\n<\/td>\n<td>\n<p>\u5e76\u884c GC \u7ebf\u7a0b\u6570<\/p>\n<\/td>\n<td>\n<p>\u7b49\u4e8e CPU \u6838\u5fc3\u6570<\/p>\n<\/td>\n<td>\n<p>ARM \u67b6\u6784\u53ef\u8bbe\u4e3a\u6838\u5fc3\u6570&#xff0c;x86 \u53ef\u8bbe\u4e3a\u6838\u5fc3\u6570 \/ 2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:ConcGCThreads<\/p>\n<\/td>\n<td>\n<p>\u5e76\u53d1\u6807\u8bb0\u7ebf\u7a0b\u6570<\/p>\n<\/td>\n<td>\n<p>\u6838\u5fc3\u6570 \/ 2<\/p>\n<\/td>\n<td>\n<p>\u592a\u5927\u53ef\u80fd\u5360\u7528\u4e1a\u52a1\u7ebf\u7a0b CPU<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:G1ReservePercent<\/p>\n<\/td>\n<td>\n<p>\u9884\u7559\u5185\u5b58\u6bd4\u4f8b&#xff08;\u5e94\u5bf9\u664b\u5347\u5931\u8d25&#xff09;<\/p>\n<\/td>\n<td>\n<p>20%<\/p>\n<\/td>\n<td>\n<p>\u9632\u6b62\u5927\u5bf9\u8c61\u664b\u5347\u65f6\u8001\u5e74\u4ee3\u7a7a\u95f4\u4e0d\u8db3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>-XX:&#043;UseStringDeduplication<\/p>\n<\/td>\n<td>\n<p>\u5b57\u7b26\u4e32\u53bb\u91cd&#xff08;\u51cf\u5c11\u91cd\u590d\u5b57\u7b26\u4e32&#xff09;<\/p>\n<\/td>\n<td>\n<p>\u542f\u7528<\/p>\n<\/td>\n<td>\n<p>\u6f6e\u73a9\u7cfb\u7edf\u6709\u5927\u91cf\u91cd\u590d\u5546\u54c1\u540d\u79f0\u3001\u7528\u6237 ID \u65f6\u6548\u679c\u663e\u8457<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8c03\u4f18\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u5148\u8bbe\u7f6e-XX:MaxGCPauseMillis&#061;500\u548cIHOP&#061;70&#xff0c;\u89c2\u5bdf GC \u9891\u7387&#xff1b;<\/li>\n<li>\u82e5 Young GC \u4ecd\u9891\u7e41&#xff0c;\u8c03\u5927G1NewSizePercent&#xff0c;\u589e\u52a0\u65b0\u751f\u4ee3\u5185\u5b58&#xff1b;<\/li>\n<li>\u82e5\u51fa\u73b0\u664b\u5347\u5931\u8d25&#xff08;Promotion Failed&#xff09;&#xff0c;\u8c03\u5927G1ReservePercent&#xff1b;<\/li>\n<li>\u6700\u540e\u7528-XX:&#043;PrintGCDetails\u548c-XX:&#043;PrintGCApplicationStoppedTime\u5206\u6790\u65e5\u5fd7&#xff0c;\u5fae\u8c03\u53c2\u6570\u3002<\/li>\n<h3>\u4e03\u3001\u4e92\u52a8\u65f6\u95f4&#xff1a;\u4f60\u7684\u7cfb\u7edf\u88ab GC \u5751\u8fc7\u5417&#xff1f;<\/h3>\n<p>\u770b\u5230\u8fd9\u91cc&#xff0c;\u76f8\u4fe1\u4f60\u5bf9 G1 \u8c03\u4f18\u548c ARM \u67b6\u6784\u7684\u4f18\u52bf\u6709\u4e86\u6df1\u5165\u7406\u89e3\u3002\u73b0\u5728\u662f\u4e92\u52a8\u65f6\u95f4&#xff1a;<\/p>\n<li>\u4f60\u7684\u7cfb\u7edf\u9047\u5230\u8fc7 GC \u98ce\u66b4\u5417&#xff1f;\u662f\u600e\u4e48\u89e3\u51b3\u7684&#xff1f;\u6709\u54ea\u4e9b\u72ec\u5bb6\u8c03\u4f18\u6280\u5de7&#xff1f;<\/li>\n<li>\u4f60\u89c9\u5f97 ARM \u67b6\u6784\u4f1a\u53d6\u4ee3 x86 \u6210\u4e3a Java \u670d\u52a1\u5668\u7684\u4e3b\u6d41\u5417&#xff1f;\u4e3a\u4ec0\u4e48&#xff1f;<\/li>\n<li>\u5bf9\u4e8e G1 \u548c ZGC\u3001Shenandoah \u7b49\u65b0 GC&#xff0c;\u4f60\u66f4\u63a8\u8350\u54ea\u4e2a&#xff1f;\u5728\u6f6e\u73a9\u573a\u666f\u4e2d\u8868\u73b0\u5982\u4f55&#xff1f;<\/li>\n<p>\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u5206\u4eab\u4f60\u7684\u7ecf\u9a8c\u548c\u770b\u6cd5&#xff01;\u70b9\u8d5e\u6570\u6700\u9ad8\u7684 3 \u4f4d\u8bfb\u8005&#xff0c;\u5c06\u83b7\u5f97\u6211\u6574\u7406\u7684\u300aG1 \u8c03\u4f18\u5b9e\u6218\u624b\u518c\u300b&#xff08;\u5305\u542b 10 \u4e2a\u6848\u4f8b &#043; \u5b8c\u6574\u53c2\u6570\u6a21\u677f&#xff09;&#xff0c;\u5e72\u8d27\u6ee1\u6ee1&#xff0c;\u4e0d\u5bb9\u9519\u8fc7&#xff01;<\/p>\n<p>\u5173\u6ce8\u6211&#xff0c;\u4e0b\u671f\u5e26\u4f60\u63ed\u79d8 ZGC \u5728 100 \u4e07 QPS \u573a\u666f\u4e0b\u7684\u8868\u73b0&#xff0c;\u770b\u770b\u5b83\u662f\u5426\u80fd\u53d6\u4ee3 G1 \u6210\u4e3a\u9ad8\u5e76\u53d1\u7cfb\u7edf\u7684\u65b0\u5ba0&#xff0c;\u54b1\u4eec\u4e0d\u89c1\u4e0d\u6563&#xff5e;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb780\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf19\u6b21\u3002\u5404\u4f4d Java \u67b6\u6784\u5e08\uff0c\u4eca\u5929\u54b1\u4eec\u6765\u804a\u4e00\u4e2a\u80fd\u8ba9\u9ad8\u5e76\u53d1\u7cfb\u7edf\u8d77\u6b7b\u56de\u751f\u7684\u8c03\u4f18\u795e\u6280 \u2014\u2014G1 \u5783\u573e\u56de\u6536\u5668\u7684\u53c2\u6570\u9b54\u6cd5\uff01\u4f60\u6562\u76f8\u4fe1\u5417\uff1f\u67d0\u6f6e\u73a9\u5e73\u53f0\u53bb\u5e74\u53cc 11\uff0c\u5c31\u56e0\u4e3a\u6ca1\u8c03\u597d G1 \u7684\u4e24\u4e2a\u53c2\u6570\uff0cYoung GC \u6bcf\u79d2\u89e6\u53d1 10 \u6b21\uff0c\u6bcf\u6b21\u505c\u987f 50ms\uff0c\u76f4\u63a5\u5bfc\u81f4 10 \u4e07\u7528\u6237\u62a2\u8d2d\u65f6\u9875\u9762\u767d\u5c4f\uff0c\u635f\u5931\u8d85 500 \u4e07\uff01\u800c\u4ec5\u4ec5\u8c03\u6574\u4e86MaxGCPauseMillis\u548cInitiatingHeapOccupancyPercent\u8fd9\u4e24\u4e2a\u53c2\u6570\uff0c\u4eca\u5e74\u5927\u4fc3 Young GC \u51e0\u4e4e\u6d88\u5931\uff0c\u670d\u52a1\u5668\u6210\u672c\u8fd8\u964d\u4e86 30%\uff01_g1\u7684young gc\u662f\u5426\u6d88\u8017cpu<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[751,43,188],"topic":[],"class_list":["post-48999","post","type-post","status-publish","format-standard","hentry","category-server","tag-arm","tag-43","tag-188"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/48999.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb780\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf19\u6b21\u3002\u5404\u4f4d Java \u67b6\u6784\u5e08\uff0c\u4eca\u5929\u54b1\u4eec\u6765\u804a\u4e00\u4e2a\u80fd\u8ba9\u9ad8\u5e76\u53d1\u7cfb\u7edf\u8d77\u6b7b\u56de\u751f\u7684\u8c03\u4f18\u795e\u6280 \u2014\u2014G1 \u5783\u573e\u56de\u6536\u5668\u7684\u53c2\u6570\u9b54\u6cd5\uff01\u4f60\u6562\u76f8\u4fe1\u5417\uff1f\u67d0\u6f6e\u73a9\u5e73\u53f0\u53bb\u5e74\u53cc 11\uff0c\u5c31\u56e0\u4e3a\u6ca1\u8c03\u597d G1 \u7684\u4e24\u4e2a\u53c2\u6570\uff0cYoung GC \u6bcf\u79d2\u89e6\u53d1 10 \u6b21\uff0c\u6bcf\u6b21\u505c\u987f 50ms\uff0c\u76f4\u63a5\u5bfc\u81f4 10 \u4e07\u7528\u6237\u62a2\u8d2d\u65f6\u9875\u9762\u767d\u5c4f\uff0c\u635f\u5931\u8d85 500 \u4e07\uff01\u800c\u4ec5\u4ec5\u8c03\u6574\u4e86MaxGCPauseMillis\u548cInitiatingHeapOccupancyPercent\u8fd9\u4e24\u4e2a\u53c2\u6570\uff0c\u4eca\u5e74\u5927\u4fc3 Young GC \u51e0\u4e4e\u6d88\u5931\uff0c\u670d\u52a1\u5668\u6210\u672c\u8fd8\u964d\u4e86 30%\uff01_g1\u7684young gc\u662f\u5426\u6d88\u8017cpu\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/48999.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T06:23:25+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48999.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/48999.html\",\"name\":\"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T06:23:25+00:00\",\"dateModified\":\"2025-07-30T06:23:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/48999.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/48999.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48999.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/48999.html","og_locale":"zh_CN","og_type":"article","og_title":"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb780\u6b21\uff0c\u70b9\u8d5e14\u6b21\uff0c\u6536\u85cf19\u6b21\u3002\u5404\u4f4d Java \u67b6\u6784\u5e08\uff0c\u4eca\u5929\u54b1\u4eec\u6765\u804a\u4e00\u4e2a\u80fd\u8ba9\u9ad8\u5e76\u53d1\u7cfb\u7edf\u8d77\u6b7b\u56de\u751f\u7684\u8c03\u4f18\u795e\u6280 \u2014\u2014G1 \u5783\u573e\u56de\u6536\u5668\u7684\u53c2\u6570\u9b54\u6cd5\uff01\u4f60\u6562\u76f8\u4fe1\u5417\uff1f\u67d0\u6f6e\u73a9\u5e73\u53f0\u53bb\u5e74\u53cc 11\uff0c\u5c31\u56e0\u4e3a\u6ca1\u8c03\u597d G1 \u7684\u4e24\u4e2a\u53c2\u6570\uff0cYoung GC \u6bcf\u79d2\u89e6\u53d1 10 \u6b21\uff0c\u6bcf\u6b21\u505c\u987f 50ms\uff0c\u76f4\u63a5\u5bfc\u81f4 10 \u4e07\u7528\u6237\u62a2\u8d2d\u65f6\u9875\u9762\u767d\u5c4f\uff0c\u635f\u5931\u8d85 500 \u4e07\uff01\u800c\u4ec5\u4ec5\u8c03\u6574\u4e86MaxGCPauseMillis\u548cInitiatingHeapOccupancyPercent\u8fd9\u4e24\u4e2a\u53c2\u6570\uff0c\u4eca\u5e74\u5927\u4fc3 Young GC \u51e0\u4e4e\u6d88\u5931\uff0c\u670d\u52a1\u5668\u6210\u672c\u8fd8\u964d\u4e86 30%\uff01_g1\u7684young gc\u662f\u5426\u6d88\u8017cpu","og_url":"https:\/\/www.wsisp.com\/helps\/48999.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T06:23:25+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/48999.html","url":"https:\/\/www.wsisp.com\/helps\/48999.html","name":"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T06:23:25+00:00","dateModified":"2025-07-30T06:23:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/48999.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/48999.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/48999.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"G1 \u8c03\u4f18\u6709\u591a\u795e\uff1f\u4e00\u884c\u53c2\u6570\u8ba9\u6f6e\u73a9\u5927\u4fc3 Young GC \u4ece\u6bcf\u79d2 10 \u6b21\u964d\u5230 0\uff0cARM \u67b6\u6784\u4e0a\u72c2\u7701 300 \u4e07\u670d\u52a1\u5668\u8d39\uff01"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/48999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=48999"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/48999\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=48999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=48999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=48999"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=48999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}