{"id":118388,"date":"2026-10-27T04:16:28","date_gmt":"2026-10-26T20:16:28","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/118388.html"},"modified":"2026-10-27T04:16:28","modified_gmt":"2026-10-26T20:16:28","slug":"07-06-%e6%ba%90%e7%a0%81-net-core-gc%e7%9a%84%e6%9e%81%e8%87%b4%e4%bc%98%e5%8c%96%e6%8a%80%e6%9c%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/118388.html","title":{"rendered":"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f"},"content":{"rendered":"<h2 id=\"net-core-gc-\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f\">.NET Core GC \u7684\u6781\u81f4\u4f18\u5316\u6280\u672f<\/h2>\n<p>\u7bc7\u7ae0&#xff1a;07-\u6e90\u7801\u6df1\u5ea6-.NET Core GC |\u00a0\u9605\u8bfb\u65f6\u95f4&#xff1a;\u7ea6 40 \u5206\u949f<\/p>\n<hr \/>\n<h3 id=\"\u4e00-\u5f15\u8a00\">\u4e00\u3001\u5f15\u8a00<\/h3>\n<p>.NET Core GC \u7684\u6781\u81f4\u6027\u80fd\u4e0d\u4ec5\u6765\u81ea\u9ad8\u7ea7\u7b97\u6cd5&#xff0c;\u8fd8\u6765\u81ea\u5927\u91cf\u5e95\u5c42\u7684\u5fae\u4f18\u5316\u6280\u672f\u3002\u6bcf\u9879\u5fae\u4f18\u5316\u5355\u72ec\u770b\u53ef\u80fd\u53ea\u63d0\u5347 1-5%&#xff0c;\u4f46\u7d2f\u79ef\u8d77\u6765\u4ea7\u751f\u4e86\u5de8\u5927\u7684\u6027\u80fd\u4f18\u52bf\u3002\u8fd9\u53e5\u8bdd\u70b9\u51fa\u4e86\u672c\u6587\u7684\u4e3b\u89d2&#xff1a;\u4e0d\u662f\u5206\u4ee3\u3001\u538b\u7f29\u8fd9\u4e9b&#034;\u8bba\u6587\u7ea7&#034;\u7684\u8bbe\u8ba1&#xff0c;\u800c\u662f\u628a\u865a\u62df\u5185\u5b58\u63a5\u53e3\u3001CPU \u7f13\u5b58\u3001NUMA \u62d3\u6251\u3001\u7ebf\u7a0b\u8c03\u5ea6\u9010\u4e00\u69a8\u5e72\u7684\u5de5\u7a0b\u624b\u6bb5\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u4e00\u4e2a GC \u9700\u8981\u5173\u5fc3 2MB \u5927\u9875\u3001CPU \u7ed1\u6838\u63a9\u7801\u548c\u00a0fallocate\u00a0\u8fd9\u79cd\u7cfb\u7edf\u8c03\u7528\u5c42\u9762\u7684\u7ec6\u8282&#xff1f;\u56e0\u4e3a GC \u662f\u8fdb\u7a0b\u91cc\u6700\u91cd\u7684\u5185\u5b58\u6d88\u8d39\u8005\u4e0e\u6700\u9891\u7e41\u7684\u5168\u5c40\u540c\u6b65\u70b9&#xff0c;\u5b83\u6bcf\u6b21\u6807\u8bb0\u3001\u6bcf\u6bb5\u5206\u914d\u90fd\u8981\u78b0\u5185\u5b58\u5b50\u7cfb\u7edf&#xff1a;TLB \u672a\u547d\u4e2d\u3001\u8de8 NUMA \u8bbf\u95ee\u3001\u9875\u8868\u66f4\u65b0&#xff0c;\u8fd9\u4e9b\u5fae\u79d2\u7ea7\u7684\u4ee3\u4ef7\u4e58\u4e0a\u51e0\u5341 GB \u5806\u4e0a\u7684\u4ebf\u6b21\u8bbf\u95ee&#xff0c;\u5c31\u662f\u53ef\u89c2\u6d4b\u7684\u6682\u505c\u5dee\u3002\u7b97\u6cd5\u5c42\u9762\u5927\u5bb6\u90fd\u4f1a\u5199\u6807\u8bb0-\u6e05\u626b&#xff0c;\u80dc\u8d1f\u6070\u6070\u5728\u8fd9\u79cd&#034;\u64cd\u4f5c\u7cfb\u7edf\u63a5\u53e3\u3001CPU \u6307\u4ee4\u96c6\u3001\u5185\u5b58\u7ba1\u7406\u786c\u4ef6&#034;\u7684\u6253\u78e8\u4e0a\u5206\u51fa\u6765\u3002\u8fd9\u4e5f\u662f\u539f\u7a3f\u7ed9\u51fa\u7684\u5224\u65ad&#xff1a;.NET Core GC \u5728 Server \u573a\u666f\u4e0b\u63a5\u8fd1 C&#043;&#043; \u624b\u52a8\u7ba1\u7406\u7684\u5185\u5b58\u6548\u7387&#xff0c;\u9760\u7684\u6b63\u662f\u8fd9\u4e9b\u4e0d\u5728\u8bba\u6587\u6458\u8981\u91cc\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u672c\u6587\u6309&#034;\u5168\u666f\u3001\u5185\u5b58\u5c42\u3001\u62d3\u6251\u5c42\u3001\u5206\u914d\u5c42\u3001\u9884\u7b97\u5c42\u3001\u914d\u7f6e\u3001\u89c2\u6d4b\u3001\u5fae\u4f18\u5316\u3001\u53e3\u5f84\u3001\u6a2a\u5411\u5bf9\u6bd4\u3001\u51b3\u7b56\u6e05\u5355&#034;\u7684\u987a\u5e8f\u5c55\u5f00&#xff1a;\u5148\u7528\u4e00\u5f20\u7ed3\u6784\u56fe\u628a\u4f18\u5316\u70b9\u5206\u5c42&#xff08;\u7b2c\u4e8c\u8282&#xff09;&#xff0c;\u518d\u9010\u5c42\u62c6\u6bb5\u9884\u6620\u5c04\u3001\u5927\u9875\u3001NUMA \u4e0e\u7ed1\u6838\u3001\u591a\u5806\u4e0e GC \u611f\u77e5\u5206\u914d\u3001Gen0 \u9884\u7b97\u81ea\u9002\u5e94&#xff08;\u7b2c\u4e09\u5230\u4e03\u8282&#xff09;&#xff0c;\u968f\u540e\u7ed9\u51fa\u914d\u7f6e\u9879\u5168\u666f\u4e0e\u89c2\u6d4b\u624b\u6bb5&#xff08;\u7b2c\u516b\u3001\u4e5d\u8282&#xff09;&#xff0c;\u63a5\u7740\u8d70\u8bfb\u9884\u53d6\u4e0e\u6bb5\u63d0\u4ea4\u4e24\u5904\u4ee3\u7801&#xff08;\u7b2c\u5341\u8282&#xff09;&#xff0c;\u6700\u540e\u7edf\u4e00\u8bf4\u660e\u91cf\u5316\u6570\u636e\u7684\u53e3\u5f84\u3001\u4e0e\u5176\u4ed6\u8fd0\u884c\u65f6\u7684\u5bf9\u6bd4&#xff0c;\u4ee5\u53ca\u4e00\u5f20&#034;\u539f\u7406 \u2192 \u6536\u76ca \u2192 \u9002\u7528 \u2192 \u5c40\u9650&#034;\u7684\u51b3\u7b56\u8868&#xff08;\u7b2c\u5341\u4e00\u5230\u5341\u4e09\u8282&#xff09;\u3002\u540e\u53f0 GC \u7684\u72b6\u6001\u673a\u4e0d\u5728\u672c\u6587\u5c55\u5f00&#xff0c;\u53ea\u5728\u9700\u8981\u5904\u4e00\u53e5\u8bdd\u56de\u6307 07-05\u3002<\/p>\n<h3 id=\"\u4e8c-\u4f18\u5316\u5168\u666f\u4e00\u5f20\u5206\u5c42\u7ed3\u6784\u56fe\">\u4e8c\u3001\u4f18\u5316\u5168\u666f&#xff1a;\u4e00\u5f20\u5206\u5c42\u7ed3\u6784\u56fe<\/h3>\n<p>\u628a\u6563\u843d\u7684\u4f18\u5316\u70b9\u6309&#034;\u79bb\u786c\u4ef6\u591a\u8fd1&#034;\u6392\u6210\u4e94\u5c42&#xff0c;\u5f7c\u6b64\u7684\u5173\u7cfb\u4e00\u76ee\u4e86\u7136&#xff1a;<\/p>\n<p>.NET Core GC \u4f18\u5316\u70b9\u7ed3\u6784\u56fe&#xff08;\u5206\u5c42\u793a\u610f&#xff0c;\u975e\u5b8c\u6574\u679a\u4e3e&#xff09;<\/p>\n<p>\u250c\u2500 \u7b2c\u4e94\u5c42&#xff1a;\u53ef\u89c2\u6d4b\u6027\u4e0e\u914d\u7f6e \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br \/>\n\u2502  runtimeconfig \/ DOTNET_GC* \u73af\u5883\u53d8\u91cf \u00b7 PerfView \u00b7 GC \u65e5\u5fd7      \u2502<br \/>\n\u2502  \u2514 \u4f5c\u7528&#xff1a;\u8ba9\u524d\u9762\u56db\u5c42&#034;\u662f\u5426\u751f\u6548&#034;\u53ef\u88ab\u9a8c\u8bc1&#xff08;\u7b2c\u4e5d\u8282&#xff09;                \u2502<br \/>\n\u251c\u2500 \u7b2c\u56db\u5c42&#xff1a;\u9884\u7b97\u4e0e\u7b97\u6cd5\u81ea\u9002\u5e94 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502  Gen0 \u9884\u7b97\u6309\u5b58\u6d3b\u7387\u56de\u5199 \u00b7 \u6bb5\u7f13\u5b58\u590d\u7528 \u00b7 \u664b\u5347\u7b56\u7565                  \u2502<br \/>\n\u2502  \u2514 \u4f5c\u7528&#xff1a;\u8ba9\u56de\u6536\u9891\u7387\u81ea\u52a8\u6b63\u6bd4\u4e8e\u5206\u914d\u901f\u7387&#xff08;\u7b2c\u4e03\u8282&#xff09;                \u2502<br \/>\n\u251c\u2500 \u7b2c\u4e09\u5c42&#xff1a;\u5206\u914d\u8def\u5f84\u7684\u5e76\u53d1\u5316 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502  \u5206\u914d\u4e0a\u4e0b\u6587&#xff08;TLAB \u5f0f\u7a97\u53e3&#xff09;\u00b7 \u591a\u7ea7\u6bb5\u7f13\u5b58 \u00b7 GC \u611f\u77e5\u7684\u5206\u914d\u5165\u53e3      \u2502<br \/>\n\u2502  \u2514 \u4f5c\u7528&#xff1a;99% \u4ee5\u4e0a\u7684\u5206\u914d\u65e0\u9501\u5b8c\u6210&#xff08;\u7b2c\u516d\u8282&#xff0c;\u91cf\u7ea7\u4e3a\u793a\u4f8b\u53e3\u5f84&#xff09;      \u2502<br \/>\n\u251c\u2500 \u7b2c\u4e8c\u5c42&#xff1a;\u62d3\u6251\u611f\u77e5 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502  Server \u591a\u5806 \u00b7 GC \u7ebf\u7a0b\u7ed1\u6838 \u00b7 CPU \u5206\u7ec4\u4eb2\u548c \u00b7 NUMA \u672c\u5730\u5206\u914d       \u2502<br \/>\n\u2502  \u2514 \u4f5c\u7528&#xff1a;\u8ba9 GC \u7ebf\u7a0b\u4e0e\u5b83\u7ba1\u7684\u5185\u5b58\u5728&#034;\u540c\u4e00\u7247\u7845&#034;\u4e0a&#xff08;\u7b2c\u4e94\u8282&#xff09;        \u2502<br \/>\n\u251c\u2500 \u7b2c\u4e00\u5c42&#xff1a;\u5185\u5b58\u7ba1\u7406\u4e0e OS \u63a5\u53e3 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524<br \/>\n\u2502  \u6bb5\u9884\u63d0\u4ea4\/\u9884\u6620\u5c04 \u00b7 \u5927\u9875(2MB) \u00b7 \u96f6\u62f7\u8d1d\u6bb5\u63d0\u4ea4 \u00b7 \u6807\u8bb0\u671f\u9884\u53d6        \u2502<br \/>\n\u2502  \u2514 \u4f5c\u7528&#xff1a;\u644a\u8584\u6bcf\u4e00\u6b21\u89e6\u9875\u3001\u6bcf\u4e00\u6b21 TLB \u67e5\u8be2\u7684\u6210\u672c&#xff08;\u4e09\u3001\u56db\u3001\u5341\u8282&#xff09; \u2502<br \/>\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br \/>\n   \u8bfb\u6cd5&#xff1a;\u4e0b\u5c42\u662f\u4e0a\u5c42\u7684\u5730\u57fa\u2014\u2014\u6ca1\u6709\u591a\u5806&#xff08;\u4e8c\u5c42&#xff09;&#xff0c;\u7ed1\u6838\u6ca1\u6709\u5bf9\u8c61&#xff1b;<br \/>\n        \u6ca1\u6709\u5206\u914d\u7a97\u53e3&#xff08;\u4e09\u5c42&#xff09;&#xff0c;\u9884\u7b97\u518d\u51c6\u4e5f\u538b\u4e0d\u4f4f\u6162\u8def\u5f84\u3002<\/p>\n<p>\u8fd9\u5f20\u56fe\u8fd8\u6709\u4e00\u6761\u91cd\u8981\u7684\u9605\u8bfb\u89c4\u5219&#xff1a;\u5c42\u4e0e\u5c42\u4e4b\u95f4\u5b58\u5728\u4f9d\u8d56\u3002\u591a\u5806\u662f\u7ed1\u6838\u7684\u524d\u63d0&#xff0c;\u7ed1\u6838\u662f NUMA \u4eb2\u548c\u7684\u524d\u63d0&#xff0c;\u5206\u914d\u7a97\u53e3\u7684\u5b58\u5728\u8ba9\u9884\u7b97\u5c42\u53ea\u9700\u8981\u5728\u6162\u8def\u5f84\u4e0a\u8bb0\u8d26\u3002\u6240\u4ee5\u540e\u6587\u6bcf\u4e00\u8282\u90fd\u4f1a\u5148\u4ea4\u4ee3&#034;\u5b83\u7ad9\u5728\u8c01\u7684\u80a9\u8180\u4e0a&#034;&#xff0c;\u907f\u514d\u628a\u4e00\u9879\u4f18\u5316\u5b64\u7acb\u5730\u8bfb\u6210\u94f6\u5f39\u3002<\/p>\n<h3 id=\"\u4e09-\u6bb5\u9884\u63d0\u4ea4\u4e0e\u865a\u62df\u5730\u5740\u9884\u6620\u5c04\">\u4e09\u3001\u6bb5\u9884\u63d0\u4ea4\u4e0e\u865a\u62df\u5730\u5740\u9884\u6620\u5c04<\/h3>\n<h4 id=\"31-\u539f\u7406\">3.1 \u539f\u7406<\/h4>\n<p>GC \u5411\u64cd\u4f5c\u7cfb\u7edf\u8981\u5185\u5b58\u8d70\u4e24\u9636\u6bb5&#xff1a;Reserve \u5360\u4f4f\u865a\u62df\u5730\u5740\u8303\u56f4&#xff0c;Commit \u628a\u7269\u7406\u9875\u771f\u6b63\u63a5\u4e0a\u3002\u6309\u9700\u63d0\u4ea4\u7684\u6734\u7d20\u505a\u6cd5\u662f\u6bcf\u6b21\u6269\u5f20\u6bb5\u90fd\u73b0\u505a\u4e00\u6b21\u7cfb\u7edf\u8c03\u7528&#xff0c;\u5206\u914d\u70ed\u8def\u5f84\u4e0a\u591a\u4e00\u6b21\u5185\u6838\u5207\u6362&#xff0c;\u4ee3\u4ef7\u662f\u5fae\u79d2\u7ea7&#xff0c;\u644a\u5230\u9891\u7e41\u6269\u5f20\u7684\u5806\u4e0a\u5c31\u5f88\u663e\u773c\u3002\u6bb5\u9884\u6620\u5c04&#xff08;pre-reserve \/ pre-commit&#xff0c;\u539f\u7a3f\u79f0&#034;\u6bb5\u9884\u6620\u5c04&#034;&#xff09;\u7684\u505a\u6cd5\u662f\u542f\u52a8\u6216\u6269\u5f20\u65f6\u4e00\u6b21\u6027\u9884\u7559\u5e76\u9884\u6620\u5c04\u591a\u5757\u6bb5&#xff0c;\u540e\u7eed\u5206\u914d\u76f4\u63a5\u5728\u5df2\u6620\u5c04\u8303\u56f4\u5185\u8d70\u7528\u6237\u6001\u6307\u9488\u63a8\u8fdb&#xff0c;\u4e0d\u518d\u89e6\u53d1\u00a0VirtualAlloc\/mmap\u3002\u539f\u7a3f\u8fd8\u63d0\u5230\u9884\u6620\u5c04\u6570\u91cf\u57fa\u4e8e\u5386\u53f2\u6570\u636e\u9884\u6d4b\u2014\u2014\u8fd9\u4e0e\u8fd0\u884c\u65f6\u4fdd\u7559\u6bb5\u7f13\u5b58&#xff08;\u56de\u6536\u6389\u7684\u6bb5\u5148\u4e0d\u8fd8\u7ed9\u7cfb\u7edf\u3001\u7559\u7ed9\u4e0b\u8f6e\u590d\u7528&#xff09;\u662f\u540c\u4e00\u6761\u601d\u8def\u7684\u4e24\u4e2a\u73af\u8282&#xff1a;\u4e00\u4e2a\u7701&#034;\u8981\u5730\u5740&#034;&#xff0c;\u4e00\u4e2a\u7701&#034;\u8fd8\u4e86\u518d\u8981&#034;\u3002<\/p>\n<p>\u4ece\u7cfb\u7edf\u7f16\u7a0b\u7684\u89d2\u5ea6\u770b&#xff0c;\u8fd9\u9879\u4f18\u5316\u6ca1\u6709\u78b0 GC \u7b97\u6cd5\u4e00\u884c\u4ee3\u7801&#xff0c;\u5b83\u6539\u53d8\u7684\u662f&#034;GC \u4e0e\u5185\u6838\u7684\u5bf9\u8bdd\u6b21\u6570&#034;\u3002\u8fd9\u6b63\u662f\u7b2c\u4e00\u5c42\u4f18\u5316\u7684\u5171\u6027&#xff1a;\u8d62\u5728\u63a5\u53e3\u8fb9\u754c&#xff0c;\u4e0d\u5728\u7b97\u6cd5\u3002<\/p>\n<h4 id=\"32-\u6536\u76ca-\u9002\u7528\u4e0e\u5c40\u9650\">3.2 \u6536\u76ca\u3001\u9002\u7528\u4e0e\u5c40\u9650<\/h4>\n<p>\u6536\u76ca\u7684\u6765\u6e90\u662f\u7cfb\u7edf\u8c03\u7528\u6b21\u6570\u4e0b\u964d\u4e0e\u7f3a\u9875\u4e2d\u65ad\u524d\u79fb&#xff08;\u9884\u6620\u5c04\u628a\u89e6\u9875\u6210\u672c\u632a\u5230\u542f\u52a8\u6216\u4f4e\u5cf0\u671f&#xff09;&#xff0c;\u539f\u7a3f\u7ed9\u51fa\u7684\u53e3\u5f84\u662f\u6bb5\u9884\u6620\u5c04\u5355\u9879\u5e26\u6765\u7ea6 -8% \u7684\u6682\u505c\u964d\u4f4e&#xff08;\u793a\u4f8b\u91cf\u7ea7&#xff0c;16 \u6838 64GB Web API \u573a\u666f&#xff0c;\u975e\u5b9e\u6d4b\u5e38\u6570&#xff0c;\u89c1\u7b2c\u5341\u4e00\u8282\u7684\u53e3\u5f84\u8bf4\u660e&#xff09;\u3002\u5b83\u5bf9\u5206\u914d\u901f\u7387\u9ad8\u3001\u6bb5\u6269\u5f20\u9891\u7e41\u7684\u5806\u6700\u6709\u6548&#xff1b;\u6bb5\u6269\u5f20\u672c\u6765\u5c31\u5c11\u7684\u670d\u52a1&#xff0c;\u8fd9\u9879\u4f18\u5316\u51e0\u4e4e\u6ca1\u6709\u843d\u70b9\u3002<\/p>\n<p>\u5c40\u9650\u6709\u4e24\u6761\u3002\u5176\u4e00&#xff0c;\u9884\u7559\u7684\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u800c\u975e\u7269\u7406\u5185\u5b58&#xff0c;\u8fdb\u7a0b\u7684\u5730\u5740\u7a7a\u95f4\u5360\u7528\u4e0a\u5347&#xff0c;\u5728\u5730\u5740\u7a7a\u95f4\u7d27\u5f20\u7684 32 \u4f4d\u8fdb\u7a0b\u6216\u5f00\u4e86\u5927\u91cf\u5b50\u8fdb\u7a0b\u7684\u5bbf\u4e3b\u91cc\u8981\u514b\u5236\u3002\u5176\u4e8c&#xff0c;\u9884\u6620\u5c04\u7b56\u7565\u4f9d\u8d56\u8fd0\u884c\u65f6\u5bf9&#034;\u63a5\u4e0b\u6765\u8981\u591a\u5c11\u6bb5&#034;\u7684\u5224\u65ad&#xff0c;\u5224\u65ad\u5931\u51c6\u8981\u4e48\u767d\u5360\u5730\u5740\u3001\u8981\u4e48\u8fd8\u662f\u56de\u9000\u5230\u6309\u9700\u63d0\u4ea4\u2014\u2014\u5b83\u4f18\u5316\u7684\u662f\u547d\u4e2d\u65f6\u7684\u5feb\u8def\u5f84&#xff0c;\u515c\u5e95\u8def\u5f84\u4ecd\u7136\u5b58\u5728\u3002<\/p>\n<h3 id=\"\u56db-\u5927\u9875large-page--huge-page\u652f\u6301\">\u56db\u3001\u5927\u9875&#xff08;Large Page \/ Huge Page&#xff09;\u652f\u6301<\/h3>\n<h4 id=\"41-\u539f\u7406\">4.1 \u539f\u7406<\/h4>\n<p>\u5e38\u89c4\u9875\u662f 4KB&#xff0c;\u4e00\u4e2a 1GB \u7684\u5806\u9700\u8981\u51e0\u5341\u4e07\u6761\u9875\u8868\u9879&#xff0c;\u7a0b\u5e8f\u6bcf\u8bbf\u95ee\u4e00\u4e2a\u65b0\u9875\u90fd\u53ef\u80fd\u67e5\u4e00\u6b21 TLB&#xff08;\u5730\u5740\u8f6c\u6362\u7f13\u5b58&#xff09;&#xff0c;TLB \u5bb9\u91cf\u6709\u9650&#xff0c;\u5806\u4e00\u5927\u5c31\u9891\u7e41\u672a\u547d\u4e2d\u3002\u5927\u9875\u628a\u9875\u7c92\u5ea6\u63d0\u5230 2MB&#xff08;Windows \u79f0 Large Pages&#xff0c;Linux \u79f0 Huge Pages&#xff09;&#xff0c;\u540c\u6837 1GB \u53ea\u9700 512 \u4e2a\u9875\u8868\u9879&#xff0c;TLB \u8986\u76d6\u8303\u56f4\u6269\u5927\u7ea6 500 \u500d&#xff08;\u6309 4KB \u5bf9 2MB \u8ba1\u7b97\u7684\u7b97\u672f\u6bd4\u503c&#xff0c;\u975e\u5b9e\u6d4b\u52a0\u901f\u6bd4&#xff09;&#xff0c;\u5806\u8fd9\u79cd&#034;\u5927\u5757\u8fde\u7eed\u3001\u968f\u673a\u8bbf\u95ee&#034;\u7684\u8d1f\u8f7d\u6536\u76ca\u76f4\u63a5\u3002\u539f\u7a3f\u7684\u91cf\u5316\u53e3\u5f84\u662f&#034;\u51cf\u5c11 TLB miss&#xff0c;\u63d0\u5347\u5185\u5b58\u8bbf\u95ee\u6548\u7387\u7ea6 30%&#034;&#xff0c;\u8fd9\u662f\u793a\u4f8b\u91cf\u7ea7\u800c\u975e\u5b9e\u6d4b\u5e38\u6570&#xff0c;\u5b9e\u9645\u53d6\u51b3\u4e8e\u5806\u5927\u5c0f\u3001\u8bbf\u95ee\u5c40\u90e8\u6027\u4e0e\u786c\u4ef6 TLB \u89c4\u683c\u3002<\/p>\n<p>\u4ee3\u7801\u5165\u53e3\u4fdd\u7559\u539f\u6587&#xff1a;<\/p>\n<p>\/\/ \u542f\u7528\u5927\u9875\u9762<br \/>\nGCSettings.LargePages &#061; true; \/\/ .NET 5&#043;<\/p>\n<p>\u89e3\u8bfb&#xff1a;\u8fd9\u4e00\u884c\u662f\u8fdb\u7a0b\u7ea7\u5f00\u5173&#xff0c;\u8fd0\u884c\u65f6\u636e\u6b64\u5728\u7533\u8bf7\u5806\u5185\u5b58\u65f6\u6539\u7528\u5927\u9875\u9875\u8868\u3002\u8bfb\u5b83\u8981\u6ce8\u610f\u4e09\u70b9\u3002\u7b2c\u4e00&#xff0c;\u5b83\u662f\u7533\u8bf7&#xff0c;\u4e0d\u662f\u4fdd\u8bc1\u2014\u2014Windows \u4e0a\u542f\u7528\u5927\u9875\u901a\u5e38\u8fd8\u9700\u8981\u8fdb\u7a0b\u5177\u5907\u9501\u5b9a\u5185\u5b58\u7684\u6743\u9650&#xff08;SeLockMemoryPrivilege \u4e00\u7c7b\u7684\u7279\u6743&#xff09;&#xff0c;Linux \u4e0a\u8981\u9884\u5148\u914d\u7f6e\u597d huge pages \u6c60&#xff0c;\u6743\u9650\u6216\u6c60\u4e0d\u8db3\u65f6\u8fd0\u884c\u65f6\u4f1a\u9759\u9ed8\u9000\u56de 4KB \u9875&#xff0c;\u4ee3\u7801\u4e0d\u62a5\u9519\u3001\u6536\u76ca\u6d88\u5931\u3002\u7b2c\u4e8c&#xff0c;\u5927\u9875\u662f\u7ed9\u6574\u4e2a\u5806\u7528\u7684&#xff0c;\u4e0d\u53ea\u7ed9 GC&#xff0c;\u4f46 GC \u7ba1\u7684\u5806\u5f80\u5f80\u5360\u8fdb\u7a0b\u5185\u5b58\u7684\u5927\u5934&#xff0c;\u6240\u4ee5\u5f00\u5173\u7684\u6548\u679c\u96c6\u4e2d\u4f53\u73b0\u5728 GC \u505c\u987f\u4e0a\u3002\u7b2c\u4e09&#xff0c;\u5b83\u7684\u6210\u672c\u662f\u7269\u7406\u5185\u5b58\u788e\u7247\u4e0e\u8fd0\u7ef4\u590d\u6742\u5ea6&#xff1a;2MB \u65e0\u6cd5\u5f52\u8fd8\u7ed9\u64cd\u4f5c\u7cfb\u7edf\u7684\u7a7a\u95f2\u5927\u9875&#xff0c;\u6bd4 4KB \u9875\u66f4&#034;\u786c&#034;&#xff0c;\u5185\u5b58\u5403\u7d27\u7684\u5bb9\u5668\u91cc\u8981\u5148\u7b97\u8fd9\u7b14\u8d26\u3002<\/p>\n<h4 id=\"42-\u6536\u76ca-\u9002\u7528\u4e0e\u5c40\u9650\">4.2 \u6536\u76ca\u3001\u9002\u7528\u4e0e\u5c40\u9650<\/h4>\n<p>\u9002\u7528\u573a\u666f\u6309\u6536\u76ca\u6392\u5e8f&#xff1a;\u5927\u5806&#xff08;GB \u7ea7&#xff09;\u4e14\u5185\u5b58\u5bcc\u4f59\u7684\u7269\u7406\u673a\u3001\u5ef6\u8fdf\u654f\u611f\u7684\u6570\u636e\u5e93\u578b\u6216\u4ea4\u6613\u578b\u670d\u52a1\u3001GC \u505c\u987f\u91cc&#034;\u6807\u8bb0\u626b\u63cf\u968f\u673a\u89e6\u9875&#034;\u5360\u5927\u5934\u7684\u8d1f\u8f7d\u3002\u5c40\u9650\u96c6\u4e2d\u5728\u8fd0\u7ef4\u4fa7&#xff1a;\u9700\u8981\u7279\u6743\u4e0e\u9884\u7559\u6c60\u3001\u5bb9\u5668\u5185\u914d\u7f6e\u66f4\u9ebb\u70e6\u3001\u5185\u5b58\u7d27\u5f20\u65f6\u53cd\u800c\u653e\u5927\u788e\u7247\u3002\u5c0f\u5806\u670d\u52a1\u5f00\u5927\u9875\u5c5e\u4e8e\u628a\u8fd0\u7ef4\u6210\u672c\u82b1\u5728\u4e0d\u5b58\u5728\u7684\u95ee\u9898\u4e0a\u2014\u2014\u51e0\u767e MB \u7684\u5806\u672c\u6765\u5c31\u88c5\u5f97\u8fdb TLB \u7684\u8212\u9002\u533a\u3002<\/p>\n<h3 id=\"\u4e94-numa-\u611f\u77e5-cpu-\u5206\u7ec4\u4eb2\u548c\u4e0e\u591a\u5806\u7ed1\u6838\">\u4e94\u3001NUMA \u611f\u77e5\u3001CPU \u5206\u7ec4\u4eb2\u548c\u4e0e\u591a\u5806\u7ed1\u6838<\/h3>\n<h4 id=\"51-\u539f\u7406\">5.1 \u539f\u7406<\/h4>\n<p>\u591a\u8def\u670d\u52a1\u5668\u4e0a\u6bcf\u4e2a CPU \u63d2\u69fd\u6709\u672c\u5730\u5185\u5b58&#xff0c;\u8bbf\u95ee\u672c\u5730\u5185\u5b58\u5feb\u3001\u8de8\u63d2\u69fd\u8bbf\u95ee\u8fdc\u7aef\u5185\u5b58\u6162\u3002\u539f\u7a3f\u7ed9\u7684\u5dee\u8ddd\u662f 2-3 \u500d&#xff08;\u5178\u578b\u4f30\u7b97&#xff0c;\u968f\u4e92\u8fde\u62d3\u6251\u4e0e\u8d1f\u8f7d\u53d8\u5316&#xff0c;\u975e\u5b9e\u6d4b\u5e38\u6570&#xff09;\u3002Server GC \u6a21\u5f0f\u4e0b\u6bcf\u4e2a\u5806\u914d\u4e00\u4e2a GC \u7ebf\u7a0b&#xff0c;\u5982\u679c\u5806\u7684\u5185\u5b58\u5728\u63d2\u69fd A\u3001GC \u7ebf\u7a0b\u5374\u8dd1\u5728\u63d2\u69fd B \u7684\u6838\u4e0a&#xff0c;\u6bcf\u6b21\u6807\u8bb0\u90fd\u5728\u4ed8\u8de8 NUMA \u7684\u5e26\u5bbd\u4e0e\u5ef6\u8fdf\u7f5a\u6b3e\u3002NUMA \u611f\u77e5\u7684\u6bb5\u5206\u914d\u5c31\u662f\u8ba9\u6bcf\u4e2a\u5806\u7684\u6bb5\u5c3d\u91cf\u5206\u914d\u5728\u5b83\u5bf9\u5e94 CPU \u7684\u672c\u5730\u5185\u5b58\u4e0a&#xff0c;\u914d\u5408\u7ed1\u6838&#xff0c;\u628a&#034;\u7ebf\u7a0b\u2014\u6838\u2014\u5185\u5b58&#034;\u9489\u6210\u4e00\u7ec4\u3002<\/p>\n<p>\u7ed1\u6838\u672c\u8eab\u901a\u8fc7\u7ebf\u7a0b\u4eb2\u548c\u63a9\u7801\u5b9e\u73b0&#xff08;Windows \u4e0b\u5373\u539f\u7a3f\u63d0\u5230\u7684\u00a0SetThreadAffinityMask\u00a0\u4e00\u7c7b\u63a5\u53e3&#xff09;&#xff0c;.NET \u7528\u00a0DOTNET_GCHeapAffinitizeMask\u00a0\u6307\u5b9a GC \u7ebf\u7a0b\u4e0e\u5806\u843d\u5728\u54ea\u4e9b\u6838\u4e0a&#xff0c;DOTNET_GCNoAffinitize\u00a0\u5173\u95ed\u7ed1\u6838\u6539\u7531\u64cd\u4f5c\u7cfb\u7edf\u8c03\u5ea6\u3002\u66f4\u9ad8\u4e00\u5c42\u662f CPU \u5206\u7ec4&#xff08;CPU group&#xff09;&#xff1a;Windows \u5355\u7ec4\u6700\u591a 64 \u4e2a\u903b\u8f91\u5904\u7406\u5668&#xff0c;\u8d85\u8fc7 64 \u6838\u7684\u673a\u5668\u88ab\u62c6\u6210\u591a\u7ec4&#xff0c;\u8fd0\u884c\u65f6\u5bf9\u7ec4\u8fb9\u754c\u7684\u5904\u7406\u51b3\u5b9a\u4e86\u5806\u6570\u4e0e\u7ed1\u6838\u63a9\u7801\u80fd\u4e0d\u80fd\u8986\u76d6\u5168\u90e8\u6838\u2014\u2014\u8fd9\u662f&#034;GC \u4eb2\u548c\u63a9\u7801\u7b97\u9519&#034;\u7c7b\u95ee\u9898\u7684\u9ad8\u53d1\u533a&#xff0c;\u914d\u7f6e\u65f6\u8981\u6309\u7ec4\u5c55\u5f00\u8ba1\u7b97&#xff0c;\u4e0d\u80fd\u60f3\u5f53\u7136\u7528\u4e00\u5f20 64 \u4f4d\u63a9\u7801\u76d6\u8fc7\u53bb\u3002<\/p>\n<p>\u539f\u7a3f\u63d0\u5230 .NET 8&#043; \u81ea\u52a8\u68c0\u6d4b NUMA \u62d3\u6251\u5e76\u4f18\u5316\u6bb5\u5206\u914d\u3002\u81ea\u52a8\u8def\u5f84\u4e4b\u5916\u4ecd\u5efa\u8bae\u663e\u5f0f\u914d\u7f6e\u7684\u573a\u5408\u662f\u5bb9\u5668\u4e0e\u865a\u62df\u673a&#xff1a;vCPU \u7684\u62d3\u6251\u53ef\u80fd\u4e0e\u7269\u7406\u673a\u4e0d\u4e00\u81f4&#xff0c;\u8fd0\u884c\u65f6\u6309\u5bb9\u5668\u53ef\u89c1\u7684\u6838\u6570\u521d\u59cb\u5316&#xff0c;\u8d85\u51fa\u914d\u989d\u7684\u5806\u6570\u4e0e\u9519\u8bef\u7684\u63a9\u7801\u90fd\u4f1a\u76f4\u63a5\u53cd\u6620\u5728 GC \u505c\u987f\u4e0a&#xff08;\u914d\u7f6e\u5bf9\u9f50\u7684\u505a\u6cd5\u53c2\u89c1 03-05 \u7b2c\u516b\u8282&#xff09;\u3002<\/p>\n<h4 id=\"52-\u6536\u76ca-\u9002\u7528\u4e0e\u5c40\u9650\">5.2 \u6536\u76ca\u3001\u9002\u7528\u4e0e\u5c40\u9650<\/h4>\n<p>\u6536\u76ca\u7ed3\u6784\u662f&#034;\u51cf\u5c11\u8de8\u63d2\u69fd\u8bbf\u5b58 &#043; \u51cf\u5c11\u6838\u95f4\u8fc1\u79fb\u5bfc\u81f4\u7684\u7f13\u5b58\u5931\u6548&#034;&#xff0c;\u539f\u7a3f\u57fa\u51c6\u8868\u7ed9 CPU \u4eb2\u548c\u7ed1\u6838\u5355\u9879 -15%&#xff08;\u793a\u4f8b\u91cf\u7ea7&#xff0c;16 \u6838 64GB Web API&#xff0c;\u975e\u5b9e\u6d4b\u5e38\u6570&#xff09;\u3002\u9002\u7528&#xff1a;\u591a\u8def\u7269\u7406\u673a\u300164 \u6838\u4ee5\u4e0a\u7684\u5355\u673a\u3001Server GC \u5e38\u9a7b\u7684\u670d\u52a1\u3002\u5c40\u9650\u6709\u4e09&#xff1a;\u7ed1\u6838\u628a GC \u7ebf\u7a0b\u9489\u6b7b&#xff0c;\u4e0e\u4e1a\u52a1\u7ebf\u7a0b\u62a2\u540c\u4e00\u7ec4\u6838\u65f6\u53cd\u800c\u5236\u9020\u7ade\u4e89&#xff0c;\u6240\u4ee5\u63a9\u7801\u8981\u7ed9 GC \u7559\u4e13\u7528\u6838\u6216\u81f3\u5c11\u907f\u5f00\u4e1a\u52a1\u70ed\u70b9\u6838&#xff1b;\u5bb9\u5668\u91cc\u6838\u4f1a\u88ab\u5bbf\u4e3b\u673a\u8c03\u5ea6\u8fc1\u79fb&#xff0c;\u786c\u7ed1\u6838\u53ef\u80fd\u5236\u9020\u7b49\u5f85&#xff0c;\u4f4e\u6838\u5bb9\u5668\u5e38\u7528\u00a0DOTNET_GCNoAffinitize\u00a0\u5173\u6389&#xff1b;CPU \u5206\u7ec4\u8fb9\u754c\u4e0e\u63a9\u7801\u4f4d\u5bbd\u8981\u9010\u6bb5\u6838\u5bf9&#xff0c;\u914d\u9519\u7684\u63a9\u7801\u6bd4\u4e0d\u914d\u66f4\u7cdf\u3002<\/p>\n<h3 id=\"\u516d-\u591a\u5806\u4e0e-gc-\u611f\u77e5\u7684\u5206\u914d\u8def\u5f84\">\u516d\u3001\u591a\u5806\u4e0e GC \u611f\u77e5\u7684\u5206\u914d\u8def\u5f84<\/h3>\n<h4 id=\"61-\u5206\u914d\u7a97\u53e3\u5e76\u53d1\u7684\u7b2c\u4e00\u9053\u5730\u57fa\">6.1 \u5206\u914d\u7a97\u53e3&#xff1a;\u5e76\u53d1\u7684\u7b2c\u4e00\u9053\u5730\u57fa<\/h4>\n<p>\u7b2c\u4e09\u5c42\u7684\u4e3b\u89d2\u662f\u5206\u914d\u4e0a\u4e0b\u6587\u2014\u2014\u6bcf\u4e2a\u6258\u7ba1\u7ebf\u7a0b\u72ec\u5360\u4e00\u6bb5 bump \u5206\u914d\u7a97\u53e3&#xff0c;\u7a97\u53e3\u5185\u5206\u914d\u53ea\u505a\u6307\u9488\u52a0\u6cd5&#xff0c;\u65e0\u9501\u3001\u65e0\u904d\u5386&#xff08;07-02 \u5df2\u9010\u884c\u62c6\u8fc7\u5feb\u6162\u8def\u5f84&#xff0c;\u672c\u6587\u53ea\u8c08\u5b83\u4f5c\u4e3a\u4f18\u5316\u5730\u57fa\u7684\u610f\u4e49&#xff09;\u3002\u539f\u7a3f&#034;\u7ebf\u7a0b\u5c40\u90e8\u7f13\u5b58\u7684\u6781\u81f4\u4f18\u5316&#034;\u4e00\u8282\u7ed9\u51fa\u7684\u591a\u7ea7\u7ed3\u6784\u53ef\u4ee5\u6982\u62ec\u6210\u4e00\u5f20\u5206\u5c42\u547d\u4e2d\u8868&#xff1a;<\/p>\n<table>\n<tr>\u5c42\u7ea7\u547d\u4e2d\u7387&#xff08;\u539f\u7a3f\u53e3\u5f84&#xff09;\u8bf4\u660e\u53e3\u5f84\u6807\u6ce8<\/tr>\n<tbody>\n<tr>\n<td>\u7ebf\u7a0b\u5c40\u90e8\u7a97\u53e3&#xff08;TLAB \u5f0f&#xff09;<\/td>\n<td>&gt;99.9%<\/td>\n<td>\u6307\u9488\u52a0\u6cd5\u76f4\u63a5\u5b8c\u6210&#xff0c;\u5b8c\u5168\u65e0\u9501<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u975e\u5b9e\u6d4b\u5e38\u6570<\/td>\n<\/tr>\n<tr>\n<td>L1 \u6bb5\u7f13\u5b58<\/td>\n<td>~90%<\/td>\n<td>\u7ebf\u7a0b\u7a97\u53e3\u7528\u5c3d\u540e\u5148\u95ee\u672c\u7ebf\u7a0b\u7f13\u5b58\u7684\u6bb5<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7<\/td>\n<\/tr>\n<tr>\n<td>L2 \u6bb5\u7f13\u5b58<\/td>\n<td>~8%<\/td>\n<td>\u518d\u95ee\u5806\u7ea7\u7f13\u5b58\u7684\u7a7a\u95f2\u6bb5<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7<\/td>\n<\/tr>\n<tr>\n<td>\u5168\u5c40\u6bb5\u7ba1\u7406<\/td>\n<td>&lt;0.1%<\/td>\n<td>\u6700\u540e\u624d\u8d70\u5168\u5c40\u9501\u4e0e\u5411\u7cfb\u7edf\u8981\u5185\u5b58<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u539f\u7a3f\u7684\u7ed3\u8bba&#034;99.9% \u5206\u914d\u5728 TLAB \u5185\u65e0\u9501\u5b8c\u6210&#xff0c;\u8fd9\u662f Server GC \u9ad8\u5e76\u53d1\u4e0b\u7ebf\u6027\u6269\u5c55\u7684\u5173\u952e&#034;\u6210\u7acb&#xff0c;\u4e14\u5b83\u89e3\u91ca\u4e86\u591a\u5806\u4f18\u5316\u7684\u610f\u4e49&#xff1a;\u7ebf\u7a0b\u7a97\u53e3\u4e4b\u4e0a\u8fd8\u6709\u6bb5\u7f13\u5b58&#xff0c;\u6bb5\u7f13\u5b58\u4e4b\u4e0a\u624d\u662f\u5168\u5c40\u6bb5\u7ba1\u7406&#xff0c;\u7edd\u5927\u591a\u6570\u5206\u914d\u6839\u672c\u8d70\u4e0d\u5230\u9700\u8981\u548c GC \u534f\u8c03\u7684\u90a3\u4e00\u6b65\u3002Server \u591a\u5806\u628a\u8fd9\u6761\u94fe\u8def\u518d\u5207\u77ed\u2014\u2014\u6bcf\u4e2a\u6838\u7684\u7ebf\u7a0b\u4e3b\u8981\u7528\u672c\u5806\u7684\u6bb5&#xff0c;\u8fde\u8de8\u5806\u534f\u8c03\u90fd\u7701\u4e86\u3002\u8bfb\u8fd9\u5f20\u8868\u8981\u7559\u4e2a\u5fc3\u773c&#xff1a;\u56db\u5c42\u547d\u4e2d\u7387\u6765\u81ea\u539f\u7a3f\u7684\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u4e0d\u540c\u8d1f\u8f7d\u5dee\u5f02\u5f88\u5927&#xff0c;\u771f\u5b9e\u5206\u5e03\u8981\u7528\u5206\u914d\u6162\u8def\u5f84\u7684\u91c7\u6837\u6570\u636e\u6821\u51c6&#xff0c;\u522b\u62ff\u5b83\u5f53\u9a8c\u6536\u6307\u6807\u3002<\/p>\n<h4 id=\"62-gc-\u611f\u77e5\u7684\u5206\u914d\">6.2 GC \u611f\u77e5\u7684\u5206\u914d<\/h4>\n<p>\u539f\u7a3f\u7684&#034;GC \u611f\u77e5\u7684\u5206\u914d&#034;\u8bb2\u7684\u662f\u5206\u914d\u5165\u53e3\u4e0e GC \u72b6\u6001\u7684\u63e1\u624b&#xff1a;JIT \u5728\u5206\u914d\u4ee3\u7801\u4e2d\u63d2\u5165\u68c0\u67e5\u70b9&#xff0c;GC \u8fdb\u884c\u671f\u95f4\u5206\u914d\u8d70\u5b89\u5168\u8def\u5f84&#xff0c;\u907f\u514d\u5728 GC \u6267\u884c\u8fc7\u7a0b\u4e2d\u8bef\u89e6\u53d1\u65b0\u7684\u56de\u6536\u6216\u4e0e\u4e4b\u62a2\u5360\u5806\u5143\u6570\u636e\u3002\u8fd9\u4e2a\u63cf\u8ff0\u5bf9\u5e94\u7684\u662f\u8fd0\u884c\u65f6\u91cc\u5206\u914d\u6162\u8def\u5f84\u4e0e GC \u72b6\u6001\u6807\u5fd7\u7684\u540c\u6b65\u2014\u2014\u5206\u914d\u662f\u552f\u4e00\u80fd&#034;\u53eb\u9192&#034;GC \u7684\u65e5\u5e38\u52a8\u4f5c&#xff0c;\u5982\u679c\u5b83\u5728 GC \u6b63\u5fd9\u65f6\u9192\u6765&#xff0c;\u8981\u4e48\u7b49\u5f85\u3001\u8981\u4e48\u8d70\u91cd\u8bd5&#xff0c;\u7edd\u4e0d\u80fd\u4e24\u4e2a\u56de\u6536\u540c\u65f6\u6539\u5806\u3002\u5bf9\u5e94\u7528\u5f00\u53d1\u8005&#xff0c;\u8fd9\u6761\u673a\u5236\u7684\u5b9e\u9645\u610f\u4e49\u662f&#xff1a;\u5206\u914d\u7684\u6162\u8def\u5f84\u5728 GC \u671f\u95f4\u4f1a\u53d8\u6162\u3002\u6240\u4ee5&#034;GC \u671f\u95f4\u4e0d\u8981\u5728\u70ed\u5faa\u73af\u91cc\u5206\u914d&#034;\u4e0d\u53ea\u662f\u5c11\u9020\u5783\u573e&#xff0c;\u4e5f\u662f\u5c11\u649e\u8fd9\u6b21\u63e1\u624b\u3002<\/p>\n<p>\u628a\u5b83\u548c\u540e\u53f0 GC \u653e\u5728\u4e00\u8d77\u770b&#xff08;\u72b6\u6001\u673a\u7ec6\u8282\u89c1 07-05&#xff09;&#xff1a;\u540e\u53f0\u6807\u8bb0\u671f\u95f4&#xff0c;\u524d\u53f0\u5206\u914d\u7167\u5e38\u8d70\u7a97\u53e3&#xff0c;\u53ea\u6709\u7a97\u53e3\u8017\u5c3d\u624d\u843d\u5230\u6162\u8def\u5f84&#xff0c;\u6162\u8def\u5f84\u518d\u6309\u5f53\u524d GC \u72b6\u6001\u51b3\u5b9a\u7533\u8bf7\u65b0\u7a97\u53e3\u3001\u8981\u65b0\u6bb5\u8fd8\u662f\u89e6\u53d1\u56de\u6536\u3002\u4e09\u5c42\u5224\u65ad\u5c42\u5c42\u9012\u8fdb&#xff0c;\u4efb\u4f55\u4e00\u5c42\u7684\u8bbe\u8ba1\u76ee\u6807\u90fd\u662f\u8ba9\u70ed\u8def\u5f84\u5c11\u9047\u89c1 GC\u3002<\/p>\n<h4 id=\"63-\u6536\u76ca-\u9002\u7528\u4e0e\u5c40\u9650\">6.3 \u6536\u76ca\u3001\u9002\u7528\u4e0e\u5c40\u9650<\/h4>\n<p>\u5206\u914d\u5c42\u4f18\u5316\u7684\u6536\u76ca\u4e0d\u4f53\u73b0\u5728\u6682\u505c\u4e0a&#xff0c;\u4f53\u73b0\u5728\u541e\u5410\u4e0e\u6269\u5c55\u6027\u4e0a&#xff1a;\u5206\u914d\u4e0d\u6392\u961f&#xff0c;\u591a\u6838\u624d\u80fd\u7ebf\u6027\u52a0\u538b\u3002\u9002\u7528\u573a\u666f\u662f\u5206\u914d\u901f\u7387\u9ad8\u7684\u6240\u6709 .NET \u670d\u52a1&#xff0c;\u5b83\u6ca1\u6709&#034;\u4e0d\u8be5\u7528&#034;\u7684\u573a\u666f&#xff0c;\u53ea\u6709\u914d\u7f6e\u9519\u7684\u573a\u666f\u2014\u2014\u6700\u5178\u578b\u7684\u662f Server GC \u4e0e\u5806\u6570\u4e0d\u5339\u914d&#xff08;1 \u5230 2 \u6838\u5bb9\u5668\u5f00 Server\u3001\u6216 64 \u6838\u673a\u5668\u4e0d\u914d HeapCount&#xff09;&#xff0c;\u8ba9\u591a\u5806\u7684\u4f18\u52bf\u53d8\u6210\u5185\u5b58\u6d6a\u8d39\u3002\u5c40\u9650\u5728\u4e8e\u8fd9\u5957\u7a97\u53e3\u4e0e\u7f13\u5b58\u7684\u5b58\u5728\u611f\u53ea\u5728\u6162\u8def\u5f84\u66b4\u9732&#xff1a;\u5982\u679c\u4f60\u7684\u5806\u91cc 90% \u662f LOH \u5927\u5bf9\u8c61&#xff0c;\u5206\u914d\u6839\u672c\u7ed5\u5f00\u7a97\u53e3\u8d70\u72ec\u7acb\u8def\u5f84&#xff0c;\u8fd9\u4e00\u5c42\u4f18\u5316\u5bf9\u4f60\u5c31\u6240\u5269\u65e0\u51e0\u3002<\/p>\n<h3 id=\"\u4e03-gen0-\u9884\u7b97\u81ea\u9002\u5e94\">\u4e03\u3001Gen0 \u9884\u7b97\u81ea\u9002\u5e94<\/h3>\n<h4 id=\"71-\u539f\u7406\">7.1 \u539f\u7406<\/h4>\n<p>GC \u4ec0\u4e48\u65f6\u5019\u89e6\u53d1&#xff0c;\u4e0d\u662f\u5b9a\u65f6\u5668\u51b3\u5b9a\u7684&#xff0c;\u662f\u9884\u7b97\u51b3\u5b9a\u7684&#xff1a;\u6bcf\u4e2a\u4ee3\u6709\u4e00\u4efd\u5206\u914d\u9884\u7b97&#xff0c;\u82b1\u5149\u5373\u56de\u6536&#xff0c;\u56de\u6536\u540e\u6309\u4e0a\u4e00\u8f6e\u7684\u5b58\u6d3b\u7387\u56de\u5199\u4e0b\u6b21\u9884\u7b97\u2014\u2014\u5b58\u6d3b\u591a\u8bf4\u660e\u5bf9\u8c61\u6bd4\u9884\u60f3\u7684\u957f\u5bff&#xff0c;\u5c31\u628a\u9884\u7b97\u8c03\u5c0f\u8ba9\u4e0b\u6b21\u56de\u6536\u6765\u5f97\u66f4\u65e9&#xff1b;\u5b58\u6d3b\u5c11\u5c31\u8c03\u5927&#xff0c;\u628a\u56de\u6536\u95f4\u9694\u62c9\u957f\u3002\u8fd9\u5957\u56de\u5199\u673a\u5236\u5c31\u662f\u9884\u7b97\u5c42\u7684\u81ea\u9002\u5e94&#xff0c;\u5b83\u8ba9\u56de\u6536\u9891\u7387\u81ea\u52a8\u6b63\u6bd4\u4e8e\u5206\u914d\u901f\u7387&#xff0c;\u4e0d\u9700\u8981\u4eba\u5de5\u8c03\u5468\u671f&#xff0c;\u4e5f\u81ea\u52a8\u9002\u5e94\u8d1f\u8f7d\u7684\u9636\u6bb5\u6027\u53d8\u5316&#xff08;\u5927\u4e16\u754c\u52a0\u8f7d\u671f\u5206\u914d\u731b\u3001\u6218\u6597\u671f\u5206\u914d\u7f13&#xff0c;\u9884\u7b97\u8ddf\u7740\u8d70&#xff09;\u3002<\/p>\n<p>\u5206\u4ee3\u4e4b\u95f4\u7684\u8054\u52a8\u662f\u5b83\u7684\u53e6\u4e00\u534a&#xff1a;Gen0 \u56de\u6536\u7684\u5e78\u5b58\u8005\u8fdb Gen1&#xff0c;Gen1 \u9884\u7b97\u51b3\u5b9a&#034;\u664b\u5347\u8fc7\u6ee4\u5668&#034;\u7684\u677e\u7d27&#xff0c;Gen2 \u9884\u7b97\u5219\u7531\u5b58\u6d3b\u96c6\u89c4\u6a21\u4e0e\u538b\u7f29\u6536\u76ca\u5171\u540c\u51b3\u5b9a\u3002\u4efb\u4f55\u4e00\u4ee3\u7684\u9884\u7b97\u5931\u8861\u90fd\u4f1a\u5411\u4e0a\u6e38\u4f20\u5bfc\u2014\u2014Gen0 \u9884\u7b97\u8fc7\u5927&#xff0c;\u5355\u6b21\u56de\u6536\u53d8\u8d35&#xff1b;\u8fc7\u5c0f&#xff0c;\u56de\u6536\u9891\u7e41\u3001\u664b\u5347\u538b\u529b\u5927\u3002\u539f\u7a3f\u628a\u8fd9\u9879\u5355\u5217\u6210\u4f18\u5316\u70b9&#xff0c;\u7406\u7531\u6b63\u662f\u5b83\u7528\u7edf\u8ba1\u53cd\u9988\u66ff\u4ee3\u4e86\u9759\u6001\u53c2\u6570&#xff0c;\u5c5e\u4e8e&#034;\u4e0d\u9700\u8981\u8fd0\u7ef4\u53c2\u4e0e&#034;\u7684\u90a3\u7c7b\u81ea\u9002\u5e94\u3002<\/p>\n<h4 id=\"72-\u6536\u76ca-\u9002\u7528\u4e0e\u5c40\u9650\">7.2 \u6536\u76ca\u3001\u9002\u7528\u4e0e\u5c40\u9650<\/h4>\n<p>\u6536\u76ca\u662f\u7a33\u6001\u4e0b\u5206\u914d\u901f\u7387\u4e0e\u56de\u6536\u9891\u7387\u7684\u81ea\u52a8\u5339\u914d&#xff0c;\u7701\u6389\u4e00\u6b21\u4e00\u6b21\u538b\u6d4b\u8c03\u53c2\u3002\u9002\u7528&#xff1a;\u8d1f\u8f7d\u6709\u5468\u671f\u6027\u53d8\u5316\u7684\u670d\u52a1&#xff08;\u8fd9\u6070\u662f\u9759\u6001\u53c2\u6570\u6700\u4e0d\u64c5\u957f\u7684&#xff09;\u3002\u5c40\u9650\u6709\u4e8c&#xff1a;\u53cd\u9988\u4f9d\u8d56\u5386\u53f2\u5b58\u6d3b\u7387&#xff0c;\u8d1f\u8f7d\u7a81\u53d8\u7684\u77ac\u95f4\u5b83\u8981\u82b1\u4e00\u5230\u4e24\u8f6e\u56de\u6536\u624d\u80fd\u8ddf\u4e0a&#xff0c;\u7a81\u53d8\u671f\u4f1a\u51fa\u73b0\u9891\u7387\u504f\u9ad8\u6216\u504f\u4f4e\u7684\u6296\u52a8&#xff1b;\u9884\u7b97\u53ea\u5bf9 SOH \u5206\u4ee3\u6709\u6548&#xff0c;LOH \u7684\u5927\u5bf9\u8c61\u5206\u914d\u4e0d\u8d70\u8fd9\u5957\u8bb0\u8d26&#xff0c;\u5927\u5bf9\u8c61\u4e3b\u5bfc\u7684\u8d1f\u8f7d\u8981\u53e6\u770b&#xff08;07-04 \u8bb2\u8fc7\u7684 LOH \u788e\u7247\u4e0e\u663e\u5f0f\u538b\u7f29&#xff09;\u3002<\/p>\n<h3 id=\"\u516b-gc-\u914d\u7f6e\u9879\u5168\u666f\">\u516b\u3001GC \u914d\u7f6e\u9879\u5168\u666f<\/h3>\n<p>\u524d\u9762\u6240\u6709\u5c42\u90fd\u7559\u4e86\u914d\u7f6e\u65cb\u94ae\u3002\u4ee5 runtimeconfig \u7684\u5f62\u5f0f\u96c6\u4e2d\u5217\u51fa&#xff08;\u9879\u76ee\u6587\u4ef6\u5c5e\u6027\u3001\u73af\u5883\u53d8\u91cf\u4e24\u79cd\u5199\u6cd5\u4e0e\u4e4b\u7b49\u4ef7&#xff0c;\u5bb9\u5668\u90e8\u7f72\u63a8\u8350\u73af\u5883\u53d8\u91cf&#xff09;&#xff1a;<\/p>\n<p>{<br \/>\n  &#034;runtimeOptions&#034;: {<br \/>\n    &#034;configProperties&#034;: {<br \/>\n      &#034;System.GC.Server&#034;: true,<br \/>\n      &#034;System.GC.Concurrent&#034;: true,<br \/>\n      &#034;System.GC.HeapCount&#034;: 8,<br \/>\n      &#034;System.GC.NoAffinitize&#034;: false,<br \/>\n      &#034;System.GC.RetainVM&#034;: false<br \/>\n    }<br \/>\n  }<br \/>\n}<\/p>\n<p>\u9010\u9879\u89e3\u8bfb&#xff1a;System.GC.Server\u00a0\u5207\u591a\u5806\u5e76\u884c&#xff0c;\u662f\u7b2c\u4e8c\u5c42\u62d3\u6251\u611f\u77e5\u7684\u603b\u5f00\u5173&#xff1b;System.GC.Concurrent\u00a0\u662f\u540e\u53f0 GC \u7684\u5f00\u5173&#xff0c;\u76f4\u63a5\u51b3\u5b9a Gen2 \u56de\u6536\u8d70\u5e76\u53d1\u8fd8\u662f\u963b\u585e&#xff08;\u540e\u53f0\u72b6\u6001\u673a\u672c\u8eab\u89c1 07-05&#xff0c;\u6b64\u5904\u4e0d\u5c55\u5f00&#xff09;&#xff1b;System.GC.HeapCount\u00a0\u663e\u5f0f\u6307\u5b9a\u5806\u6570&#xff0c;\u5bb9\u5668\u91cc\u5fc5\u987b\u4e0e CPU \u914d\u989d\u5bf9\u9f50&#xff0c;\u5426\u5219\u591a\u5806\u7684\u5e76\u884c\u6536\u76ca\u53d8\u6210\u5185\u5b58\u4e0e\u5e26\u5bbd\u7684\u6d6a\u8d39&#xff1b;System.GC.NoAffinitize\u00a0\u5173\u95ed\u7ed1\u6838&#xff0c;\u6838\u4f1a\u88ab\u8fc1\u79fb\u7684\u5bb9\u5668\u91cc\u5e38\u4e0e\u5c0f HeapCount \u642d\u914d&#xff1b;System.GC.RetainVM\u00a0\u63a7\u5236\u56de\u6536\u540e\u7684\u6bb5\u662f\u5426\u8fde\u865a\u62df\u5730\u5740\u4e5f\u5f52\u8fd8&#xff0c;\u5f71\u54cd\u7684\u662f\u6bb5\u9884\u6620\u5c04\u4e0e\u6bb5\u7f13\u5b58\u7684\u6fc0\u8fdb\u7a0b\u5ea6\u3002\u914d\u7f6e\u672c\u8eab\u6ca1\u6709\u4f18\u52a3&#xff0c;\u53ea\u6709&#034;\u548c\u90e8\u7f72\u73af\u5883\u5339\u4e0d\u5339\u914d&#034;\u2014\u201403-05 \u7b2c\u516b\u8282\u7ed9\u8fc7\u5224\u65ad\u8868&#xff0c;\u672c\u6587\u53ea\u8865\u5145\u5b83\u4e0e\u5404\u4f18\u5316\u5c42\u7684\u5bf9\u5e94\u5173\u7cfb&#xff1a;\u6bcf\u4e2a\u952e\u80cc\u540e\u90fd\u7ad9\u7740\u524d\u9762\u67d0\u4e00\u5c42\u7684\u4e00\u6bb5\u539f\u7406\u3002<\/p>\n<p>\u4e0e\u4e4b\u914d\u5957\u7684\u8fd0\u884c\u65f6\u5f00\u5173\u8fd8\u6709\u00a0DOTNET_GCHeapAffinitizeMask&#xff08;\u7ed1\u6838\u63a9\u7801&#xff0c;\u7b2c\u4e94\u8282&#xff09;\u3001DOTNET_GCConcurrent&#xff08;\u540e\u53f0\u5f00\u5173\u7684\u73af\u5883\u53d8\u91cf\u5199\u6cd5&#xff09;\u3001DOTNET_GCNoAffinitize&#xff08;\u5173\u95ed\u7ed1\u6838&#xff09;\u3002\u547d\u540d\u89c4\u5f8b\u662f runtimeconfig \u952e\u53bb\u6389\u00a0System.GC.\u00a0\u524d\u7f00\u52a0\u00a0DOTNET_\u00a0\u524d\u7f00&#xff0c;\u914d\u7f6e\u9519\u4e86\u8981\u4e24\u5904\u90fd\u67e5&#xff1a;\u952e\u62fc\u9519\u4e0d\u4f1a\u62a5\u9519&#xff0c;\u8fdb\u7a0b\u7167\u5e38\u542f\u52a8&#xff0c;\u53ea\u662f\u6240\u6709\u4f18\u5316\u9ed8\u9ed8\u5931\u6548\u2014\u2014\u6240\u4ee5\u542f\u52a8\u65e5\u5fd7\u6253\u5370\u00a0GCSettings.IsServerGC\u3001LatencyMode\u00a0\u662f\u5fc5\u987b\u52a8\u4f5c\u3002<\/p>\n<h3 id=\"\u4e5d-\u53ef\u89c2\u6d4b\u6027gc-\u65e5\u5fd7\u4e0e\u5806\u53ef\u89c6\u5316\">\u4e5d\u3001\u53ef\u89c2\u6d4b\u6027&#xff1a;GC \u65e5\u5fd7\u4e0e\u5806\u53ef\u89c6\u5316<\/h3>\n<p>\u4f18\u5316\u6ca1\u751f\u6548\u7b49\u4e8e\u6ca1\u505a&#xff0c;\u8fd9\u4e00\u5c42\u7684\u4f5c\u7528\u662f\u7ed9\u524d\u56db\u5c42\u88c5\u4eea\u8868\u3002\u4e09\u7c7b\u624b\u6bb5\u6309\u7c92\u5ea6\u6392\u5f00&#xff1a;<\/p>\n<table>\n<tr>\u624b\u6bb5\u80fd\u770b\u5230\u4ec0\u4e48\u5bf9\u5e94\u54ea\u5c42\u4f18\u5316<\/tr>\n<tbody>\n<tr>\n<td>PerfView \/ ETW GC \u4e8b\u4ef6<\/td>\n<td>\u6bcf\u8f6e\u56de\u6536\u7684\u4ee3\u6570\u3001blocking \u4e0e background\u3001\u9636\u6bb5\u8017\u65f6\u3001\u5206\u914d\u901f\u7387<\/td>\n<td>\u540e\u53f0 GC\u3001\u9884\u7b97\u5c42<\/td>\n<\/tr>\n<tr>\n<td>dotnet-counters \u5b9e\u65f6\u8ba1\u6570\u5668<\/td>\n<td>\u5806\u5927\u5c0f\u3001\u56de\u6536\u6b21\u6570\u3001\u5de5\u4f5c\u96c6\u7684\u8d8b\u52bf\u659c\u7387<\/td>\n<td>\u9884\u7b97\u5c42\u3001\u6bb5\u9884\u6620\u5c04<\/td>\n<\/tr>\n<tr>\n<td>GC \u65e5\u5fd7\u4e0e GCHeapStats \u7c7b\u4e8b\u4ef6<\/td>\n<td>\u5404\u4ee3\u5b58\u6d3b\u91cf\u3001\u664b\u5347\u91cf\u3001\u6bb5\u4e0e\u4ee3\u7684\u5730\u5740\u8303\u56f4\u53d8\u5316<\/td>\n<td>\u6bb5\u7ba1\u7406\u3001\u5927\u9875\u751f\u6548\u60c5\u51b5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u539f\u7a3f\u7279\u522b\u70b9\u540d PerfView \u652f\u6301&#xff0c;\u539f\u56e0\u662f\u5b83\u628a ETW \u7684 GC \u4e8b\u4ef6\u505a\u6210\u4e86\u53ef\u4ea4\u4e92\u7684\u5806\u89c6\u56fe\u4e0e\u65f6\u95f4\u7ebf&#xff1a;\u4e00\u6b21\u56de\u6536\u524d\u540e\u7684\u5b58\u6d3b\u96c6\u5bf9\u6bd4\u3001\u5206\u914d\u76f4\u65b9\u56fe\u3001\u6bb5\u8303\u56f4\u53d8\u5316\u90fd\u80fd\u76f4\u63a5\u770b\u56fe&#xff0c;\u4e0d\u9700\u8981\u81ea\u5df1\u89e3\u6790\u4e8b\u4ef6\u6d41\u3002\u5b9e\u7528\u987a\u5e8f\u5efa\u8bae\u662f&#034;\u5148\u8d8b\u52bf\u540e\u7ec6\u8282&#034;&#xff1a;dotnet-counters \u770b\u5230\u56de\u6536\u9891\u7387\u6216\u5806\u6c34\u4f4d\u5f02\u5e38&#xff0c;\u518d\u4e0a PerfView \u6293\u4e00\u6bb5\u4e8b\u4ef6\u5b9a\u4f4d\u662f\u54ea\u4e00\u4ee3\u3001\u54ea\u79cd\u6a21\u5f0f\u3001\u54ea\u4e2a\u9636\u6bb5\u53d8\u6162&#xff0c;\u6700\u540e\u624d\u52a8\u914d\u7f6e\u9a8c\u8bc1\u2014\u2014\u6bcf\u6539\u4e00\u4e2a\u952e\u8dd1\u4e00\u8f6e\u540c\u6837\u7684\u573a\u666f&#xff0c;\u8ba9\u524d\u540e\u4e8b\u4ef6\u6d41\u53ef\u5bf9\u6bd4&#xff0c;\u8fd9\u662f\u914d\u7f6e\u7c7b\u4f18\u5316\u552f\u4e00\u53ef\u4fe1\u7684\u9a8c\u6536\u65b9\u5f0f\u3002<\/p>\n<p>\u5927\u9875\u4e0e\u7ed1\u6838\u7684\u751f\u6548\u9a8c\u8bc1\u5355\u72ec\u8bf4\u4e00\u53e5&#xff1a;\u5b83\u4eec\u4e0d\u53d1\u6258\u7ba1\u5c42\u4e8b\u4ef6&#xff0c;\u8981\u5230\u64cd\u4f5c\u7cfb\u7edf\u4fa7\u770b&#xff08;Windows \u4efb\u52a1\u7ba1\u7406\u5668\/\u6027\u80fd\u76d1\u89c6\u5668\u91cc\u7684\u5927\u9875\u8ba1\u5165\u3001Linux \u4e0a\u770b\u9875\u5927\u5c0f\u4e0e\u7ebf\u7a0b\u4eb2\u548c\u72b6\u6001&#xff09;\u3002\u8fd9\u7c7b&#034;\u4ee3\u7801\u6ca1\u62a5\u9519\u4f46\u6ca1\u751f\u6548&#034;\u7684\u4f18\u5316&#xff0c;\u5fc5\u987b\u6709\u7cfb\u7edf\u4fa7\u7684\u786e\u8ba4\u6b65\u9aa4\u624d\u7b97\u95ed\u73af\u3002<\/p>\n<h3 id=\"\u5341-\u9884\u53d6\u4e0e\u6bb5\u63d0\u4ea4\u4e24\u5904\u4ee3\u7801\u7ea7\u5fae\u4f18\u5316\">\u5341\u3001\u9884\u53d6\u4e0e\u6bb5\u63d0\u4ea4&#xff1a;\u4e24\u5904\u4ee3\u7801\u7ea7\u5fae\u4f18\u5316<\/h3>\n<h4 id=\"101-\u6807\u8bb0\u671f\u7684\u6570\u636e\u9884\u53d6data-prefetch\">10.1 \u6807\u8bb0\u671f\u7684\u6570\u636e\u9884\u53d6&#xff08;Data Prefetch&#xff09;<\/h4>\n<p>\u539f\u7a3f\u7684\u5224\u65ad\u662f&#xff1a;\u6807\u8bb0\u9636\u6bb5\u904d\u5386\u5bf9\u8c61\u56fe\u65f6&#xff0c;\u8bbf\u95ee\u5bf9\u8c61\u524d\u63d0\u524d\u628a\u5b83\u52a0\u8f7d\u8fdb CPU \u7f13\u5b58&#xff0c;\u80fd\u663e\u8457\u51cf\u5c11\u7f13\u5b58\u672a\u547d\u4e2d\u3002\u4fdd\u7559\u539f\u6587\u4ee3\u7801&#xff1a;<\/p>\n<p>\/\/ \u7b80\u5316\u4f2a\u4ee3\u7801 \/ \u793a\u610f&#xff1a;\u6807\u8bb0\u65f6\u7684\u9884\u53d6\u4f18\u5316<br \/>\nvoid MarkObject(Object* obj) {<br \/>\n    \/\/ \u5728\u6807\u8bb0 obj \u4e4b\u524d&#xff0c;\u9884\u53d6 obj \u5f15\u7528\u7684\u7b2c\u4e00\u4e2a\u5bf9\u8c61<br \/>\n    if (obj-&gt;first_ref !&#061; NULL) {<br \/>\n        __builtin_prefetch(obj-&gt;first_ref, 0, 3); \/\/ \u8bfb\u9884\u53d6&#xff0c;\u9ad8\u5c40\u90e8\u6027<br \/>\n    }<br \/>\n    \/\/ \u6807\u8bb0 obj<br \/>\n    SetMarked(obj);<br \/>\n}<\/p>\n<p>\u9010\u6bb5\u89e3\u8bfb&#xff1a;\u8fd9\u6bb5\u662f\u7b80\u5316\u4f2a\u4ee3\u7801\u3001\u793a\u610f\u6027\u8d28&#xff0c;\u4e0d\u662f\u9010\u5b57\u6e90\u7801\u2014\u2014\u771f\u5b9e\u8fd0\u884c\u65f6\u7684\u9884\u53d6\u63d2\u5165\u4f4d\u7f6e\u3001\u6307\u4ee4\u9009\u62e9\u4e0e\u9000\u907f\u7b56\u7565\u968f\u5e73\u53f0\u548c\u7248\u672c\u53d8\u5316&#xff0c;__builtin_prefetch\u00a0\u662f\u4e3a\u4e86\u8868\u8fbe&#034;\u8bfb\u9884\u53d6\u3001\u9ad8\u5c40\u90e8\u6027\u63d0\u793a&#034;\u7684\u7f16\u8bd1\u5668\u5185\u5efa\u5199\u6cd5\u3002\u9010\u884c\u770b&#xff1a;if (obj-&gt;first_ref !&#061; NULL)\u00a0\u5728\u53d6\u5f15\u7528\u524d\u5148\u5224\u7a7a&#xff0c;\u56e0\u4e3a\u9884\u53d6\u4e00\u4e2a\u7a7a\u5730\u5740\u8f7b\u5219\u6d6a\u8d39\u4e00\u4e2a\u9884\u53d6\u69fd\u3001\u91cd\u5219\u5728\u90e8\u5206\u5e73\u53f0\u5f15\u53d1\u5f02\u5e38&#xff0c;\u5224\u7a7a\u662f\u6210\u672c\u63a5\u8fd1\u96f6\u7684\u4fdd\u9669&#xff1b;__builtin_prefetch(addr, 0, 3)\u00a0\u7684\u4e24\u4e2a\u53c2\u6570\u5206\u522b\u8868\u793a&#034;\u8bfb\u8bbf\u95ee&#034;\u4e0e&#034;\u6700\u9ad8\u5c40\u90e8\u6027&#034;&#xff0c;\u5b83\u7684\u8bed\u4e49\u662f&#034;\u628a\u8fd9\u884c\u6570\u636e\u642c\u8fdb\u7f13\u5b58\u4f46\u4e0d\u6539\u4efb\u4f55\u72b6\u6001&#034;&#xff0c;\u547d\u4e2d\u5c31\u7701\u4e00\u6b21\u5185\u5b58\u7b49\u5f85&#xff0c;\u672a\u547d\u4e2d\u4e5f\u51e0\u4e4e\u65e0\u635f\u5931\u2014\u2014\u8fd9\u7c7b\u6307\u4ee4\u7684\u6536\u76ca\u5929\u7136\u9002\u5408\u5806\u53e0\u5728\u6807\u8bb0\u8fd9\u79cd\u5faa\u73af\u4ebf\u6b21\u7684\u70ed\u70b9\u4e0a&#xff1b;SetMarked(obj)\u00a0\u624d\u662f\u771f\u6b63\u7684\u6807\u8bb0\u5199\u56de&#xff0c;\u9884\u53d6\u53ea\u5f71\u54cd\u5b83\u5230\u5f97\u65e9\u4e0d\u65e9&#xff0c;\u4e0d\u5f71\u54cd\u6b63\u786e\u6027\u3002<\/p>\n<p>\u653e\u5728\u7b2c\u4e00\u5c42\u7684\u6846\u67b6\u91cc\u8bfb&#xff1a;\u9884\u53d6\u4f18\u5316\u7684\u662f&#034;\u4e0b\u4e00\u6b21\u89e6\u9875&#034;\u7684\u5ef6\u8fdf&#xff0c;\u5b83\u4e0d\u51cf\u5c11\u904d\u5386\u91cf&#xff0c;\u53ea\u8ba9\u904d\u5386\u66f4\u987a\u6ed1\u3002\u5b83\u7684\u5c40\u9650\u4e5f\u6e05\u695a\u2014\u2014\u5bf9\u8c61\u56fe\u5c40\u90e8\u6027\u5dee\u3001\u968f\u673a\u8df3\u8f6c\u4e25\u91cd\u7684\u5806&#xff0c;\u9884\u53d6\u7a97\u53e3\u8fd8\u6ca1\u5230\u6570\u636e\u5c31\u88ab\u6362\u51fa\u53bb\u4e86&#xff0c;\u6536\u76ca\u968f\u4e4b\u8870\u51cf&#xff1b;\u800c\u8fd9\u4e9b\u5dee\u5f02\u5728\u4e0d\u540c\u8d1f\u8f7d\u4e0a\u4e0d\u53ef\u63a7&#xff0c;\u6240\u4ee5\u5b83\u5c5e\u4e8e&#034;\u6709\u5219\u66f4\u597d\u3001\u4e0d\u627f\u8bfa\u591a\u5c11&#034;\u7684\u5e95\u5ea7\u4f18\u5316\u3002<\/p>\n<h4 id=\"102-\u96f6\u62f7\u8d1d\u6bb5\u63d0\u4ea4zero-copy-segment-commit\">10.2 \u96f6\u62f7\u8d1d\u6bb5\u63d0\u4ea4&#xff08;Zero-Copy Segment Commit&#xff09;<\/h4>\n<p>\u539f\u7a3f\u7684\u63cf\u8ff0\u4fdd\u7559&#xff1a;\u5728 Linux \u4e0a&#xff0c;.NET Core GC \u7528\u00a0fallocate\u00a0\u7684\u00a0FALLOC_FL_ZERO_RANGE\u00a0\u6807\u8bb0\u63d0\u4ea4\u65b0\u6bb5&#xff0c;\u907f\u514d\u663e\u5f0f\u7684\u00a0memset\u00a0\u6e05\u96f6&#xff1b;\u5bf9 64MB \u8fd9\u6837\u7684\u5927\u6bb5&#xff0c;\u8fd9\u53ef\u4ee5\u7701\u4e0b\u6570\u6beb\u79d2\u7684\u63d0\u4ea4\u65f6\u95f4&#xff08;\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u53d6\u51b3\u4e8e\u9875\u5927\u5c0f\u4e0e\u5185\u5b58\u5e26\u5bbd&#xff0c;\u975e\u5b9e\u6d4b\u5e38\u6570&#xff09;\u3002\u5b83\u7684\u539f\u7406\u662f\u628a&#034;\u4fdd\u8bc1\u65b0\u9875\u662f\u96f6&#034;\u8fd9\u4ef6\u4e8b\u4e0b\u63a8\u7ed9\u6587\u4ef6\u7cfb\u7edf\u4e0e\u5185\u6838\u6309\u9700\u5b8c\u6210&#xff0c;\u800c\u4e0d\u662f\u8fdb\u7a0b\u81ea\u5df1\u9010\u5b57\u8282\u5199\u4e00\u904d\u2014\u2014\u5199 64MB \u5373\u4f7f\u5e26\u5bbd\u62c9\u6ee1\u4e5f\u8981\u6beb\u79d2\u7ea7&#xff0c;\u6309\u9700\u96f6\u9875\u5219\u53ea\u5728\u771f\u6b63\u88ab\u8bbf\u95ee\u7684\u9875\u4e0a\u4ed8\u51fa\u6210\u672c\u3002<\/p>\n<p>\u6536\u76ca\u4e0e\u9002\u7528\u7ed1\u5b9a\u5728\u6bb5\u7684\u5c3a\u5bf8\u4e0a&#xff1a;Server \u6a21\u5f0f\u5927\u6bb5\u6269\u5f20\u65f6\u6700\u660e\u663e&#xff0c;Workstation \u5c0f\u6bb5\u51e0\u4e4e\u65e0\u611f\u3002\u5c40\u9650\u6709\u4e24\u6761&#xff0c;\u90fd\u4e0e\u5e73\u53f0\u7ed1\u5b9a&#xff1a;\u8fd9\u662f Linux \u8def\u5f84\u7684\u884c\u4e3a&#xff0c;Windows \u4e0a\u5bf9\u5e94\u7684\u662f\u865a\u62df\u5185\u5b58\u7ba1\u7406\u5668\u81ea\u8eab\u7684\u96f6\u9875\u8bed\u4e49&#xff0c;\u4e0d\u9700\u8981\u4e5f\u6ca1\u6cd5\u7528\u540c\u4e00\u62db&#xff1b;\u53e6\u5916\u5b83\u4f18\u5316\u7684\u662f&#034;\u63d0\u4ea4\u8fd9\u4e00\u4e0b&#034;&#xff0c;\u6bb5\u63d0\u4ea4\u540e\u4ecd\u7136\u8981\u89e6\u9875&#xff0c;\u540e\u9762\u8ddf\u7740\u7684\u8fd8\u662f\u7b2c\u4e94\u8282\u3001\u7b2c\u56db\u8282\u90a3\u4e9b\u5185\u5b58\u8bbf\u95ee\u95ee\u9898\u3002\u6bb5\u63d0\u4ea4\u7701\u4e0b\u7684\u6beb\u79d2\u6570&#xff0c;\u8981\u653e\u56de&#034;\u6bb5\u6269\u5f20\u9891\u7387&#034;\u91cc\u624d\u7b97\u5f97\u6e05\u8d26\u2014\u2014\u6269\u5f20\u4e0d\u9891\u7e41\u7684\u670d\u52a1&#xff0c;\u8fd9\u9879\u6536\u76ca\u5929\u7136\u8d8b\u8fd1\u4e8e\u96f6\u3002<\/p>\n<h3 id=\"\u5341\u4e00-\u91cf\u5316\u6570\u636e\u7d2f\u79ef\u6548\u5e94\u4e0e\u53e3\u5f84\u58f0\u660e\">\u5341\u4e00\u3001\u91cf\u5316\u6570\u636e&#xff1a;\u7d2f\u79ef\u6548\u5e94\u4e0e\u53e3\u5f84\u58f0\u660e<\/h3>\n<p>\u539f\u7a3f\u7684\u6838\u5fc3\u91cf\u5316\u7ed3\u8bba\u5728\u8fd9\u91cc\u4fdd\u7559&#xff0c;\u5e76\u628a\u53e3\u5f84\u4e00\u6b21\u8bf4\u900f&#xff1a;\u6bcf\u9879\u5fae\u4f18\u5316\u5355\u72ec\u63d0\u5347 1-5%&#xff0c;\u4f46\u7d2f\u79ef\u4ea7\u751f\u8d28\u53d8\u3002\u4ee5 .NET 8 Web API&#xff08;16 \u6838 64GB&#xff09;\u4e3a\u4f8b\u7684\u6c47\u603b\u6570\u636e\u5982\u4e0b&#xff1a;<\/p>\n<table>\n<tr>\u4f18\u5316\u6280\u672fGC \u6682\u505c\u964d\u4f4e\u4e3b\u5bfc\u673a\u7406\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\u5927\u9875\u9762&#xff08;2MB&#xff09;<\/td>\n<td>-22%<\/td>\n<td>TLB miss \u663e\u8457\u51cf\u5c11<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u968f\u5806\u5927\u5c0f\u4e0e\u786c\u4ef6 TLB \u89c4\u683c\u53d8\u5316<\/td>\n<\/tr>\n<tr>\n<td>CPU \u4eb2\u548c\u7ed1\u6838<\/td>\n<td>-15%<\/td>\n<td>\u7f13\u5b58\u547d\u4e2d\u7387\u63d0\u5347\u3001\u8de8\u6838\u8fc1\u79fb\u6d88\u5931<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u968f\u4e1a\u52a1\u6838\u6324\u5360\u7a0b\u5ea6\u53d8\u5316<\/td>\n<\/tr>\n<tr>\n<td>\u6bb5\u9884\u6620\u5c04<\/td>\n<td>-8%<\/td>\n<td>\u7cfb\u7edf\u8c03\u7528\u6d88\u9664<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u4e0e\u6bb5\u6269\u5f20\u9891\u7387\u5f3a\u76f8\u5173<\/td>\n<\/tr>\n<tr>\n<td>\u7ec4\u5408\u5168\u90e8<\/td>\n<td>-35%<\/td>\n<td>\u7d2f\u79ef\u6548\u5e94<\/td>\n<td>\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u975e\u5b9e\u6d4b\u5e38\u6570&#xff1b;\u5355\u9879\u4e4b\u548c\u5927\u4e8e\u7ec4\u5408\u503c&#xff0c;\u56e0\u4e3a\u6536\u76ca\u4e92\u76f8\u91cd\u53e0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5fc5\u987b\u5199\u5728\u8868\u683c\u65c1\u8fb9\u7684\u4e09\u6761\u53e3\u5f84\u3002\u7b2c\u4e00&#xff0c;\u8fd9\u4e9b\u767e\u5206\u6bd4\u5168\u90e8\u662f\u539f\u7a3f\u7ed9\u51fa\u7684\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u4e0d\u662f\u53ef\u590d\u73b0\u7684\u5b9e\u6d4b\u57fa\u51c6&#xff0c;\u672c\u6587\u672a\u5bf9\u8be5\u6570\u636e\u505a\u4efb\u4f55\u5b9e\u6d4b\u9a8c\u8bc1&#xff0c;\u5f15\u7528\u65f6\u8bf7\u6807\u6ce8\u53e3\u5f84\u6216\u6362\u6210\u81ea\u5df1\u7684 A\/B \u6570\u636e\u3002\u7b2c\u4e8c&#xff0c;\u7ec4\u5408\u503c&#xff08;-35%&#xff09;\u5c0f\u4e8e\u5355\u9879\u76f8\u52a0&#xff08;-45%&#xff09;&#xff0c;\u8fd9\u6b63\u662f\u7f13\u5b58\u3001TLB\u3001\u7cfb\u7edf\u8c03\u7528\u4e09\u7c7b\u6536\u76ca\u4e92\u76f8\u8986\u76d6\u7684\u7ed3\u679c\u2014\u2014\u628a\u6bcf\u9879\u4f18\u5316\u7684\u6536\u76ca\u7b80\u5355\u76f8\u52a0\u662f\u6027\u80fd\u8bc4\u4f30\u91cc\u6700\u5e38\u89c1\u7684\u9519\u8bef\u3002\u7b2c\u4e09&#xff0c;\u57fa\u51c6\u662f&#034;GC \u6682\u505c\u964d\u4f4e&#034;&#xff0c;\u4e0d\u662f\u541e\u5410\u63d0\u5347&#xff0c;\u4e5f\u4e0d\u662f\u7aef\u5230\u7aef\u5ef6\u8fdf\u6309\u540c\u6bd4\u4f8b\u4e0b\u964d&#xff1a;\u6682\u505c\u53ea\u5360\u670d\u52a1\u603b\u5ef6\u8fdf\u7684\u4e00\u90e8\u5206&#xff0c;Amdahl \u5b9a\u5f8b\u5728\u8fd9\u91cc\u540c\u6837\u6210\u7acb\u3002<\/p>\n<p>\u5982\u679c\u8981\u628a\u8fd9\u5957\u53e3\u5f84\u843d\u6210\u81ea\u5df1\u7684\u6d41\u7a0b&#xff0c;\u52a8\u4f5c\u662f\u56fa\u5b9a\u7684&#xff1a;\u540c\u4e00\u573a\u666f\u3001\u540c\u4e00\u5806\u89c4\u6a21\u3001\u540c\u4e00\u914d\u7f6e\u57fa\u7ebf&#xff0c;\u6bcf\u6b21\u53ea\u6539\u4e00\u4e2a\u4f18\u5316\u5f00\u5173&#xff0c;\u8dd1\u56fa\u5b9a\u65f6\u957f\u91c7\u96c6 GC \u4e8b\u4ef6\u6d41&#xff0c;\u6bd4\u8f83\u5355\u6b21\u6682\u505c\u5206\u4f4d\u6570\u4e0e background\/blocking \u6784\u6210&#xff1b;\u5168\u90e8\u6539\u5b8c\u518d\u5408\u8dd1\u4e00\u6b21\u9a8c\u8bc1\u7ec4\u5408\u6548\u679c\u3002\u6ca1\u6709\u8fd9\u6761\u6d41\u6c34\u7ebf&#xff0c;\u8868\u91cc\u7684\u6570\u5b57\u5bf9\u4f60\u7684\u670d\u52a1\u5c31\u53ea\u662f\u53c2\u8003\u7cfb\u3002<\/p>\n<h3 id=\"\u5341\u4e8c-\u4e0e\u5176\u4ed6\u8fd0\u884c\u65f6\u7684\u4f18\u5316\u5bf9\u6bd4\">\u5341\u4e8c\u3001\u4e0e\u5176\u4ed6\u8fd0\u884c\u65f6\u7684\u4f18\u5316\u5bf9\u6bd4<\/h3>\n<p>\u540c\u6837\u7684\u95ee\u9898&#xff0c;\u4e0d\u540c\u8fd0\u884c\u65f6\u7ed9\u7684\u7b54\u6848\u4e0d\u4e00\u6837&#xff0c;\u653e\u5728\u4e00\u8d77\u624d\u770b\u5f97\u6e05 .NET \u8fd9\u5957\u7684\u53d6\u5411&#xff1a;<\/p>\n<table>\n<tr>\u4f18\u5316\u65b9\u5411.NET Core GCJava&#xff08;G1 \/ ZGC \u4e00\u7c7b&#xff09;GoUnity&#xff08;Boehm \u589e\u91cf&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u5ef6\u8fdf\u6cbb\u7406\u4e3b\u7ebf<\/td>\n<td>\u540e\u53f0\u5e76\u53d1\u6807\u8bb0 &#043; \u77ed STW \u5207\u7247<\/td>\n<td>\u5206\u533a\u56de\u6536 \/ \u5e76\u53d1\u6807\u8bb0\u4e0e\u8f6c\u79fb<\/td>\n<td>\u5e76\u53d1\u4e09\u8272\u6807\u8bb0 &#043; \u5199\u5c4f\u969c<\/td>\n<td>\u65f6\u95f4\u5206\u7247\u6807\u8bb0&#xff08;\u8de8\u5e27&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u6bb5\u4e0e\u5185\u5b58\u63a5\u53e3<\/td>\n<td>\u6bb5\u4e24\u9636\u6bb5\u63d0\u4ea4\u3001\u9884\u6620\u5c04\u3001\u96f6\u62f7\u8d1d\u63d0\u4ea4<\/td>\n<td>\u5806\u5206\u533a &#043; \u5185\u5b58\u6c60\u5316&#xff0c;\u5927\u9875\u6309 JVM \u53c2\u6570\u5f00<\/td>\n<td>mspan\/span \u7ba1\u7406&#xff0c;\u5927\u9875\u652f\u6301\u6709\u9650<\/td>\n<td>\u4fdd\u5b88\u5f0f\u7a7a\u95f2\u94fe\u8868&#xff0c;\u9875\u7c92\u5ea6\u810f\u4f4d<\/td>\n<\/tr>\n<tr>\n<td>\u62d3\u6251\u611f\u77e5<\/td>\n<td>\u591a\u5806 &#043; \u7ed1\u6838\u63a9\u7801 &#043; NUMA \u672c\u5730\u5206\u914d<\/td>\n<td>GC \u7ebf\u7a0b\u6570\u4e0e NUMA \u4eb2\u548c\u53ef\u914d<\/td>\n<td>P \u5f62\u5f0f GOMAXPROCS&#xff0c;\u65e0\u72ec\u7acb GC \u5806\u62d3\u6251<\/td>\n<td>\u65e0\u591a\u5806\u6982\u5ff5<\/td>\n<\/tr>\n<tr>\n<td>\u5206\u914d\u5feb\u8def\u5f84<\/td>\n<td>\u7ebf\u7a0b\u5206\u914d\u4e0a\u4e0b\u6587&#xff08;\u65e0\u9501 bump&#xff09;<\/td>\n<td>TLAB&#xff08;\u540c\u7c7b\u8bbe\u8ba1&#xff09;<\/td>\n<td>mcache &#043; mcentral \u5206\u7ea7<\/td>\n<td>\u6309\u5c3a\u5bf8\u627e\u7a7a\u95f2\u5757<\/td>\n<\/tr>\n<tr>\n<td>\u5927\u5bf9\u8c61<\/td>\n<td>LOH \u72ec\u7acb\u5806 &#043; POH \u56fa\u5b9a\u5806<\/td>\n<td>\u5927\u5bf9\u8c61\u533a\u72ec\u7acb\u7ba1\u7406<\/td>\n<td>\u76f4\u63a5\u5927 span&#xff0c;\u65e0\u5206\u4ee3\u664b\u5347<\/td>\n<td>\u65e0\u72ec\u7acb\u5806&#xff0c;\u540c\u8d70\u7a7a\u95f2\u94fe\u8868<\/td>\n<\/tr>\n<tr>\n<td>\u914d\u7f6e\u9762<\/td>\n<td>runtimeconfig \/ \u73af\u5883\u53d8\u91cf\u6210\u4f53\u7cfb<\/td>\n<td>-XX:\u00a0\u7cfb\u5217\u53c2\u6570\u6700\u5168<\/td>\n<td>\u51e0\u4e4e\u5168\u81ea\u52a8&#xff0c;\u65cb\u94ae\u5c11<\/td>\n<td>GC_enable_incremental\u00a0\u4e00\u65cf\u63a5\u53e3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e09\u5217\u7ed3\u8bba\u3002\u7b2c\u4e00&#xff0c;&#034;\u7ebf\u7a0b\u672c\u5730\u5206\u914d\u7a97\u53e3&#034;\u5df2\u662f\u73b0\u4ee3 GC \u7684\u6807\u914d&#xff08;.NET \u7684\u5206\u914d\u4e0a\u4e0b\u6587\u4e0e Java \u7684 TLAB \u662f\u540c\u4e00\u7c7b\u8bbe\u8ba1&#xff09;&#xff0c;\u771f\u6b63\u7684\u5206\u6c34\u5cad\u5728\u62d3\u6251\u611f\u77e5\u4e0e\u5185\u5b58\u63a5\u53e3\u5c42\u2014\u2014.NET \u628a\u7ed1\u6838\u63a9\u7801\u3001NUMA\u3001\u6bb5\u9884\u6620\u5c04\u505a\u6210\u4e00\u7b49\u914d\u7f6e&#xff0c;\u662f\u5b83\u5728\u5927\u5806\u591a\u6838\u573a\u666f\u4e0b\u6389\u961f\u66f4\u5c11\u7684\u539f\u56e0\u3002\u7b2c\u4e8c&#xff0c;Java \u751f\u6001\u7684\u65cb\u94ae\u6700\u591a\u3001\u53ef\u8c03\u7a7a\u95f4\u6700\u5927&#xff0c;\u4ee3\u4ef7\u662f\u8c03\u4f18\u77e5\u8bc6\u8d1f\u62c5\u4e5f\u6700\u91cd&#xff1b;.NET \u9009\u62e9\u7684\u662f&#034;\u81ea\u52a8\u8def\u5f84\u505a\u5bf9 &#043; \u5c11\u91cf\u5173\u952e\u5f00\u5173&#034;&#xff0c;\u8fd9\u4e0e\u7b2c\u4e03\u8282\u9884\u7b97\u81ea\u9002\u5e94\u7684\u8bbe\u8ba1\u53d6\u5411\u4e00\u81f4\u3002\u7b2c\u4e09&#xff0c;Go \u6362\u4e86\u4e00\u6761\u5f7b\u5e95\u7684\u8def&#xff1a;\u4e0d\u5206\u4ee3\u3001\u4e0d\u538b\u7f29&#xff0c;\u628a\u590d\u6742\u5ea6\u538b\u5230\u8fd0\u884c\u65f6\u6700\u5c0f&#xff0c;\u4ee3\u4ef7\u662f\u5806\u66f4\u5927\u3001\u56de\u6536\u66f4\u4f9d\u8d56\u5e76\u53d1\u2014\u2014\u6ca1\u6709\u54ea\u6761\u8def\u514d\u8d39&#xff0c;\u90fd\u662f\u628a\u6210\u672c\u632a\u5230\u522b\u5904\u3002<\/p>\n<p>\u5bf9\u7167\u56de\u672c\u4e13\u680f&#xff1a;Unity \u7684 Boehm \u589e\u91cf\u65b9\u6848\u5904\u5728\u8868\u683c\u6700\u53f3&#xff0c;\u5b83\u7684\u4f18\u5316\u7a7a\u95f4\u88ab&#034;\u4fdd\u5b88\u5f0f &#043; \u4e0d\u5206\u4ee3 &#043; \u4e0d\u79fb\u52a8&#034;\u4e09\u91cd\u9501\u6b7b&#xff0c;\u8fd9\u6b63\u662f Unity 6 \u5f15\u5165 CoreCLR \u540e\u7aef\u540e\u8bc4\u4f30\u5bf9\u8c61\u4f1a\u6574\u4f53\u5207\u6362\u7684\u5e95\u5c42\u539f\u56e0&#xff08;\u80cc\u666f\u89c1 03-04 \u7b2c\u516b\u8282&#xff09;\u3002<\/p>\n<h3 id=\"\u5341\u4e09-\u51b3\u7b56\u6e05\u5355\u4e0e\u5e38\u89c1\u8bef\u533a\">\u5341\u4e09\u3001\u51b3\u7b56\u6e05\u5355\u4e0e\u5e38\u89c1\u8bef\u533a<\/h3>\n<h4 id=\"131-\u4f18\u5316\u70b9\u51b3\u7b56\u8868\u539f\u7406--\u6536\u76ca--\u9002\u7528--\u5c40\u9650\">13.1 \u4f18\u5316\u70b9\u51b3\u7b56\u8868&#xff08;\u539f\u7406 \u2192 \u6536\u76ca \u2192 \u9002\u7528 \u2192 \u5c40\u9650&#xff09;<\/h4>\n<table>\n<tr>\u4f18\u5316\u70b9\u539f\u7406\u4e00\u53e5\u8bdd\u6536\u76ca&#xff08;\u53e3\u5f84&#xff09;\u9002\u7528\u573a\u666f\u5c40\u9650<\/tr>\n<tbody>\n<tr>\n<td>\u6bb5\u9884\u63d0\u4ea4\/\u9884\u6620\u5c04<\/td>\n<td>\u4e00\u6b21\u6027\u9884\u7559\u5730\u5740\u4e0e\u6620\u5c04&#xff0c;\u70ed\u8def\u5f84\u4e0d\u518d\u8fdb\u5185\u6838<\/td>\n<td>\u6682\u505c -8% \u91cf\u7ea7&#xff08;\u793a\u4f8b&#xff09;<\/td>\n<td>\u6bb5\u6269\u5f20\u9891\u7e41\u7684\u5927\u5806\u670d\u52a1<\/td>\n<td>\u767d\u5360\u5730\u5740\u7a7a\u95f4&#xff1b;\u5224\u65ad\u5931\u51c6\u4ecd\u56de\u9000\u6309\u9700<\/td>\n<\/tr>\n<tr>\n<td>\u5927\u9875 2MB<\/td>\n<td>\u9875\u8868\u9879\u51cf\u5c11&#xff0c;TLB \u8986\u76d6\u6269\u5927<\/td>\n<td>\u8bbf\u5b58\u6548\u7387\u7ea6 &#043;30% \u91cf\u7ea7&#xff08;\u793a\u4f8b&#xff09;<\/td>\n<td>GB \u7ea7\u5927\u5806\u3001\u7269\u7406\u673a\u3001\u5ef6\u8fdf\u654f\u611f<\/td>\n<td>\u9700\u7279\u6743\u4e0e\u9884\u7559\u6c60&#xff1b;\u5185\u5b58\u7d27\u65f6\u788e\u7247\u66f4\u786c<\/td>\n<\/tr>\n<tr>\n<td>NUMA \u672c\u5730\u5206\u914d<\/td>\n<td>\u6bb5\u843d\u5728\u5bf9\u5e94 CPU \u7684\u672c\u5730\u5185\u5b58<\/td>\n<td>\u8fdc\u7aef\u8bbf\u5b58 2-3 \u500d\u5dee\u8ddd\u8f6c\u4e3a\u672c\u5730&#xff08;\u5178\u578b\u4f30\u7b97&#xff09;<\/td>\n<td>\u591a\u8def\u670d\u52a1\u5668\u300164 \u6838\u4ee5\u4e0a<\/td>\n<td>\u62d3\u6251\u8bc6\u522b\u9519\u8bef\u53cd\u800c\u8de8\u63d2\u69fd<\/td>\n<\/tr>\n<tr>\n<td>CPU \u5206\u7ec4\u4eb2\u548c\/\u7ed1\u6838<\/td>\n<td>GC \u7ebf\u7a0b\u9489\u5728\u6307\u5b9a\u6838&#xff0c;\u63a9\u7801\u6309\u7ec4\u5c55\u5f00<\/td>\n<td>\u6682\u505c -15% \u91cf\u7ea7&#xff08;\u793a\u4f8b&#xff09;<\/td>\n<td>Server GC \u5e38\u9a7b\u591a\u6838\u670d\u52a1<\/td>\n<td>\u4e0e\u4e1a\u52a1\u62a2\u6838&#xff1b;\u5bb9\u5668\u5185\u8fc1\u79fb\u5931\u6548<\/td>\n<\/tr>\n<tr>\n<td>\u591a\u5806\u4e0e\u5206\u914d\u7a97\u53e3<\/td>\n<td>\u6bcf\u6838\u4e00\u5806 &#043; \u7ebf\u7a0b\u65e0\u9501 bump \u5206\u914d<\/td>\n<td>\u5206\u914d\u541e\u5410\u7ebf\u6027\u6269\u5c55&#xff08;&gt;99.9% \u65e0\u9501&#xff0c;\u793a\u4f8b&#xff09;<\/td>\n<td>\u6240\u6709\u591a\u6838\u5206\u914d\u5bc6\u96c6\u670d\u52a1<\/td>\n<td>LOH \u4e3b\u5bfc\u8d1f\u8f7d\u6536\u76ca\u9aa4\u51cf<\/td>\n<\/tr>\n<tr>\n<td>GC \u611f\u77e5\u5206\u914d<\/td>\n<td>\u5206\u914d\u5165\u53e3\u6309 GC \u72b6\u6001\u8d70\u5b89\u5168\u8def\u5f84<\/td>\n<td>\u907f\u514d\u4e0e GC \u4e92\u8e29&#xff0c;\u9632\u6b7b\u9501\u4e0e\u91cd\u590d\u89e6\u53d1<\/td>\n<td>\u5168\u5c40\u57fa\u7840\u673a\u5236&#xff0c;\u65e0\u9009\u62e9\u5fc5\u8981<\/td>\n<td>GC \u671f\u95f4\u6162\u8def\u5f84\u53d8\u6162<\/td>\n<\/tr>\n<tr>\n<td>Gen0 \u9884\u7b97\u81ea\u9002\u5e94<\/td>\n<td>\u6309\u5b58\u6d3b\u7387\u56de\u5199\u4e0b\u6b21\u9884\u7b97<\/td>\n<td>\u56de\u6536\u9891\u7387\u81ea\u52a8\u5339\u914d\u5206\u914d\u901f\u7387<\/td>\n<td>\u8d1f\u8f7d\u5468\u671f\u6027\u53d8\u5316\u7684\u670d\u52a1<\/td>\n<td>\u7a81\u53d8\u671f\u9700 1-2 \u8f6e\u8ddf\u4e0a&#xff1b;\u4e0d\u8986\u76d6 LOH<\/td>\n<\/tr>\n<tr>\n<td>PerfView\/GC \u65e5\u5fd7<\/td>\n<td>\u4e8b\u4ef6\u6d41\u53ef\u89c6\u5316\u4e0e\u524d\u540e\u5bf9\u6bd4<\/td>\n<td>\u914d\u7f6e\u7c7b\u4f18\u5316\u7684\u9a8c\u6536\u624b\u6bb5<\/td>\n<td>\u5168\u90e8\u573a\u666f<\/td>\n<td>\u9700\u8981\u91c7\u6837\u4e0e\u5206\u6790\u7684\u6280\u80fd\u6210\u672c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"132-\u5e38\u89c1\u8bef\u533a\">13.2 \u5e38\u89c1\u8bef\u533a<\/h4>\n<p>\u8bef\u533a\u4e00&#xff1a;\u628a\u8868\u91cc\u7684\u767e\u5206\u6bd4\u5f53\u81ea\u5df1\u7684\u9884\u671f\u6536\u76ca\u3002\u00a0\u9519\u8bef\u505a\u6cd5\u662f\u62ff -22%\u3001-35% \u76f4\u63a5\u5199\u8fdb\u6027\u80fd\u62a5\u544a\u3002\u4e3a\u4ec0\u4e48\u9519&#xff1a;\u90a3\u662f\u7279\u5b9a\u786c\u4ef6\u4e0e\u8d1f\u8f7d\u4e0b\u7684\u793a\u4f8b\u91cf\u7ea7&#xff0c;\u6362\u4e00\u5806\u3001\u6362\u8d1f\u8f7d\u3001\u6362\u7248\u672c\u90fd\u4f1a\u53d8&#xff0c;\u4e14\u6536\u76ca\u4e92\u76f8\u91cd\u53e0\u3002\u6b63\u786e\u505a\u6cd5\u662f\u628a\u5b83\u4eec\u5f53&#034;\u503c\u5f97\u6d4b\u7684\u4f18\u5148\u7ea7\u6392\u5e8f&#034;\u2014\u2014\u5148\u6d4b\u5927\u9875\u548c\u7ed1\u6838\u8fd9\u4e24\u9879\u91cf\u7ea7\u5927\u7684&#xff0c;\u518d\u770b\u9884\u6620\u5c04&#xff1b;\u6bcf\u9879\u7528\u81ea\u5df1\u7684 A\/B \u6570\u636e\u8bf4\u8bdd&#xff0c;\u62a5\u544a\u91cc\u5199\u660e\u6d4b\u8bd5\u53e3\u5f84\u3002<\/p>\n<p>\u8bef\u533a\u4e8c&#xff1a;\u6240\u6709\u4f18\u5316\u65e0\u8111\u5168\u5f00\u3002\u00a0\u9519\u8bef\u505a\u6cd5\u662f\u5728 2 \u6838\u5bb9\u5668\u91cc\u5f00 Server GC\u3001\u914d\u7ed1\u6838\u63a9\u7801\u3001\u9884\u7559\u5927\u9875\u3002\u4e3a\u4ec0\u4e48\u9519&#xff1a;\u6bcf\u9879\u4f18\u5316\u90fd\u6709\u524d\u7f6e\u6761\u4ef6&#xff0c;\u7ed1\u6838\u5728\u4f1a\u8fc1\u79fb\u7684\u5bb9\u5668\u91cc\u5236\u9020\u7b49\u5f85&#xff0c;\u5927\u9875\u5728\u5185\u5b58\u7d27\u5f20\u65f6\u653e\u5927\u788e\u7247&#xff0c;\u5806\u6570\u4e0d\u5bf9\u8ba9\u591a\u5806\u53d8\u7eaf\u8d1f\u62c5\u3002\u6b63\u786e\u505a\u6cd5\u662f\u6309\u51b3\u7b56\u8868\u7684&#034;\u9002\u7528\u573a\u666f&#034;\u5217\u9010\u6761\u6838\u5bf9&#xff0c;\u4e0d\u6ee1\u8db3\u524d\u7f6e\u6761\u4ef6\u7684\u9879\u76f4\u63a5\u8df3\u8fc7\u2014\u2014\u4e0d\u9002\u7528\u7684\u4f18\u5316\u4e0d\u662f\u6536\u76ca\u4e3a\u96f6&#xff0c;\u5f80\u5f80\u662f\u8d1f\u6536\u76ca\u3002<\/p>\n<p>\u8bef\u533a\u4e09&#xff1a;\u76ef\u7740\u6682\u505c\u4f18\u5316&#xff0c;\u5fd8\u4e86\u6682\u505c\u4e3a\u4ec0\u4e48\u957f\u3002\u00a0\u9519\u8bef\u505a\u6cd5\u662f\u5927\u9875\u3001\u7ed1\u6838\u5168\u90e8\u5230\u4f4d&#xff0c;\u6682\u505c\u8fd8\u662f\u6ca1\u964d&#xff0c;\u4e8e\u662f\u7ee7\u7eed\u52a0\u53c2\u6570\u3002\u4e3a\u4ec0\u4e48\u9519&#xff1a;\u6682\u505c\u957f\u7684\u9996\u8981\u539f\u56e0\u901a\u5e38\u662f\u5206\u914d\u901f\u7387\u4e0e\u5806\u89c4\u6a21&#xff08;\u9884\u7b97\u88ab\u6253\u7a7f\u3001\u540e\u53f0\u6807\u8bb0\u88ab\u538b\u57ae&#xff0c;\u89c1 07-05 \u7b2c\u516d\u8282&#xff09;&#xff0c;\u5185\u5b58\u5c42\u7684\u5fae\u4f18\u5316\u644a\u4e0d\u52a8\u8fd9\u90e8\u5206\u3002\u6b63\u786e\u505a\u6cd5\u662f\u5148\u7528 GC \u4e8b\u4ef6\u786e\u8ba4\u65f6\u95f4\u82b1\u5728\u54ea\u4e00\u4ee3\u3001\u54ea\u4e2a\u9636\u6bb5&#xff0c;\u7ed3\u6784\u6027\u95ee\u9898&#xff08;\u5206\u914d\u8fc7\u591a\u3001\u788e\u7247\u3001\u9000\u5316&#xff09;\u4f18\u5148\u4e8e\u5fae\u4f18\u5316\u3002<\/p>\n<p>\u8bef\u533a\u56db&#xff1a;\u914d\u7f6e\u6539\u5b8c\u5c31\u7b97\u4f18\u5316\u5b8c\u6210\u3002\u00a0\u9519\u8bef\u505a\u6cd5\u662f\u6539\u4e86 runtimeconfig \u5c31\u5ba3\u5e03\u6536\u76ca\u5165\u8d26\u3002\u4e3a\u4ec0\u4e48\u9519&#xff1a;\u914d\u7f6e\u952e\u62fc\u9519\u3001\u73af\u5883\u53d8\u91cf\u6ca1\u8fdb\u5bb9\u5668\u3001\u8fdb\u7a0b\u8dd1\u5728\u522b\u7684\u6a21\u5f0f\u4e0a&#xff0c;\u90fd\u4f1a\u8ba9\u6539\u52a8\u9759\u9ed8\u5931\u6548\u3002\u6b63\u786e\u505a\u6cd5\u662f\u7b2c\u4e5d\u8282\u7684\u95ed\u73af&#xff1a;\u542f\u52a8\u65e5\u5fd7\u6253\u5370\u751f\u6548\u914d\u7f6e&#xff0c;\u6539\u4e00\u9879\u8dd1\u4e00\u8f6e\u540c\u573a\u666f\u4e8b\u4ef6\u5bf9\u6bd4&#xff0c;\u7cfb\u7edf\u4fa7\u786e\u8ba4\u5927\u9875\u4e0e\u7ed1\u6838\u771f\u7684\u843d\u4e0a\u3002<\/p>\n<h3 id=\"\u672c\u7ae0\u603b\u7ed3\">\u672c\u7ae0\u603b\u7ed3<\/h3>\n<li>.NET Core GC \u7684\u6027\u80fd\u5e95\u5ea7\u662f\u4e94\u5c42\u4f18\u5316&#xff1a;\u5185\u5b58\u4e0e OS \u63a5\u53e3\u3001\u62d3\u6251\u611f\u77e5\u3001\u5206\u914d\u5e76\u53d1\u5316\u3001\u9884\u7b97\u81ea\u9002\u5e94\u3001\u53ef\u89c2\u6d4b\u914d\u7f6e\u2014\u2014\u5c42\u4e0e\u5c42\u6709\u4f9d\u8d56&#xff0c;\u8bfb\u5355\u70b9\u5fc5\u987b\u5e26\u4e0a\u4e0b\u6587\u3002<\/li>\n<li>\u6bb5\u9884\u6620\u5c04\u7701\u7cfb\u7edf\u8c03\u7528\u3001\u5927\u9875\u7701 TLB\u3001NUMA \u4e0e\u7ed1\u6838\u7701\u8de8\u63d2\u69fd\u8bbf\u5b58&#xff0c;\u4e09\u8005\u90fd\u4f5c\u7528\u5728&#034;\u6bcf\u6b21\u89e6\u9875&#034;\u4e0a&#xff0c;\u5bf9\u5927\u5806\u4e0e\u591a\u6838\u573a\u666f\u6536\u76ca\u6700\u5927&#xff0c;\u5bf9\u5c0f\u5806\u51e0\u4e4e\u65e0\u611f\u3002<\/li>\n<li>\u5206\u914d\u7a97\u53e3\u4e0e\u591a\u7ea7\u7f13\u5b58\u8ba9 99% \u4ee5\u4e0a\u5206\u914d\u65e0\u9501\u5b8c\u6210&#xff08;\u793a\u4f8b\u53e3\u5f84&#xff09;&#xff0c;\u8fd9\u662f Server GC \u6269\u5c55\u6027\u7684\u524d\u63d0&#xff1b;Gen0 \u9884\u7b97\u6309\u5b58\u6d3b\u7387\u81ea\u9002\u5e94&#xff0c;\u8ba9\u56de\u6536\u9891\u7387\u81ea\u52a8\u8ddf\u7740\u5206\u914d\u901f\u7387\u8d70\u3002<\/li>\n<li>\u6240\u6709\u767e\u5206\u6bd4\u90fd\u662f\u793a\u4f8b\u91cf\u7ea7\u3001\u975e\u5b9e\u6d4b\u5e38\u6570&#xff1b;\u7ec4\u5408\u6536\u76ca\u5c0f\u4e8e\u5355\u9879\u76f8\u52a0&#xff0c;\u8bc4\u4f30\u5fc5\u987b\u5355\u53d8\u91cf A\/B&#xff0c;\u62a5\u544a\u5fc5\u987b\u5199\u53e3\u5f84\u3002<\/li>\n<li>\u4f18\u5316\u7684\u9a8c\u6536\u9760\u4e8b\u4ef6\u6d41\u4e0e\u7cfb\u7edf\u4fa7\u786e\u8ba4&#xff1a;GC \u65e5\u5fd7\u5b9a\u6027\u3001PerfView \u5b9a\u91cf\u3001\u64cd\u4f5c\u7cfb\u7edf\u89c6\u56fe\u9a8c\u8bc1\u5927\u9875\u4e0e\u7ed1\u6838&#xff0c;\u4e09\u4ef6\u7f3a\u4e00\u4ef6\u5c31\u53ef\u80fd\u628a&#034;\u6ca1\u751f\u6548&#034;\u5f53\u6210&#034;\u6ca1\u6536\u76ca&#034;\u3002<\/li>\n<li>\u987a\u5e8f\u4e0d\u80fd\u53cd&#xff1a;\u5148\u6cbb\u5206\u914d\u901f\u7387\u4e0e\u5806\u7ed3\u6784\u8fd9\u7c7b\u7ed3\u6784\u6027\u95ee\u9898&#xff0c;\u518d\u4e0a\u5185\u5b58\u5c42\u5fae\u4f18\u5316\u2014\u2014\u5730\u57fa\u4e0d\u7a33&#xff0c;\u53c2\u6570\u5806\u4e0d\u51fa\u6027\u80fd\u3002<\/li>\n<p>\u4e00\u53e5\u8bdd\u8bb0\u5fc6\u70b9&#xff1a;\u7b97\u6cd5\u51b3\u5b9a GC \u7684\u4e0b\u9650&#xff0c;\u8fd9\u4e9b\u8d34\u7740\u786c\u4ef6\u7684\u5fae\u4f18\u5316\u51b3\u5b9a\u5b83\u7684\u4e0a\u9650\u2014\u2014\u800c\u4e0a\u9650\u5151\u73b0\u591a\u5c11&#xff0c;\u53d6\u51b3\u4e8e\u4f60\u6709\u6ca1\u6709\u7528\u540c\u4e00\u5957\u4e8b\u4ef6\u6d41\u8bc1\u660e\u6bcf\u4e00\u9879\u771f\u7684\u751f\u6548\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>.NET Core GC \u7684\u6781\u81f4\u4f18\u5316\u6280\u672f\u7bc7\u7ae0&#xff1a;07-\u6e90\u7801\u6df1\u5ea6-.NET Core GC |\u00a0\u9605\u8bfb\u65f6\u95f4&#xff1a;\u7ea6 40 \u5206\u949f\u4e00\u3001\u5f15\u8a00.NET Core GC \u7684\u6781\u81f4\u6027\u80fd\u4e0d\u4ec5\u6765\u81ea\u9ad8\u7ea7\u7b97\u6cd5&#xff0c;\u8fd8\u6765\u81ea\u5927\u91cf\u5e95\u5c42\u7684\u5fae\u4f18\u5316\u6280\u672f\u3002\u6bcf\u9879\u5fae\u4f18\u5316\u5355\u72ec\u770b\u53ef\u80fd\u53ea\u63d0\u5347 1-5%&#xff0c;\u4f46\u7d2f\u79ef\u8d77\u6765\u4ea7\u751f\u4e86\u5de8\u5927\u7684\u6027\u80fd\u4f18\u52bf\u3002\u8fd9\u53e5\u8bdd\u70b9\u51fa\u4e86\u672c\u6587\u7684\u4e3b\u89d2&#xff1a;\u4e0d\u662f\u5206\u4ee3\u3001\u538b\u7f29\u8fd9\u4e9b\\&#8221;\u8bba\u6587\u7ea7\\&#8221;\u7684\u8bbe\u8ba1&#xff0c;\u800c\u662f\u628a\u865a\u62df\u5185\u5b58\u63a5\u53e3\u3001CPU \u7f13\u5b58\u3001NUMA \u62d3\u6251\u3001\u7ebf\u7a0b\u8c03\u5ea6\u9010<\/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":[893,13178,11236,868,55,183],"topic":[],"class_list":["post-118388","post","type-post","status-publish","format-standard","hentry","category-server","tag-netcore","tag-1024---","tag-gc","tag-868","tag-c","tag-unity"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f - \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\/118388.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\".NET Core GC \u7684\u6781\u81f4\u4f18\u5316\u6280\u672f\u7bc7\u7ae0&#xff1a;07-\u6e90\u7801\u6df1\u5ea6-.NET Core GC |\u00a0\u9605\u8bfb\u65f6\u95f4&#xff1a;\u7ea6 40 \u5206\u949f\u4e00\u3001\u5f15\u8a00.NET Core GC \u7684\u6781\u81f4\u6027\u80fd\u4e0d\u4ec5\u6765\u81ea\u9ad8\u7ea7\u7b97\u6cd5&#xff0c;\u8fd8\u6765\u81ea\u5927\u91cf\u5e95\u5c42\u7684\u5fae\u4f18\u5316\u6280\u672f\u3002\u6bcf\u9879\u5fae\u4f18\u5316\u5355\u72ec\u770b\u53ef\u80fd\u53ea\u63d0\u5347 1-5%&#xff0c;\u4f46\u7d2f\u79ef\u8d77\u6765\u4ea7\u751f\u4e86\u5de8\u5927\u7684\u6027\u80fd\u4f18\u52bf\u3002\u8fd9\u53e5\u8bdd\u70b9\u51fa\u4e86\u672c\u6587\u7684\u4e3b\u89d2&#xff1a;\u4e0d\u662f\u5206\u4ee3\u3001\u538b\u7f29\u8fd9\u4e9b&quot;\u8bba\u6587\u7ea7&quot;\u7684\u8bbe\u8ba1&#xff0c;\u800c\u662f\u628a\u865a\u62df\u5185\u5b58\u63a5\u53e3\u3001CPU \u7f13\u5b58\u3001NUMA \u62d3\u6251\u3001\u7ebf\u7a0b\u8c03\u5ea6\u9010\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/118388.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-26T20:16:28+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\/118388.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/118388.html\",\"name\":\"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-26T20:16:28+00:00\",\"dateModified\":\"2026-10-26T20:16:28+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/118388.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/118388.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/118388.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f\"}]},{\"@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":"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f - \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\/118388.html","og_locale":"zh_CN","og_type":"article","og_title":"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":".NET Core GC \u7684\u6781\u81f4\u4f18\u5316\u6280\u672f\u7bc7\u7ae0&#xff1a;07-\u6e90\u7801\u6df1\u5ea6-.NET Core GC |\u00a0\u9605\u8bfb\u65f6\u95f4&#xff1a;\u7ea6 40 \u5206\u949f\u4e00\u3001\u5f15\u8a00.NET Core GC \u7684\u6781\u81f4\u6027\u80fd\u4e0d\u4ec5\u6765\u81ea\u9ad8\u7ea7\u7b97\u6cd5&#xff0c;\u8fd8\u6765\u81ea\u5927\u91cf\u5e95\u5c42\u7684\u5fae\u4f18\u5316\u6280\u672f\u3002\u6bcf\u9879\u5fae\u4f18\u5316\u5355\u72ec\u770b\u53ef\u80fd\u53ea\u63d0\u5347 1-5%&#xff0c;\u4f46\u7d2f\u79ef\u8d77\u6765\u4ea7\u751f\u4e86\u5de8\u5927\u7684\u6027\u80fd\u4f18\u52bf\u3002\u8fd9\u53e5\u8bdd\u70b9\u51fa\u4e86\u672c\u6587\u7684\u4e3b\u89d2&#xff1a;\u4e0d\u662f\u5206\u4ee3\u3001\u538b\u7f29\u8fd9\u4e9b\"\u8bba\u6587\u7ea7\"\u7684\u8bbe\u8ba1&#xff0c;\u800c\u662f\u628a\u865a\u62df\u5185\u5b58\u63a5\u53e3\u3001CPU \u7f13\u5b58\u3001NUMA \u62d3\u6251\u3001\u7ebf\u7a0b\u8c03\u5ea6\u9010","og_url":"https:\/\/www.wsisp.com\/helps\/118388.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-26T20:16:28+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\/118388.html","url":"https:\/\/www.wsisp.com\/helps\/118388.html","name":"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-26T20:16:28+00:00","dateModified":"2026-10-26T20:16:28+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/118388.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/118388.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/118388.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"07-06-\u6e90\u7801-.NET Core GC\u7684\u6781\u81f4\u4f18\u5316\u6280\u672f"}]},{"@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\/118388","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=118388"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/118388\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=118388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=118388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=118388"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=118388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}