{"id":674,"date":"2015-03-04T22:23:51","date_gmt":"2015-03-04T14:23:51","guid":{"rendered":"http:\/\/www.ipcpu.com\/?p=674"},"modified":"2015-03-04T22:23:51","modified_gmt":"2015-03-04T14:23:51","slug":"cpu-kondemand","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2015\/03\/cpu-kondemand\/","title":{"rendered":"CPU\u7701\u7535\u8fdb\u7a0bkondemand\u4ecb\u7ecd"},"content":{"rendered":"

kondemand\u6982\u8ff0<\/h2>\n

\u8fd1\u65e5\u5728\u67d0\u670d\u52a1\u5668\u4e0a\u53d1\u73b0\u4e86\u4e00\u4e2akondemand\u8fdb\u7a0b\uff0c\u5360\u7528CPU1-2%\u5de6\u53f3\uff0c\u770b\u8d77\u6765\u50cf\u662f\u4e2a\u7cfb\u7edf\u76f8\u5173\u8fdb\u7a0b\u3002<\/p>\n

\u7ecf\u67e5\u8be2\u53d1\u73b0\u8fd9\u4e2a\u662f\u4e00\u4e2aCPU\u7701\u7535\u6a21\u5f0f\u76f8\u5173\u7684\u8fdb\u7a0b\u3002<\/p>\n

\u7701\u7535\u6a21\u5f0f<\/h2>\n

CPU\u7701\u7535\u6a21\u5f0f\u662fBIOS\u91cc\u9762\u7684\u4e00\u4e2a\u8bbe\u5b9a\uff0c\u4e3a\u4e00\u4e9b\u4fbf\u643a\u5f0f\u53ca\u5bb6\u7528\u53f0\u5f0f\u673a\u5e7f\u6cdb\u4f7f\u7528\uff0c\u5f53\u7cfb\u7edf\u8d1f\u8f7d\u4e0d\u9ad8\u65f6\u964d\u4f4eCPU\u8fd0\u884c\u9891\u7387\uff0c\u8282\u7701\u7535\u91cf\uff0c\u6b64\u65f6CPU\u6e29\u5ea6\u4e5f\u4e0d\u4f1a\u592a\u9ad8\uff0cCPU\u98ce\u6247\u8f6c\u901f\u4f4e\uff0c\u58f0\u97f3\u5c0f\u3002\u5f53\u73a9\u6e38\u620f\u65f6\uff0c\u9700\u8981\u6d88\u8017\u5927\u91cfCPU\uff0cCPU\u9891\u7387\u53c8\u4f1a\u81ea\u52a8\u8c03\u9ad8\uff0cCPU\u6e29\u5ea6\u548c\u98ce\u6247\u8f6c\u901f\u4e5f\u4f1a\u8ddf\u8fdb\uff0c\u58f0\u97f3\u4f1a\u6bd4\u8f83\u5927\u3002<\/p>\n

\u5f53\u4f7f\u7528\u670d\u52a1\u5668\u65f6\uff0c\u8fd9\u4e2a\u7701\u7535\u6a21\u5f0f\u5c31\u4f1a\u6709\u95ee\u9898\u4e86\uff0c\u5f53\u77ac\u95f4\u4f7f\u7528\u5927\u91cfCPU\u8d44\u6e90\u65f6\uff0cCPU\u9700\u8981\u5347\u9ad8\u9891\u7387\uff0c\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\uff0c\u9020\u6210\u76f8\u5e94\u7f13\u6162\uff0c\u56e0\u6b64\u670d\u52a1\u5668\u4e0a\u4e00\u822c\u662f\u5173\u95ed\u7701\u7535\u6a21\u5f0f\u7684\u3002<\/p>\n

\u7701\u7535\u6a21\u5f0f\u4e00\u822c\u5728BIOS\u91cc\u8bbe\u5b9a\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528ILO\u6216\u8005iDRAC\uff0c\u5982\u4e0b\uff0c<\/p>\n

<\/p>\n

<\/p>\n

<\/p>\n

\u76d1\u6d4b\u7701\u7535\u6a21\u5f0f\u662f\u5426\u5f00\u542f<\/h2>\n

\u5728\u7cfb\u7edf\u4e2d\u4e5f\u53ef\u4ee5\u76d1\u6d4b\u5230\u7701\u7535\u6a21\u5f0f\u662f\u5426\u5f00\u542f<\/p>\n

  1. #@\u90e8\u5206\u6216\u8005\u5168\u90e8CPU\u6838\u7684\u9891\u7387\u4e0e\u6807\u79f0\u9891\u7387\u4e0d\u4e00\u81f4<\/span><\/code><\/li>
  2. [<\/span>root@sw36<\/span>.<\/span>ipcpu<\/span>.<\/span>com <\/span>~]#<\/span> grep <\/span>-<\/span>E <\/span>'^model name|^cpu MHz'<\/span> <\/span>\/<\/span>proc<\/span>\/<\/span>cpuinfo<\/span><\/code><\/li>
  3. model name <\/span>:<\/span> <\/span>Intel<\/span>(<\/span>R<\/span>)<\/span> <\/span>Xeon<\/span>(<\/span>R<\/span>)<\/span> CPU E5<\/span>-<\/span>2640<\/span> v2 <\/span>@<\/span> <\/span>2.00GHz<\/span><\/code><\/li>
  4. cpu <\/span>MHz<\/span> <\/span>:<\/span> <\/span>1200.000<\/span><\/code><\/li>
  5. #@scaling_governor\u663e\u793aondemand<\/span><\/code><\/li>
  6. [<\/span>root@sw36<\/span>.<\/span>ipcpu<\/span>.<\/span>com <\/span>~]#<\/span> cat <\/span>\/<\/span>sys<\/span>\/<\/span>devices<\/span>\/<\/span>system<\/span>\/<\/span>cpu<\/span>\/<\/span>cpu0<\/span>\/<\/span>cpufreq<\/span>\/<\/span>scaling_governor<\/span><\/code><\/li>
  7. ondemand<\/span><\/code><\/li>
  8. #@\u7cfb\u7edf\u4e2d\u5b58\u5728kondemand\u8fdb\u7a0b<\/span><\/code><\/li>
  9. [<\/span>root@sw36<\/span>.<\/span>ipcpu<\/span>.<\/span>com <\/span>~]#<\/span> ps ax<\/span>|<\/span> grep kondemand<\/span><\/code><\/li>
  10. <\/span>2150<\/span> <\/span>?<\/span> S <\/span>2284<\/span>:<\/span>52<\/span> <\/span>[<\/span>kondemand<\/span>\/<\/span>0<\/span>]<\/span><\/code><\/li>
  11. <\/span>2151<\/span> <\/span>?<\/span> S <\/span>1710<\/span>:<\/span>57<\/span> <\/span>[<\/span>kondemand<\/span>\/<\/span>1<\/span>]<\/span><\/code><\/li>
  12. <\/span>2152<\/span> <\/span>?<\/span> S <\/span>1201<\/span>:<\/span>36<\/span> <\/span>[<\/span>kondemand<\/span>\/<\/span>2<\/span>]<\/span><\/code><\/li>
  13. #@\u7cfb\u7edf\u5185\u6838\u52a0\u8f7d\u4e86cpufreq\u76f8\u5173\u6a21\u5757<\/span><\/code><\/li>
  14. [<\/span>root@sw36<\/span>.<\/span>ipcpu<\/span>.<\/span>com <\/span>~]#<\/span>lsmod <\/span>|<\/span>grep cpufreq<\/span><\/code><\/li>
  15. pcc_cpufreq <\/span>5090<\/span> <\/span>0<\/span><\/code><\/li>
  16. cpufreq_ondemand <\/span>10544<\/span> <\/span>0<\/span><\/code><\/li>
  17. freq_table <\/span>4936<\/span> <\/span>1<\/span> cpufreq_ondemand<\/span><\/code><\/li><\/ol><\/pre>\n

    \u4ece\u7cfb\u7edf\u4e2d\u8c03\u6574\u7701\u7535\u6a21\u5f0f<\/h2>\n

    \u4eceBIOS\u91cc\u8c03\u6574\u662f\u6700\u597d\u7684\u529e\u6cd5\uff0c\u4f46\u662f\u670d\u52a1\u5668\u4e0d\u80fd\u91cd\u542f\u7684\u8bdd\uff0c\u5c31\u53ea\u80fd\u4ece\u7cfb\u7edf\u4e2d\u4fee\u6539\u4e86\u3002<\/p>\n

    1. \u5173\u95edcpuspeed\u670d\u52a1<\/h5>\n
    2. \u67e5\u770b\u5f53\u524d\u673a\u5668\u652f\u6301\u7684\u7b56\u7565<\/h5>\n
    1. [<\/span>root@sw36<\/span>.<\/span>ipcpu<\/span>.<\/span>com <\/span>~]#<\/span>cat <\/span>\/<\/span>sys<\/span>\/<\/span>devices<\/span>\/<\/span>system<\/span>\/<\/span>cpu<\/span>\/<\/span>cpu0<\/span>\/<\/span>cpufreq<\/span>\/<\/span>scaling_available_governors<\/span><\/code><\/li>
    2. ondemand userspace performance<\/span><\/code><\/li>
    3. [<\/span>root@sw36<\/span>.<\/span>swoole<\/span>.<\/span>qyer<\/span>.<\/span>idc <\/span>~]#<\/span><\/code><\/li><\/ol><\/pre>\n
      3. \u5199shell\u811a\u672c\u8fdb\u884c\u8bbe\u5b9a<\/h5>\n
      1. #!\/bin\/bash<\/span><\/code><\/li>
      2. #set cpu scaling governor by your self<\/span><\/code><\/li>
      3. <\/code><\/li>
      4. #\u51fd\u6570\u67e5\u627e\u6709\u51e0\u4e2a\u6838\u5fc3\u5e76\u5c06\u5176scaling_governor\u6587\u4ef6\u8bbe\u7f6e\u6210\u4f60\u6240\u9700\u8981\u7684\u5185\u5bb9<\/span><\/code><\/li>
      5. set_cpu<\/span>()<\/span><\/code><\/li>
      6. {<\/span><\/code><\/li>
      7. <\/span>for<\/span> i <\/span>in<\/span> <\/span>`ls \/sys\/devices\/system\/cpu\/ | grep 'cpu[0-9]?*'`<\/span><\/code><\/li>
      8. doecho $1 <\/span>><\/span> <\/span>\/sys\/<\/span>devices<\/span>\/<\/span>system<\/span>\/<\/span>cpu<\/span>\/<\/span>$i<\/span>\/<\/span>cpufreq<\/span>\/<\/span>scaling_governor<\/span><\/code><\/li>
      9. <\/span>done<\/span><\/code><\/li>
      10. }<\/span><\/code><\/li>
      11. <\/code><\/li>
      12. #\u5224\u65ad\u8f93\u5165<\/span><\/code><\/li>
      13. case<\/span> $1 <\/span>in<\/span><\/code><\/li>
      14. <\/span>#performance<\/span><\/code><\/li>
      15. <\/span>\"pf\"<\/span>)<\/span><\/code><\/li>
      16. set_cpu performance<\/span><\/code><\/li>
      17. <\/span>;;<\/span><\/code><\/li>
      18. <\/span>#ondemand<\/span><\/code><\/li>
      19. <\/span>\"od\"<\/span>)<\/span><\/code><\/li>
      20. <\/span>;;<\/span><\/code><\/li>
      21. <\/span>#conservative<\/span><\/code><\/li>
      22. <\/span>\"cs\"<\/span>)<\/span><\/code><\/li>
      23. <\/span>;;<\/span><\/code><\/li>
      24. <\/span>#powersave<\/span><\/code><\/li>
      25. <\/span>\"ps\"<\/span>)<\/span><\/code><\/li>
      26. set_cpu powersave<\/span><\/code><\/li>
      27. <\/span>;;<\/span><\/code><\/li>
      28. <\/span>*)<\/span><\/code><\/li>
      29. echo <\/span>\"please input [pf][od][cs][ps]\"<\/span><\/code><\/li>
      30. <\/span>;;<\/span><\/code><\/li>
      31. esac<\/span><\/code><\/li><\/ol><\/pre>\n
        4. \u901a\u8fc7\u89c2\u5bdf\/proc\/cpuinfo\u663e\u793a\u7684\u9891\u7387\u53ef\u4ee5\u770b\u5230\u662f\u5426\u751f\u6548<\/h5>\n

        \u53c2\u8003\u8d44\u6599<\/h2>\n

        http:\/\/my.pc-freak.net\/utilize-processor-work-linux-server-disable-cpu-scaling-linux-server-cpu-work-full-speed\/<\/a>
        \n
        https:\/\/www.servernoobs.com\/avoiding-cpu-speed-scaling-in-modern-linux-distributions-running-cpu-at-full-speed-tips\/<\/a>
        \n
        http:\/\/www.cnblogs.com\/reddusty\/p\/5053909.html<\/a>
        \n
        https:\/\/www.pantz.org\/software\/cpufreq\/usingcpufreqonlinux.html<\/a>
        \n
        http:\/\/mdba.cn\/2013\/12\/24\/%E9%92%88%E5%AF%B9mysql%E7%9A%84linux%E6%80%A7%E8%83%BD%E8%B0%83%E4%BC%98%E6%8A%80%E5%B7%A7\/<\/a>
        \n
        https:\/\/www.percona.com\/blog\/2013\/12\/07\/linux-performance-tuning-tips-mysql\/<\/a><\/p>\n

        \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » CPU\u7701\u7535\u8fdb\u7a0bkondemand\u4ecb\u7ecd<\/a><\/p>","protected":false},"excerpt":{"rendered":"

        kondemand\u6982\u8ff0 \u8fd1\u65e5\u5728\u67d0\u670d\u52a1\u5668\u4e0a\u53d1\u73b0\u4e86\u4e00\u4e2akondemand\u8fdb\u7a0b\uff0c\u5360\u7528CPU1-2%\u5de6\u53f3\uff0c\u770b\u8d77\u6765\u50cf\u662f\u4e2a\u7cfb\u7edf\u76f8\u5173\u8fdb\u7a0b\u3002 \u7ecf\u67e5\u8be2\u53d1\u73b0\u8fd9\u4e2a\u662f\u4e00\u4e2aCPU\u7701\u7535\u6a21\u5f0f\u76f8\u5173\u7684\u8fdb\u7a0b\u3002 \u7701\u7535\u6a21\u5f0f CPU\u7701\u7535\u6a21\u5f0f\u662fBIOS\u91cc\u9762\u7684\u4e00\u4e2a\u8bbe\u5b9a\uff0c\u4e3a\u4e00\u4e9b\u4fbf\u643a\u5f0f\u53ca\u5bb6\u7528\u53f0\u5f0f\u673a\u5e7f\u6cdb\u4f7f\u7528\uff0c\u5f53\u7cfb\u7edf\u8d1f\u8f7d\u4e0d\u9ad8\u65f6\u964d\u4f4eCPU\u8fd0\u884c\u9891\u7387\uff0c\u8282\u7701\u7535\u91cf\uff0c\u6b64\u65f6CPU\u6e29\u5ea6\u4e5f\u4e0d\u4f1a\u592a\u9ad8\uff0cCPU\u98ce\u6247\u8f6c\u901f\u4f4e\uff0c\u58f0\u97f3\u5c0f\u3002\u5f53\u73a9\u6e38\u620f\u65f6\uff0c\u9700\u8981\u6d88\u8017\u5927\u91cfCPU\uff0cCPU\u9891\u7387\u53c8\u4f1a\u81ea\u52a8\u8c03\u9ad8\uff0cCPU\u6e29\u5ea6\u548c\u98ce\u6247\u8f6c\u901f\u4e5f\u4f1a\u8ddf\u8fdb\uff0c\u58f0\u97f3\u4f1a\u6bd4\u8f83\u5927\u3002 \u5f53\u4f7f\u7528\u670d\u52a1\u5668\u65f6\uff0c\u8fd9\u4e2a\u7701\u7535\u6a21\u5f0f\u5c31\u4f1a\u6709\u95ee\u9898\u4e86\uff0c\u5f53\u77ac\u95f4\u4f7f\u7528\u5927\u91cfCPU\u8d44\u6e90\u65f6\uff0cCPU\u9700\u8981\u5347\u9ad8\u9891\u7387\uff0c\u9700\u8981\u4e00\u6bb5\u65f6\u95f4\uff0c\u9020\u6210\u76f8\u5e94\u7f13\u6162\uff0c\u56e0\u6b64\u670d\u52a1\u5668\u4e0a\u4e00\u822c\u662f\u5173\u95ed\u7701\u7535\u6a21\u5f0f\u7684\u3002 \u7701\u7535\u6a21\u5f0f\u4e00\u822c\u5728BIOS\u91cc\u8bbe\u5b9a\u3002\u4e5f\u53ef\u4ee5\u4f7f\u7528ILO\u6216\u8005iDRAC\uff0c\u5982\u4e0b\uff0c \u76d1\u6d4b\u7701\u7535\u6a21\u5f0f\u662f\u5426\u5f00\u542f \u5728\u7cfb\u7edf\u4e2d\u4e5f\u53ef\u4ee5\u76d1\u6d4b\u5230\u7701\u7535\u6a21\u5f0f\u662f\u5426\u5f00\u542f #@\u90e8\u5206\u6216\u8005\u5168\u90e8CPU\u6838\u7684\u9891\u7387\u4e0e\u6807\u79f0\u9891\u7387\u4e0d\u4e00\u81f4[root@sw36.ipcpu.com ~]# grep -E ‘^model name|^cpu MHz’ \/proc\/cpuinfomodel name : Intel(R) Xeon(R) CPU E5-2640 v2 @ 2.00GHzcpu MHz : 1200.000#@scaling_governor\u663e\u793aondemand[root@sw36.ipcpu.com ~]# cat \/sys\/devices\/system\/cpu\/cpu0\/cpufreq\/scaling_governorondemand#@\u7cfb\u7edf\u4e2d\u5b58\u5728kondemand\u8fdb\u7a0b[root@sw36.ipcpu.com ~]# ps ax| grep kondemand 2150 ? S 2284:52 [kondemand\/0] 2151 ? S 1710:57 [kondemand\/1] 2152 ? S 1201:36 [kondemand\/2]#@\u7cfb\u7edf\u5185\u6838\u52a0\u8f7d\u4e86cpufreq\u76f8\u5173\u6a21\u5757[root@sw36.ipcpu.com ~]#lsmod |grep cpufreqpcc_cpufreq […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[98,99,49,100,101,102],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/674"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=674"}],"version-history":[{"count":0,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/674\/revisions"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}