docker - Nginx 工作进程
问题描述
我正在使用 docker nginx 作为我在 docker 容器中扩展的后端 rails api 应用程序的反向代理。
在性能测试期间,我收到这样的错误:
4048 worker_connections are not enough
我发现我有一个默认值 worker_processes = 1。之后我将此值更改为 8(在 8 个 vCPU ubuntu 服务器上),但仍然出现此错误。
看着 htop 似乎其他工人在高负荷下无法工作......
这是我的 nginx.conf
user nginx;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 4048;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
解决方案
推荐阅读
- angular - 如何使用 rxjs 将 json 响应从一种对象类型映射到另一种对象类型
- postgresql - 如何从 Go 中的 Cloud Function 连接到 Cloud-SQL?
- c# - 我在哪里可以获得 iCalendar 规范 RFC 2445 版本 2.0 的 xml/xsd 架构?
- r - 如何创建一个函数,如果 R 版本早于 3.5,它会发出警告?
- azure-devops - 在自托管 Azure DevOps 代理上运行维护
- lotus-notes - 每次进行更改时,视图都会显示所有列表更新表单
- html - 如何使用来自同一字典的数据创建具有多列的表?
- python - 如何将值从 python 脚本发送到控制台并退出
- java - How to fix ''null value in column "id" violates not-null constraint''
- python - PyMC3 正态,每列有方差