{"id":1203,"date":"2013-04-23T12:13:53","date_gmt":"2013-04-23T04:13:53","guid":{"rendered":"http:\/\/www.strongd.net\/?p=1203"},"modified":"2013-04-23T12:13:53","modified_gmt":"2013-04-23T04:13:53","slug":"nginx%e7%9a%84worker_cpu_affinity%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1203","title":{"rendered":"Nginx\u7684worker_cpu_affinity\u8be6\u89e3"},"content":{"rendered":"<p>\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684worker_cpu_affinity\u53ef\u4ee5\u7528\u6765\u7ed1\u5b9a\u6bcf\u4e2anginx\u8fdb\u7a0b\u6240\u4f7f\u7528\u7684CPU<br \/>\n\u5b98\u65b9\u7684\u89e3\u91ca\u662f\uff1a<code><br \/>\n#----------------------------\u5f15\u7528\u6587\u5b57-\u5f00\u59cb----------------------------<br \/>\nSyntax: worker_cpu_affinity cpumask [cpumask...]<br \/>\nDefault: none<br \/>\nLinux only.<br \/>\nWith this option you can bind the worker process to a CPU, it calls sched_setaffinity().<br \/>\nFor example,<br \/>\nworker_processes 4;<br \/>\nworker_cpu_affinity 0001 0010 0100 1000;<br \/>\nBind each worker process to one CPU only.<br \/>\nworker_processes 2;<br \/>\nworker_cpu_affinity 0101 1010;<br \/>\nBind the first worker to CPU0\/CPU2, bind the second worker to CPU1\/CPU3. This is suitable for HTT.<br \/>\n#----------------------------\u5f15\u7528\u6587\u5b57-\u7ed3\u675f----------------------------<\/code><br \/>\n\u6700\u5173\u952e\u7684\u5730\u65b9\u6ca1\u8bf4\u6e05\u695a\uff0c\u600e\u6837\u6765\u8868\u793a\u6bcf\u4e2aCPU\uff1f<\/p>\n<p>\u7ecf\u8fc7\u6f2b\u5929\u7684\u641c\u7d22\u548c\u591a\u6b21\u5c1d\u8bd5\u53d1\u73b0<br \/>\n<img decoding=\"async\" title=\"\u8be6\u89e3\" alt=\"\u8be6\u89e3\" src=\"http:\/\/www.chengyongxu.com\/blog\/wp-content\/uploads\/2009\/11\/%E8%AF%A6%E8%A7%A3.jpg\" \/><\/p>\n<p>\u5982\u679c8\u6838\u5c31\u662f\uff1a<\/p>\n<p>worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;<\/p>\n<p>\u5982\u6b64\u7c7b\u63a8~~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684worker_cpu_affinity\u53ef\u4ee5\u7528\u6765\u7ed1\u5b9a\u6bcf\u4e2anginx\u8fdb\u7a0b\u6240\u4f7f\u7528\u7684CPU \u5b98\u65b9\u7684\u89e3\u91ca\u662f\uff1a #&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-\u5f15\u7528\u6587\u5b57-\u5f00\u59cb&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- Syntax: worker_cpu_affinity cpumask [cpumask&#8230;] Default: none Linux only. With this option you can bind the worker process to a CPU, it calls sched_setaffinity(). For example, worker_processes 4; worker_cpu_affinity 0001 0010 0100 1000; Bind each worker process to one CPU only. worker_processes 2; worker_cpu_affinity 0101 1010; Bind the first worker to CPU0\/CPU2, bind &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1203\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Nginx\u7684worker_cpu_affinity\u8be6\u89e3<\/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":[20],"tags":[13],"class_list":["post-1203","post","type-post","status-publish","format-standard","hentry","category-20","tag-nginx"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1203","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=1203"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1203\/revisions"}],"predecessor-version":[{"id":1204,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1203\/revisions\/1204"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}