1. 问题现象
nginx运行过程中,发现无法访问nginx(导致nagios监控告警) ,且error日志中一直报如下错误
2011/05/10 16:31:07 [alert] 24082#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:07 [alert] 24082#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:07 [alert] 24085#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:07 [alert] 24082#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:07 [alert] 24085#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:08 [alert] 24082#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:08 [alert] 24082#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:08 [alert] 24085#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
2011/05/10 16:31:08 [alert] 24082#0: 1024 worker_connections is not enough while accepting new connection on 0.0.0.0:81
|
2.初步原因分析
目前nginx 中worker_connections 值设置是1024,worker_processes 值设置是4,按反向代理模式下最大连接数的理论计算公式:
最大连接数 = worker_processes * worker_connections/4
算出目前每台nginx理论上只支持1024个。但观察NGINX 历史性能数据,发现活动连接数经常是大于1024,并且最高达到5000左右,因而有时会导致连接数不够,直到NGINX无法再处理新的连接请求。
3.解决办法
查看相关资料,生产环境中worker_connections 建议值最好超过9000,计划将一台nginx 设置为10240,再观察一段时间。
分享到:
相关推荐
最近一次安全培训,需要用到安全攻防平台,结果30几个人登录上去直接爆出500错误。不知道什么原因,后来找来SSH登录用户,密码,逐步排查,发现了Nginx... 您可能感兴趣的文章:Nginx中worker connections问题的解决方法
在此记录下Nginx服务器nginx.conf的配置文件说明, 部分注释收集与网络. #运行用户 user www-data; #启动进程,通常设置成和cpu的数量相等 worker_processes 1; #全局错误日志及PID文件 error_log /var/log/...
主要介绍了Nginx中worker connections问题的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
nginx 并发数问题思考:worker_connections,worker_processes与 max clients 如何在工作中提高Ngixn服务器性能?达到高效 并发 = 同步/异步/阻塞/非阻塞/进程/线程 The Complete NGINX Cookbook 如何改进 NGINX ...
ngx_python 是为 nginx 嵌入 python 脚本的模块。环境- python 2.7.*- nginx-1.6.3 安装```sh git clone https://github.com/rryqszq4/ngx_python.git wget 'http://nginx.org/download/nginx-1.6.3.tar.gz' ...
Nginx的 设置具有配置域名的nginx服务HTTPS。 要求 基于apt的软件包管理器和systemd 角色变量 角色变量 默认 描述 nginx_install_full_package ... nginx_worker_connections 768 nginx_sendfile on
Nginx配置多个service 多个访问路径 找到conf/nginx.conf修改配置文件 #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid ...
2、节点有user、worker_processes、error_log、pid、worker_rlimit_nofile、worker_connections、multi_accept、use、include、default_type、client_header_buffer_size、upstream、proxy_pass、proxy_set_header等...
worker_connections 1024; } http { include mime.types; default_type application/octet-stream; fastcgi_intercept_errors on; sendfile on; #设置长连接 keepalive_timeout 65; #配置共享会话缓存...
我下载的niginx版本是nginx-1.5.12 主要配置是在:D:\nginx-1.5.12\conf目录下的nginx.conf文件做配置 代码如下: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log ...
worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $...
ngx_sqlite 是嵌入 sqlite 数据库的 nginx 模块。通过强大的nginx server,可以使用http协议访问sqlite数据库。环境- sqlite 3- nginx-1.6.3 安装```sh $ git clone https://github.com/rryqszq4/ngx_sqlite.git...
#epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能 worker_connections 1024;#单个后台worker process进程的最大并发链接数 # multi_accept on; } #设定...
Ansible 角色:Nginx ... nginx_worker_connections: 1024 您可以在剧本中覆盖这些值。 可选的: nginx_sites(模板列表) 依赖关系 tcosta84.yum 示例手册 - hosts: servers roles: - { role: tcosta84.
nginx_response_codes #开发中; 不使用! 来自 nginx 服务器的响应代码的指标!... worker_connections 1024 ; } http { response_codes on; server { root /www/data; location / { } } }
worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_...
Alireza Zabihi基于Centos 7.6上的Alex Gluck解决方案对Zabbix 4 LTS Nginx进行监控 连接统计: 积极的 读 等待 写作 要求亲连接 请求统计信息: 公认 已处理 全部的 Linux和Nginx性能监控: 文件描述符(最大和...
Nginx限制访问模块一个基于Nginx访问模块的模块,用于使用远程主机的主机名来限制对服务器/位置的访问。 该模块不随Nginx源一起分发。 请参阅。配置一个例子: pid logs/nginx.pid;error_log logs/nginx-main_error....