{"id":1279,"date":"2014-11-05T17:25:30","date_gmt":"2014-11-05T09:25:30","guid":{"rendered":"http:\/\/www.strongd.net\/?p=1279"},"modified":"2014-11-05T17:25:30","modified_gmt":"2014-11-05T09:25:30","slug":"mongodb%e7%9a%84numa%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1279","title":{"rendered":"mongodb\u7684NUMA\u95ee\u9898"},"content":{"rendered":"<p>mongodb\u65e5\u5fd7\u663e\u793a\u5982\u4e0b:<\/p>\n<p>WARNING: You are running on a NUMA machine.<\/p>\n<p>We suggest launching mongod like this to avoid performance problems:<\/p>\n<p>numactl \u2013interleave=all mongod [other options]<\/p>\n<p>\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<p>1.\u5728\u539f\u542f\u52a8\u547d\u4ee4\u524d\u9762\u52a0numactl \u2013interleave=all<\/p>\n<p>\u5982# numactl \u2013interleave=all ${MONGODB_HOME}\/bin\/mongod \u2013config conf\/mongodb.conf<\/p>\n<p>2.\u4fee\u6539\u5185\u6838\u53c2\u6570<\/p>\n<p>echo 0 &gt; \/proc\/sys\/vm\/zone_reclaim_mode<\/p>\n<p>http:\/\/www.mongodb.org\/display\/DOCS\/NUMA<\/p>\n<p>\u4e0b\u9762\u6ce8\u91ca\u8f6c\u81ea\u7f51\u7edc<\/p>\n<p>\u4e00\u3001NUMA\u548cSMP<\/p>\n<p>NUMA\u548cSMP\u662f\u4e24\u79cdCPU\u76f8\u5173\u7684\u786c\u4ef6\u67b6\u6784\u3002\u5728SMP\u67b6\u6784\u91cc\u9762\uff0c\u6240\u6709\u7684CPU\u4e89\u7528\u4e00\u4e2a\u603b\u7ebf\u6765\u8bbf\u95ee\u6240\u6709\u5185\u5b58\uff0c\u4f18\u70b9\u662f\u8d44\u6e90\u5171\u4eab\uff0c\u800c\u7f3a\u70b9\u662f\u603b\u7ebf\u4e89\u7528\u6fc0\u70c8\u3002\u968f\u7740PC\u670d\u52a1\u5668\u4e0a\u7684CPU\u6570\u91cf\u53d8\u591a\uff08\u4e0d\u4ec5\u4ec5\u662fCPU\u6838\u6570\uff09\uff0c\u603b\u7ebf\u4e89\u7528\u7684\u5f0a\u7aef\u6162\u6162\u8d8a\u6765\u8d8a\u660e\u663e\uff0c\u4e8e\u662fIntel\u5728Nehalem CPU\u4e0a\u63a8\u51fa\u4e86NUMA\u67b6\u6784\uff0c\u800cAMD\u4e5f\u63a8\u51fa\u4e86\u57fa\u4e8e\u76f8\u540c\u67b6\u6784\u7684Opteron CPU\u3002<\/p>\n<p>NUMA\u6700\u5927\u7684\u7279\u70b9\u662f\u5f15\u5165\u4e86node\u548cdistance\u7684\u6982\u5ff5\u3002\u5bf9\u4e8eCPU\u548c\u5185\u5b58\u8fd9\u4e24\u79cd\u6700\u5b9d\u8d35\u7684\u786c\u4ef6\u8d44\u6e90\uff0cNUMA\u7528\u8fd1\u4e4e\u4e25\u683c\u7684\u65b9\u5f0f\u5212\u5206\u4e86\u6240\u5c5e\u7684\u8d44\u6e90\u7ec4\uff08node\uff09\uff0c\u800c\u6bcf\u4e2a\u8d44\u6e90\u7ec4\u5185\u7684CPU\u548c\u5185\u5b58\u662f\u51e0\u4e4e\u76f8\u7b49\u3002\u8d44\u6e90\u7ec4\u7684\u6570\u91cf\u53d6\u51b3\u4e8e\u7269\u7406CPU\u7684\u4e2a\u6570\uff08\u73b0\u6709\u7684PC server\u5927\u591a\u6570\u6709\u4e24\u4e2a\u7269\u7406CPU\uff0c\u6bcf\u4e2aCPU\u67094\u4e2a\u6838\uff09\uff1bdistance\u8fd9\u4e2a\u6982\u5ff5\u662f\u7528\u6765\u5b9a\u4e49\u5404\u4e2anode\u4e4b\u95f4\u8c03\u7528\u8d44\u6e90\u7684\u5f00\u9500\uff0c\u4e3a\u8d44\u6e90\u8c03\u5ea6\u4f18\u5316\u7b97\u6cd5\u63d0\u4f9b\u6570\u636e\u652f\u6301\u3002<\/p>\n<p>\u4e8c\u3001NUMA\u76f8\u5173\u7684\u7b56\u7565<\/p>\n<p>1\u3001\u6bcf\u4e2a\u8fdb\u7a0b\uff08\u6216\u7ebf\u7a0b\uff09\u90fd\u4f1a\u4ece\u7236\u8fdb\u7a0b\u7ee7\u627fNUMA\u7b56\u7565\uff0c\u5e76\u5206\u914d\u6709\u4e00\u4e2a\u4f18\u5148node\u3002\u5982\u679cNUMA\u7b56\u7565\u5141\u8bb8\u7684\u8bdd\uff0c\u8fdb\u7a0b\u53ef\u4ee5\u8c03\u7528\u5176\u4ed6node\u4e0a\u7684\u8d44\u6e90\u3002<\/p>\n<p>2\u3001NUMA\u7684CPU\u5206\u914d\u7b56\u7565\u6709cpunodebind\u3001physcpubind\u3002cpunodebind\u89c4\u5b9a\u8fdb\u7a0b\u8fd0\u884c\u5728\u67d0\u51e0\u4e2anode\u4e4b\u4e0a\uff0c\u800cphyscpubind\u53ef\u4ee5\u66f4\u52a0\u7cbe\u7ec6\u5730\u89c4\u5b9a\u8fd0\u884c\u5728\u54ea\u4e9b\u6838\u4e0a\u3002<\/p>\n<p>3\u3001NUMA\u7684\u5185\u5b58\u5206\u914d\u7b56\u7565\u6709localalloc\u3001preferred\u3001membind\u3001interleave\u3002localalloc\u89c4\u5b9a\u8fdb\u7a0b\u4ece\u5f53\u524dnode\u4e0a\u8bf7\u6c42\u5206\u914d\u5185\u5b58\uff1b\u800cpreferred\u6bd4\u8f83\u5bbd\u677e\u5730\u6307\u5b9a\u4e86\u4e00\u4e2a\u63a8\u8350\u7684node\u6765\u83b7\u53d6\u5185\u5b58\uff0c\u5982\u679c\u88ab\u63a8\u8350\u7684node\u4e0a\u6ca1\u6709\u8db3\u591f\u5185\u5b58\uff0c\u8fdb\u7a0b\u53ef\u4ee5\u5c1d\u8bd5\u522b\u7684node\u3002membind\u53ef\u4ee5\u6307\u5b9a\u82e5\u5e72\u4e2anode\uff0c\u8fdb\u7a0b\u53ea\u80fd\u4ece\u8fd9\u4e9b\u6307\u5b9a\u7684node\u4e0a\u8bf7\u6c42\u5206\u914d\u5185\u5b58\u3002interleave\u89c4\u5b9a\u8fdb\u7a0b\u4ece\u6307\u5b9a\u7684\u82e5\u5e72\u4e2anode\u4e0a\u4ee5RR\u7b97\u6cd5\u4ea4\u7ec7\u5730\u8bf7\u6c42\u5206\u914d\u5185\u5b58\u3002<\/p>\n<p>\u4e09\u3001NUMA\u548cswap\u7684\u5173\u7cfb<\/p>\n<p>\u53ef\u80fd\u5927\u5bb6\u5df2\u7ecf\u53d1\u73b0\u4e86\uff0cNUMA\u7684\u5185\u5b58\u5206\u914d\u7b56\u7565\u5bf9\u4e8e\u8fdb\u7a0b\uff08\u6216\u7ebf\u7a0b\uff09\u4e4b\u95f4\u6765\u8bf4\uff0c\u5e76\u4e0d\u662f\u516c\u5e73\u7684\u3002\u5728\u73b0\u6709\u7684Redhat <a title=\"linux\" href=\"http:\/\/www.ttlsa.com\/linux\/\" target=\"_blank\">Linux<\/a>\u4e2d\uff0clocalalloc\u662f\u9ed8\u8ba4\u7684NUMA\u5185\u5b58\u5206\u914d\u7b56\u7565\uff0c\u8fd9\u4e2a\u914d\u7f6e\u9009\u9879\u5bfc\u81f4\u8d44\u6e90\u72ec\u5360\u7a0b\u5e8f\u5f88\u5bb9\u6613\u5c06\u67d0\u4e2anode\u7684\u5185\u5b58\u7528\u5c3d\u3002\u800c\u5f53\u67d0\u4e2anode\u7684\u5185\u5b58\u8017\u5c3d\u65f6\uff0cLinux\u53c8\u521a\u597d\u5c06\u8fd9\u4e2anode\u5206\u914d\u7ed9\u4e86\u67d0\u4e2a\u9700\u8981\u6d88\u8017\u5927\u91cf\u5185\u5b58\u7684\u8fdb\u7a0b\uff08\u6216\u7ebf\u7a0b\uff09\uff0cswap\u5c31\u59a5\u59a5\u5730\u4ea7\u751f\u4e86\u3002\u5c3d\u7ba1\u6b64\u65f6\u8fd8\u6709\u5f88\u591apage cache\u53ef\u4ee5\u91ca\u653e\uff0c\u751a\u81f3\u8fd8\u6709\u5f88\u591a\u7684free\u5185\u5b58\u3002<\/p>\n<p>\u56db\u3001\u89e3\u51b3swap\u95ee\u9898<\/p>\n<p>\u867d\u7136NUMA\u7684\u539f\u7406\u76f8\u5bf9\u590d\u6742\uff0c\u5b9e\u9645\u4e0a\u89e3\u51b3swap\u5374\u5f88\u7b80\u5355\uff1a\u53ea\u8981\u5728\u542f\u52a8MySQL\u4e4b\u524d\u4f7f\u7528numactl \u2013interleave\u6765\u4fee\u6539NUMA\u7b56\u7565\u5373\u53ef\u3002<\/p>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0cnumactl\u8fd9\u4e2a\u547d\u4ee4\u4e0d\u4ec5\u4ec5\u53ef\u4ee5\u8c03\u6574NUMA\u7b56\u7565\uff0c\u4e5f\u53ef\u4ee5\u7528\u6765\u67e5\u770b\u5f53\u524d\u5404\u4e2anode\u7684\u8d44\u6e90\u662f\u7528\u60c5\u51b5\uff0c\u662f\u4e00\u4e2a\u5f88\u503c\u5f97\u7814\u7a76\u7684\u547d\u4ee4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mongodb\u65e5\u5fd7\u663e\u793a\u5982\u4e0b: WARNING: You are running on a NUMA machine. We suggest launching mongod like this to avoid performance problems: numactl \u2013interleave=all mongod [other options] \u89e3\u51b3\u65b9\u6848\uff1a 1.\u5728\u539f\u542f\u52a8\u547d\u4ee4\u524d\u9762\u52a0numactl \u2013interleave=all \u5982# numactl \u2013interleave=all ${MONGODB_HOME}\/bin\/mongod \u2013config conf\/mongodb.conf 2.\u4fee\u6539\u5185\u6838\u53c2\u6570 echo 0 &gt; \/proc\/sys\/vm\/zone_reclaim_mode http:\/\/www.mongodb.org\/display\/DOCS\/NUMA \u4e0b\u9762\u6ce8\u91ca\u8f6c\u81ea\u7f51\u7edc \u4e00\u3001NUMA\u548cSMP NUMA\u548cSMP\u662f\u4e24\u79cdCPU\u76f8\u5173\u7684\u786c\u4ef6\u67b6\u6784\u3002\u5728SMP\u67b6\u6784\u91cc\u9762\uff0c\u6240\u6709\u7684CPU\u4e89\u7528\u4e00\u4e2a\u603b\u7ebf\u6765\u8bbf\u95ee\u6240\u6709\u5185\u5b58\uff0c\u4f18\u70b9\u662f\u8d44\u6e90\u5171\u4eab\uff0c\u800c\u7f3a\u70b9\u662f\u603b\u7ebf\u4e89\u7528\u6fc0\u70c8\u3002\u968f\u7740PC\u670d\u52a1\u5668\u4e0a\u7684CPU\u6570\u91cf\u53d8\u591a\uff08\u4e0d\u4ec5\u4ec5\u662fCPU\u6838\u6570\uff09\uff0c\u603b\u7ebf\u4e89\u7528\u7684\u5f0a\u7aef\u6162\u6162\u8d8a\u6765\u8d8a\u660e\u663e\uff0c\u4e8e\u662fIntel\u5728Nehalem CPU\u4e0a\u63a8\u51fa\u4e86NUMA\u67b6\u6784\uff0c\u800cAMD\u4e5f\u63a8\u51fa\u4e86\u57fa\u4e8e\u76f8\u540c\u67b6\u6784\u7684Opteron CPU\u3002 NUMA\u6700\u5927\u7684\u7279\u70b9\u662f\u5f15\u5165\u4e86node\u548cdistance\u7684\u6982\u5ff5\u3002\u5bf9\u4e8eCPU\u548c\u5185\u5b58\u8fd9\u4e24\u79cd\u6700\u5b9d\u8d35\u7684\u786c\u4ef6\u8d44\u6e90\uff0cNUMA\u7528\u8fd1\u4e4e\u4e25\u683c\u7684\u65b9\u5f0f\u5212\u5206\u4e86\u6240\u5c5e\u7684\u8d44\u6e90\u7ec4\uff08node\uff09\uff0c\u800c\u6bcf\u4e2a\u8d44\u6e90\u7ec4\u5185\u7684CPU\u548c\u5185\u5b58\u662f\u51e0\u4e4e\u76f8\u7b49\u3002\u8d44\u6e90\u7ec4\u7684\u6570\u91cf\u53d6\u51b3\u4e8e\u7269\u7406CPU\u7684\u4e2a\u6570\uff08\u73b0\u6709\u7684PC server\u5927\u591a\u6570\u6709\u4e24\u4e2a\u7269\u7406CPU\uff0c\u6bcf\u4e2aCPU\u67094\u4e2a\u6838\uff09\uff1bdistance\u8fd9\u4e2a\u6982\u5ff5\u662f\u7528\u6765\u5b9a\u4e49\u5404\u4e2anode\u4e4b\u95f4\u8c03\u7528\u8d44\u6e90\u7684\u5f00\u9500\uff0c\u4e3a\u8d44\u6e90\u8c03\u5ea6\u4f18\u5316\u7b97\u6cd5\u63d0\u4f9b\u6570\u636e\u652f\u6301\u3002 \u4e8c\u3001NUMA\u76f8\u5173\u7684\u7b56\u7565 1\u3001\u6bcf\u4e2a\u8fdb\u7a0b\uff08\u6216\u7ebf\u7a0b\uff09\u90fd\u4f1a\u4ece\u7236\u8fdb\u7a0b\u7ee7\u627fNUMA\u7b56\u7565\uff0c\u5e76\u5206\u914d\u6709\u4e00\u4e2a\u4f18\u5148node\u3002\u5982\u679cNUMA\u7b56\u7565\u5141\u8bb8\u7684\u8bdd\uff0c\u8fdb\u7a0b\u53ef\u4ee5\u8c03\u7528\u5176\u4ed6node\u4e0a\u7684\u8d44\u6e90\u3002 2\u3001NUMA\u7684CPU\u5206\u914d\u7b56\u7565\u6709cpunodebind\u3001physcpubind\u3002cpunodebind\u89c4\u5b9a\u8fdb\u7a0b\u8fd0\u884c\u5728\u67d0\u51e0\u4e2anode\u4e4b\u4e0a\uff0c\u800cphyscpubind\u53ef\u4ee5\u66f4\u52a0\u7cbe\u7ec6\u5730\u89c4\u5b9a\u8fd0\u884c\u5728\u54ea\u4e9b\u6838\u4e0a\u3002 3\u3001NUMA\u7684\u5185\u5b58\u5206\u914d\u7b56\u7565\u6709localalloc\u3001preferred\u3001membind\u3001interleave\u3002localalloc\u89c4\u5b9a\u8fdb\u7a0b\u4ece\u5f53\u524dnode\u4e0a\u8bf7\u6c42\u5206\u914d\u5185\u5b58\uff1b\u800cpreferred\u6bd4\u8f83\u5bbd\u677e\u5730\u6307\u5b9a\u4e86\u4e00\u4e2a\u63a8\u8350\u7684node\u6765\u83b7\u53d6\u5185\u5b58\uff0c\u5982\u679c\u88ab\u63a8\u8350\u7684node\u4e0a\u6ca1\u6709\u8db3\u591f\u5185\u5b58\uff0c\u8fdb\u7a0b\u53ef\u4ee5\u5c1d\u8bd5\u522b\u7684node\u3002membind\u53ef\u4ee5\u6307\u5b9a\u82e5\u5e72\u4e2anode\uff0c\u8fdb\u7a0b\u53ea\u80fd\u4ece\u8fd9\u4e9b\u6307\u5b9a\u7684node\u4e0a\u8bf7\u6c42\u5206\u914d\u5185\u5b58\u3002interleave\u89c4\u5b9a\u8fdb\u7a0b\u4ece\u6307\u5b9a\u7684\u82e5\u5e72\u4e2anode\u4e0a\u4ee5RR\u7b97\u6cd5\u4ea4\u7ec7\u5730\u8bf7\u6c42\u5206\u914d\u5185\u5b58\u3002 \u4e09\u3001NUMA\u548cswap\u7684\u5173\u7cfb \u53ef\u80fd\u5927\u5bb6\u5df2\u7ecf\u53d1\u73b0\u4e86\uff0cNUMA\u7684\u5185\u5b58\u5206\u914d\u7b56\u7565\u5bf9\u4e8e\u8fdb\u7a0b\uff08\u6216\u7ebf\u7a0b\uff09\u4e4b\u95f4\u6765\u8bf4\uff0c\u5e76\u4e0d\u662f\u516c\u5e73\u7684\u3002\u5728\u73b0\u6709\u7684Redhat Linux\u4e2d\uff0clocalalloc\u662f\u9ed8\u8ba4\u7684NUMA\u5185\u5b58\u5206\u914d\u7b56\u7565\uff0c\u8fd9\u4e2a\u914d\u7f6e\u9009\u9879\u5bfc\u81f4\u8d44\u6e90\u72ec\u5360\u7a0b\u5e8f\u5f88\u5bb9\u6613\u5c06\u67d0\u4e2anode\u7684\u5185\u5b58\u7528\u5c3d\u3002\u800c\u5f53\u67d0\u4e2anode\u7684\u5185\u5b58\u8017\u5c3d\u65f6\uff0cLinux\u53c8\u521a\u597d\u5c06\u8fd9\u4e2anode\u5206\u914d\u7ed9\u4e86\u67d0\u4e2a\u9700\u8981\u6d88\u8017\u5927\u91cf\u5185\u5b58\u7684\u8fdb\u7a0b\uff08\u6216\u7ebf\u7a0b\uff09\uff0cswap\u5c31\u59a5\u59a5\u5730\u4ea7\u751f\u4e86\u3002\u5c3d\u7ba1\u6b64\u65f6\u8fd8\u6709\u5f88\u591apage cache\u53ef\u4ee5\u91ca\u653e\uff0c\u751a\u81f3\u8fd8\u6709\u5f88\u591a\u7684free\u5185\u5b58\u3002 \u56db\u3001\u89e3\u51b3swap\u95ee\u9898 &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1279\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">mongodb\u7684NUMA\u95ee\u9898<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,20],"tags":[10],"class_list":["post-1279","post","type-post","status-publish","format-standard","hentry","category-linux","category-20","tag-mongodb"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1279"}],"version-history":[{"count":2,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1279\/revisions"}],"predecessor-version":[{"id":1284,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1279\/revisions\/1284"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}