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

标签 ubuntu nginx

我正在关注在 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/

相关文章:

python - t-SNE 在不同的机器上产生不同的结果

c - 使用 g_rename 函数编译 GTK+ 应用程序时出错

c - 如何从 C 代码中找到 kernel.shmmax 的值

linux - Nginx无法打开certs文件夹中的cert.pem文件

Play Framework 中的 SSL 导致 'General SSLEngine prob.' (nginx)

python - “模块”对象不可调用(Python3)

mysql - 在 MySql 中插入 500 条简单的行,耗时超过 40 秒

javascript - 带有 Express.js 和 socket.io 的 NGINX |不能获取

docker - Nginx位置/日志未正确传递给Kibana,导致404

nginx - 如何在多服务器环境中使用服务器端观察者?