主机的CPU一直跑到100%怎么办?


(青草mc) #1

image

站点的主机经常无缘无故跑到100%
站点主机是2核2G的,访问人数不多,这种情况经常发生,很不正常。。。


(青草mc) #2


这个是当前进程…


(Schrödinger's Corgi) #3

青草你提供的信息不足,没办法帮你诊断, 因为硬件问题(比如内存不足CPU使用率就会高), 容器问题(docker bug discourse bug 或者其他)都有可能导致问题。

试着展示一些系统日志,比如:

cd /var/discourse
./launcher logs app

docker info

去官方论坛搜索相关关键字试试有没有与你情况相同的:

https://meta.discourse.org/search?q=cpu%20100

从目前你提供的信息只能帮你到这里了。:no_mouth:


(青草mc) #4
supervisor pid: 50 unicorn pid: 77
run-parts: executing /etc/runit/1.d/00-ensure-links
run-parts: executing /etc/runit/1.d/00-fix-var-logs
run-parts: executing /etc/runit/1.d/anacron
run-parts: executing /etc/runit/1.d/cleanup-pids
Cleaning stale PID files
run-parts: executing /etc/runit/1.d/copy-env
run-parts: executing /etc/runit/1.d/enable-brotli
Started runsvdir, PID is 34
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
rsyslogd: command 'KLogPermitNonKernelFacility' is currently not permitted - did you already set it via a RainerScript command (v6+ config)? [v8.16.0 try http://www.rsyslog.com/e/2222 ]
rsyslogd: imklog: cannot open kernel log (/proc/kmsg): Operation not permitted.
rsyslogd: activation of module imklog failed [v8.16.0 try http://www.rsyslog.com/e/2145 ]
ok: run: redis: (pid 45) 0s
rsyslogd: Could not open output pipe '/dev/xconsole':: No such file or directory [v8.16.0 try http://www.rsyslog.com/e/2039 ]
ok: run: postgres: (pid 49) 0s
supervisor pid: 54 unicorn pid: 67


看不出来什么啊… :cry:


(Schrödinger's Corgi) #5

这个日志写你没能打开日志,日志服务的相关操作没被允许,也就是说你没能提供正确的信息。

可以手动去这里查看你的系统日志:

/var/discourse/shared/standalone/log/var-log

以下是官帖的内容,不妨试试。

The issue there is that sidekiq our job processor is using high CPU.

Can you help determining if it is a scheduled job that is causing it.

Head to: sitename.com/sidekiq/scheduler, is there a job that is not finishing or taking really long? You can trigger it to see if it causes the issue.

Rebuild with RBTRACE=1 in env.

When sidekiq is eating 100% cpu run:

./launcher enter app
gem install rbtrace
rbtrace -p SIDEKIQ_PID --firehose

希望对你有帮助!


(青草mc) #6

umm


依旧看不出任何异常

顺便一提,问题总是在编辑帖子后出现的…


(Schrödinger's Corgi) #7

很遗憾没能帮到你,看到你已经弃坑了 :sweat_smile:


(青草mc) #8

其实我也不想弃坑,主要是discourse被我玩坏了,备份恢复不了 :cry:
discourse在同类开源软件中数一数二的,弃坑也是我最不想做出的决定 :cry: