{"id":12035,"date":"2024-11-25T14:24:32","date_gmt":"2024-11-25T22:24:32","guid":{"rendered":"https:\/\/www.xh86.me\/?p=12035"},"modified":"2024-11-25T14:24:32","modified_gmt":"2024-11-25T22:24:32","slug":"%e4%bc%98%e5%8c%96linux%e5%86%85%e6%a0%b8%ef%bc%9a%e9%80%9a%e8%bf%87%e8%b0%83%e6%95%b4swappiness%e6%8f%90%e5%8d%87%e7%b3%bb%e7%bb%9f%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=12035","title":{"rendered":"\u4f18\u5316Linux\u5185\u6838\uff1a\u901a\u8fc7\u8c03\u6574Swappiness\u63d0\u5347\u7cfb\u7edf\u6027\u80fd"},"content":{"rendered":"<div class=\"wxsyncmain\">Swappiness \u662f Linux \u5185\u6838\u7528\u4e8e\u63a7\u5236\u7cfb\u7edf\u5185\u5b58\u7ba1\u7406\u7684\u4e00\u4e2a\u53c2\u6570\uff0c\u5b83\u51b3\u5b9a\u4e86\u7cfb\u7edf\u5728\u5185\u5b58\u4e0d\u8db3\u65f6\u5c06\u6570\u636e\u4ece\u7269\u7406\u5185\u5b58\u4ea4\u6362\u5230\u4ea4\u6362\u7a7a\u95f4\uff08swap space\uff09\u7684\u9891\u7387\u3002\u66f4\u9ad8\u7684 swappiness \u503c\u4f7f\u64cd\u4f5c\u7cfb\u7edf\u66f4\u503e\u5411\u4e8e\u5c06\u6570\u636e\u6362\u51fa\u5230\u4ea4\u6362\u7a7a\u95f4\uff0c\u800c\u8f83\u4f4e\u7684\u503c\u5219\u503e\u5411\u4e8e\u4fdd\u7559\u6570\u636e\u5728\u7269\u7406\u5185\u5b58\u4e2d\u3002<br \/>\nLinux \u7cfb\u7edf\u4e2d swappiness \u7684\u9ed8\u8ba4\u503c\u901a\u5e38\u4e3a 60\u3002\u8fd9\u4e2a\u503c\u5728\u5927\u591a\u6570\u684c\u9762\u7cfb\u7edf\u4e2d\u8868\u73b0\u826f\u597d\uff0c\u4f46\u67d0\u4e9b\u5e94\u7528\u573a\u666f\u4e0b\uff0c\u8c03\u6574\u8fd9\u4e2a\u503c\u53ef\u4ee5\u63d0\u9ad8\u7cfb\u7edf\u6027\u80fd\u3002\u4f8b\u5982\uff0c\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u80fd\u9700\u8981\u8f83\u4f4e\u7684 swappiness \u503c\u4ee5\u786e\u4fdd\u6570\u636e\u4fdd\u6301\u5728\u5185\u5b58\u4e2d\u5c3d\u91cf\u4e0d\u8fdb\u5165\u4ea4\u6362\u7a7a\u95f4\u3002<br \/>\n\u8c03\u6574 swappiness \u53ef\u4ee5\u4f18\u5316\u7cfb\u7edf\u7684\u6027\u80fd\u3002\u6bd4\u5982\uff0c\u5728\u6709\u5927\u91cf\u53ef\u7528\u5185\u5b58\u5e76\u4e14\u5e0c\u671b\u51cf\u5c11\u78c1\u76d8 I\/O \u4ee5\u63d0\u9ad8\u6027\u80fd\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u964d\u4f4e swappiness \u503c\u3002<br \/>\n\u8981\u8c03\u6574 swappiness\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u79cd\u65b9\u5f0f\u8fdb\u884c\u64cd\u4f5c\uff1a<br \/>\n1\u3001\u4e34\u65f6\u8c03\u6574\uff0c\u8fd9\u79cd\u65b9\u6cd5\u53ea\u662f\u4e34\u65f6\u8c03\u6574\uff0c\u5728\u7cfb\u7edf\u91cd\u542f\u540e\u4f1a\u6062\u590d\u9ed8\u8ba4\u503c\u3002<br \/>\n<code>sysctl vm.swappiness=10<\/code>2\u3001\u6c38\u4e45\u8c03\u6574\uff0c\u4e3a\u4e86\u5728\u7cfb\u7edf\u91cd\u542f\u540e\u4fdd\u7559\u8bbe\u7f6e\uff0c\u9700\u8981\u7f16\u8f91 \/etc\/sysctl.conf \u6587\u4ef6\u3002<br \/>\n<code>vm.swappiness=10<\/code>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5c31\u53ef\u4ee5\u8c03\u6574 Linux \u7cfb\u7edf\u7684 swappiness \u8bbe\u7f6e\uff0c\u6839\u636e\u5b9e\u9645\u9700\u6c42\u4f18\u5316\u7cfb\u7edf\u7684\u5185\u5b58\u7ba1\u7406\u548c\u6027\u80fd\u8868\u73b0\u3002\u5728\u8c03\u6574\u4e4b\u524d\uff0c\u5efa\u8bae\u76d1\u6d4b\u7cfb\u7edf\u7684\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\uff0c\u4ee5\u4fbf\u505a\u51fa\u66f4\u5408\u9002\u7684\u8c03\u6574\u51b3\u5b9a\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Swappiness \u662f Linux \u5185\u6838\u7528\u4e8e\u63a7\u5236\u7cfb\u7edf\u5185\u5b58\u7ba1\u7406\u7684\u4e00\u4e2a\u53c2\u6570\uff0c\u5b83\u51b3\u5b9a\u4e86\u7cfb\u7edf\u5728\u5185\u5b58\u4e0d\u8db3\u65f6\u5c06\u6570\u636e\u4ece\u7269\u7406 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-12035","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/12035","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12035"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/12035\/revisions"}],"predecessor-version":[{"id":12112,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/12035\/revisions\/12112"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12035"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12035"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}