首页 > 代码库 > nginx中worker_cpu_affinity参数及其CPU相关知识
nginx中worker_cpu_affinity参数及其CPU相关知识
worker_cpu_affinity
Syntax: worker_cpu_affinity cpumask [cpumask...]
Default: none
Linux only.
With this option you can bind the worker process to a CPU, it calls sched_setaffinity().
For example worker_processes 2; worker_cpu_affinity 01 10; 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 the second worker to CPU1/CPU3. This is suitable for HTT
nginx可以使用多个worker进程,原因如下:
to use SMP to decrease latency when workers blockend on disk I/O 。to limit number of connections per process when select()/poll()。 is used The worker_processes and worker_connections from the event sections allows you to calculate maxclients value:
max_clients = worker_processes * worker_connections
综上:2核是 01,四核是0001,8核是00000001,有多少个核,就有几位数,1表示该内核开启,0表示该内核关闭。
本文出自 “我的《奋斗》” 博客,请务必保留此出处http://wangmukun.blog.51cto.com/651644/1560330
nginx中worker_cpu_affinity参数及其CPU相关知识
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。