Nginx 网站反映慢,经常出现卡死

tang05709 · 2018年05月31日 · 最后由 steve 回复于 2018年06月02日 · 8449 次阅读

我的服务器同时部署啦 homeland 和 redmine,redmine 访问无压力,很快,但是 homenald 就经常卡死,配置 ubuntu16.04, 4 核 8gb,使用的是 nginx+passenger, 不要问我为什么用论坛做文章,我也很无奈。

[ N 2018-05-31 10:05:06.3541 4919/T7 age/Cor/CoreMain.cpp:616 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ N 2018-05-31 10:05:06.3543 4919/T1 age/Cor/CoreMain.cpp:1161 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ N 2018-05-31 10:05:06.3543 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 20897, application /jxredmine (production)
[ N 2018-05-31 10:05:06.3573 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 5310, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.3617 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 32529, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.3645 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 32553, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.3695 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 32725, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.3695 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 421, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.3773 4919/T7 Ser/Server.h:903 ]: [ServerThr.1] Freed 0 spare client objects
[ N 2018-05-31 10:05:06.3773 4919/T7 Ser/Server.h:559 ]: [ServerThr.1] Shutdown finished
[ N 2018-05-31 10:05:06.3774 4919/Tf Ser/Server.h:903 ]: [ApiServer] Freed 0 spare client objects
[ N 2018-05-31 10:05:06.3774 4919/Tf Ser/Server.h:559 ]: [ApiServer] Shutdown finished
[ N 2018-05-31 10:05:06.4396 4919/Td Ser/Server.h:903 ]: [ServerThr.4] Freed 0 spare client objects
[ N 2018-05-31 10:05:06.4396 4919/Td Ser/Server.h:559 ]: [ServerThr.4] Shutdown finished
[ N 2018-05-31 10:05:06.5251 4919/T9 Ser/Server.h:903 ]: [ServerThr.2] Freed 0 spare client objects
[ N 2018-05-31 10:05:06.5252 4919/T9 Ser/Server.h:559 ]: [ServerThr.2] Shutdown finished
[ N 2018-05-31 10:05:06.5462 4919/Tb Ser/Server.h:903 ]: [ServerThr.3] Freed 0 spare client objects
[ N 2018-05-31 10:05:06.5462 4919/Tb Ser/Server.h:559 ]: [ServerThr.3] Shutdown finished
[ N 2018-05-31 10:05:06.5463 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 20897, application //jxredmine (production)
[ N 2018-05-31 10:05:06.7471 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 5310, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.7472 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 32529, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.7472 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 32553, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.7473 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 32725, application /jxcatbbs (production)
[ N 2018-05-31 10:05:06.7473 4919/T1 age/Cor/CoreMain.cpp:1075 ]: Checking whether to disconnect long-running connections for process 421, application /jxcatbbs (production)
[ N 2018-05-31 10:05:07.1117 4919/T1 age/Cor/CoreMain.cpp:1234 ]: Passenger core shutdown finished
2018/05/31 10:05:07 [info] 1432#1432: Using 32768KiB of shared memory for nchan in /etc/nginx/nginx.conf:77
[ N 2018-05-31 10:05:07.4512 1438/T1 age/Wat/WatchdogMain.cpp:1258 ]: Starting Passenger watchdog...
[ N 2018-05-31 10:05:07.4760 1441/T1 age/Cor/CoreMain.cpp:1249 ]: Starting Passenger core...
[ N 2018-05-31 10:05:07.4762 1441/T1 age/Cor/CoreMain.cpp:252 ]: Passenger core running in multi-application mode.
[ N 2018-05-31 10:05:07.4897 1441/T1 age/Cor/CoreMain.cpp:984 ]: Passenger core online, PID 1441
App 1467 stdout:
[ N 2018-05-31 10:05:12.2656 1441/T5 age/Cor/SecurityUpdateChecker.h:517 ]: Security update check: no update found (next check in 24 hours)
App 1577 stdout:
App 1594 stdout:
App 1609 stdout:
App 1624 stdout:
App 1658 stdout:

nginx:

listen 443;
  server_name bbs.jxcat.com;
  ssl on;
  root xxx/public;

  passenger_enabled on;

  rails_env production;

  index index.html index.htm;

  location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    root xxx/public;
    # try_files $uri $uri/ =404;
  }

地址:bbs.jxcat.com

建议尝试 puma

passenger 怎么配置的

42thcoder 回复

passenger.conf

passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /usr/local/rvm/gems/ruby-2.4.2/wrappers/ruby;

nginx.conf

passenger_default_user xxx;
include /etc/nginx/passenger.conf;

卡死是怎么个卡死?描述更细致一些

我估计是 Action Cable 你没配置对,你可以试试把那个屏蔽了

huacnlee 回复

因为现在在上内容,大量上内容后,大概 20 篇左右就会卡住,内存占用居高不下

huacnlee 回复

我就是这样想的,如果还找不到解决方式,就直接吧 cable 屏蔽了

pathbox 回复

嗯,谢谢,再尝试下

并不慢,已经屏蔽 Action Cable 了?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号