gpt4 book ai didi

ubuntu - 如何确定工作进程的数量

转载 作者:行者123 更新时间:2023-12-04 19:20:40 26 4
gpt4 key购买 nike

我正在关注在 ubuntu 上设置 nginx 的教程。我已经安装了 nginx 并成功启动。该教程说这个关于调整和设置 nginx 进程和工作连接

It is often recommended to set the number of NGINX workers equal the number of processors, you can determine the number of processors using:

cat /proc/cpuinfo | grep processor

当我运行命令时,我得到一个 0。
processor   : 0

因此,根据教程,我应该在适当的位置将配置设置为 0
sudo nano /etc/nginx/nginx.conf


worker_processes 0;

本教程的示例有一个 1。但是,我有点担心不仅在运行输出时看到 0,而且在运行 ps -ef | grep nginx 时也看到了 0。 ,我得到这个输出,提示有多个工作进程?
root      1824     1  0 19:40 ?        00:00:00 nginx: master process /usr/sbinnginx
www-data 1825 1824 0 19:40 ? 00:00:00 nginx: worker process
www-data 1826 1824 0 19:40 ? 00:00:00 nginx: worker process
www-data 1827 1824 0 19:40 ? 00:00:00 nginx: worker process
www-data 1828 1824 0 19:40 ? 00:00:00 nginx: worker process
michael 1832 1378 0 19:44 pts/1 00:00:00 grep --color=auto nginx

运行 cat /proc/cpuinfo | grep processor 时看到 0 是否值得关注?我应该设置什么 worker_processes 0;在/etc/nginx/nginx.conf 中?

最佳答案

那么计数从0开始,所以只能得到 processor : 0意味着您只有 1 个处理器/内核。

我不确定,但我假设 worker_processes 0;意味着无限,所以我认为您应该将其更改为worker_processes 1 ,如果您希望它与您拥有的处理器数量相对应;

关于ubuntu - 如何确定工作进程的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21069915/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com