{"id":2533,"date":"2018-02-27T11:15:21","date_gmt":"2018-02-27T03:15:21","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2533"},"modified":"2018-02-27T11:15:21","modified_gmt":"2018-02-27T03:15:21","slug":"jvm-%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e5%99%a8%e5%8f%82%e6%95%b0%e9%85%8d%e7%bd%ae%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2533","title":{"rendered":"JVM \u5783\u573e\u56de\u6536\u5668\u53c2\u6570\u914d\u7f6e\u6559\u7a0b"},"content":{"rendered":"<p>\n\t\u4e00\u8bf4\u5230 JVM \u5f88\u591a\u4eba\u90fd\u8ba4\u4e3a\u662f\u5f88\u9ad8\u6df1\u7684\u4e1c\u897f\u3002\u4f46\u5176\u5b9e\u5e76\u6ca1\u6709\u4ec0\u4e48\u795e\u79d8\u83ab\u6d4b\uff0c\u6211\u4eec\u53ea\u9700\u8bb0\u4f4f\u5b83\u7684\u4e00\u4e9b\u53c2\u6570\u548c\u914d\u7f6e\u624b\u518c\u5373\u53ef\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd JVM \u7684\u4e00\u4e9b\u53c2\u6570\u7528\u6cd5\u3002\n<\/p>\n<h2>\n\t\u5783\u573e\u641c\u96c6\u5668\u9009\u62e9\u53c2\u6570<br \/>\n<\/h2>\n<ul>\n<li>\n\t\tUseSerialGC\uff1a\u5f00\u542f\u6b64\u53c2\u6570\u4f7f\u7528serial &amp; serial old\u641c\u96c6\u5668\uff08client\u6a21\u5f0f\u9ed8\u8ba4\u503c\uff09\u3002\n\t<\/li>\n<li>\n\t\tUseParNewGC\uff1a\u5f00\u542f\u6b64\u53c2\u6570\u4f7f\u7528ParNew &amp; serial old\u641c\u96c6\u5668\uff08\u4e0d\u63a8\u8350\uff09\u3002\n\t<\/li>\n<li>\n\t\tUseConcMarkSweepGC\uff1a\u5f00\u542f\u6b64\u53c2\u6570\u4f7f\u7528ParNew &amp; CMS\uff08serial old\u4e3a\u66ff\u8865\uff09\u641c\u96c6\u5668\u3002\n\t<\/li>\n<li>\n\t\tUseParallelGC\uff1a\u5f00\u542f\u6b64\u53c2\u6570\u4f7f\u7528parallel scavenge &amp; parallel old\u641c\u96c6\u5668\uff08server\u6a21\u5f0f\u9ed8\u8ba4\u503c\uff09\u3002\n\t<\/li>\n<li>\n\t\tUseParallelOldGC\uff1a\u5f00\u542f\u6b64\u53c2\u6570\u5728\u5e74\u8001\u4ee3\u4f7f\u7528parallel old\u641c\u96c6\u5668\uff08\u8be5\u53c2\u6570\u5728JDK1.5\u4e4b\u540e\u5df2\u65e0\u7528\uff09\u3002\n\t<\/li>\n<\/ul>\n<p>\n\tJVM\u5404\u4e2a\u5185\u5b58\u533a\u57df\u5927\u5c0f\u76f8\u5173\u53c2\u6570\n<\/p>\n<ul>\n<li>\n\t\tXms\uff1a\u5806\u7684\u521d\u59cb\u503c\u3002\u9ed8\u8ba4\u4e3a\u7269\u7406\u5185\u5b58\u76841\/64\uff0c\u6700\u5927\u4e0d\u8d851G\u3002\n\t<\/li>\n<li>\n\t\tXmx\uff1a\u5806\u7684\u6700\u5927\u503c\u3002\u9ed8\u8ba4\u4e3a\u7269\u7406\u5185\u5b58\u76841\/4\uff0c\u6700\u5927\u4e0d\u8d851G\u3002\n\t<\/li>\n<li>\n\t\tXmn\uff1a\u65b0\u751f\u4ee3\u7684\u5927\u5c0f\u3002\n\t<\/li>\n<li>\n\t\tXss\uff1a\u7ebf\u7a0b\u6808\u5927\u5c0f\u3002\n\t<\/li>\n<li>\n\t\tPermSize\uff1a\u6c38\u4e45\u4ee3\u521d\u59cb\u5927\u5c0f\u3002\u9ed8\u8ba4\u4e3a\u7269\u7406\u5185\u5b58\u76841\/64\uff0c\u6700\u5927\u4e0d\u8d851G\u3002\n\t<\/li>\n<li>\n\t\tMaxPermSize\uff1a\u6c38\u4e45\u4ee3\u6700\u5927\u503c\u3002\u9ed8\u8ba4\u4e3a\u7269\u7406\u5185\u5b58\u76841\/4\uff0c\u6700\u5927\u4e0d\u8d851G\u3002\n\t<\/li>\n<li>\n\t\tNewRatio\uff1a\u65b0\u751f\u4ee3\u4e0e\u5e74\u8001\u4ee3\u7684\u6bd4\u4f8b\u3002\u6bd4\u5982\u4e3a3\uff0c\u5219\u65b0\u751f\u4ee3\u5360\u5806\u76841\/4\uff0c\u5e74\u8001\u4ee3\u53603\/4\u3002\n\t<\/li>\n<li>\n\t\tSurvivorRatio\uff1a\u65b0\u751f\u4ee3\u4e2d\u8c03\u6574eden\u533a\u4e0esurvivor\u533a\u7684\u6bd4\u4f8b\uff0c\u9ed8\u8ba4\u4e3a8\uff0c\u5373eden\u533a\u4e3a80%\u7684\u5927\u5c0f\uff0c\u4e24\u4e2asurvivor\u5206\u522b\u4e3a10%\u7684\u5927\u5c0f\u3002\uff08\u5907\u6ce8\uff1a\u8fd9\u4e2a\u53c2\u6570\u8bbe\u5b9a\u662f\u8bb2\u89e3\u590d\u5236\u7b97\u6cd5\u90a3\u4e00\u7ae0\u4e2d\uff0c\u89e3\u51b3\u590d\u5236\u7b97\u6cd5\u5185\u5b58\u51cf\u534a\u7684\u529e\u6cd5\u3002eden\u533a\u5373\u662f\u590d\u5236\u7b97\u6cd5\u4e00\u7ae0\u4e2d80%\u7684\u90a3\u90e8\u5206\uff0c\u800csurvivor\u533a\u5219\u662f\u4e24\u4e2a10%\u7684\u90a3\u90e8\u5206\u3002\uff09\n\t<\/li>\n<\/ul>\n<p>\n\t\u5783\u573e\u641c\u96c6\u5668\u6027\u80fd\u901a\u7528\u53c2\u6570\n<\/p>\n<ul>\n<li>\n\t\tPretenureSizeThreshold\uff1a\u664b\u5347\u5e74\u8001\u4ee3\u7684\u5bf9\u8c61\u5927\u5c0f\u3002\u9ed8\u8ba4\u4e3a0\uff0c\u6bd4\u5982\u8bbe\u4e3a10M\uff0c\u5219\u8d85\u8fc710M\u7684\u5bf9\u8c61\u5c06\u4e0d\u5728eden\u533a\u5206\u914d\uff0c\u800c\u76f4\u63a5\u8fdb\u5165\u5e74\u8001\u4ee3\u3002\n\t<\/li>\n<li>\n\t\tMaxTenuringThreshold\uff1a\u664b\u5347\u8001\u5e74\u4ee3\u7684\u6700\u5927\u5e74\u9f84\u3002\u9ed8\u8ba4\u4e3a15\uff0c\u6bd4\u5982\u8bbe\u4e3a10\uff0c\u5219\u5bf9\u8c61\u572810\u6b21\u666e\u901aGC\u540e\u5c06\u4f1a\u88ab\u653e\u5165\u5e74\u8001\u4ee3\u3002\n\t<\/li>\n<li>\n\t\tDisableExplicitGC\uff1a\u7981\u7528System.gc()\u3002\n\t<\/li>\n<\/ul>\n<p>\n\t\u5e76\u884c\u641c\u96c6\u5668\u53c2\u6570\n<\/p>\n<ul>\n<li>\n\t\tParallelGCThreads\uff1a\u56de\u6536\u65f6\u5f00\u542f\u7684\u7ebf\u7a0b\u6570\u3002\u9ed8\u8ba4\u4e0eCPU\u4e2a\u6570\u76f8\u7b49\u3002\n\t<\/li>\n<li>\n\t\tGCTimeRatio\uff1a\u8bbe\u7f6e\u7cfb\u7edf\u7684\u541e\u5410\u91cf\u3002\u6bd4\u5982\u8bbe\u4e3a99\uff0c\u5219GC\u65f6\u95f4\u6bd4\u4e3a1\/1+99=1%\uff0c\u4e5f\u5c31\u662f\u8981\u6c42\u541e\u5410\u91cf\u4e3a99%\u3002\u82e5\u65e0\u6cd5\u6ee1\u8db3\u4f1a\u7f29\u5c0f\u65b0\u751f\u4ee3\u5927\u5c0f\u3002\n\t<\/li>\n<li>\n\t\tMaxGCPauseMillis\uff1a\u8bbe\u7f6e\u5783\u573e\u56de\u6536\u7684\u6700\u5927\u505c\u987f\u65f6\u95f4\u3002\u82e5\u65e0\u6cd5\u6ee1\u8db3\u8bbe\u7f6e\u503c\uff0c\u5219\u4f1a\u4f18\u5148\u7f29\u5c0f\u65b0\u751f\u4ee3\u5927\u5c0f\uff0c\u4ecd\u65e0\u6cd5\u6ee1\u8db3\u7684\u8bdd\u5219\u4f1a\u727a\u7272\u541e\u5410\u91cf\u3002\n\t<\/li>\n<\/ul>\n<p>\n\t\u5e76\u53d1\u641c\u96c6\u5668\u53c2\u6570\n<\/p>\n<ul>\n<li>\n\t\tCMSInitiatingOccupancyFraction\uff1a\u89e6\u53d1CMS\u6536\u96c6\u5668\u7684\u5185\u5b58\u6bd4\u4f8b\u3002\u6bd4\u598260%\u7684\u610f\u601d\u5c31\u662f\u8bf4\uff0c\u5f53\u5185\u5b58\u8fbe\u523060%\uff0c\u5c31\u4f1a\u5f00\u59cb\u8fdb\u884cCMS\u5e76\u53d1\u6536\u96c6\u3002\n\t<\/li>\n<li>\n\t\tUseCMSCompactAtFullCollection\uff1a\u8fd9\u4e2a\u524d\u9762\u5df2\u7ecf\u63d0\u8fc7\uff0c\u7528\u4e8e\u5728\u6bcf\u4e00\u6b21CMS\u6536\u96c6\u5668\u6e05\u7406\u5783\u573e\u540e\u9001\u4e00\u6b21\u5185\u5b58\u6574\u7406\u3002\n\t<\/li>\n<li>\n\t\tCMSFullGCsBeforeCompaction\uff1a\u8bbe\u7f6e\u5728\u51e0\u6b21CMS\u5783\u573e\u6536\u96c6\u540e\uff0c\u89e6\u53d1\u4e00\u6b21\u5185\u5b58\u6574\u7406\u3002\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2533\">JVM \u5783\u573e\u56de\u6536\u5668\u53c2\u6570\u914d\u7f6e\u6559\u7a0b<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u4e00\u8bf4\u5230 JVM \u5f88\u591a\u4eba\u90fd\u8ba4\u4e3a\u662f\u5f88\u9ad8\u6df1\u7684\u4e1c\u897f\u3002\u4f46\u5176\u5b9e\u5e76\u6ca1\u6709\u4ec0\u4e48\u795e\u79d8\u83ab\u6d4b\uff0c\u6211\u4eec\u53ea\u9700\u8bb0\u4f4f\u5b83\u7684\u4e00\u4e9b\u53c2\u6570\u548c\u914d\u7f6e\u624b\u518c\u5373\u53ef\u3002 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[328,69,261,731,314],"class_list":["post-2533","post","type-post","status-publish","format-standard","hentry","category-java","tag-gc","tag-java","tag-jvm","tag-taobaojvm"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2533"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2533\/revisions"}],"predecessor-version":[{"id":2534,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2533\/revisions\/2534"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}