最近gitlab一直CPU和内存使用居高不下,重启也没用,通过top命令,发现git的bundle进程有八个,每个CPU占用都百分之百,不知道是为什么,希望论坛大神指点一下
由于不能发图片,我把TOP复制出来
208 total, 12 running, 196 sleeping, 0 stopped, 0 zombie
%Cpu(s): 78.0 us, 13.3 sy, 0.0 ni, 8.2 id, 0.0 wa, 0.0 hi, 0.5 si, 0.0 st
KiB Mem : 16299368 total, 8559528 free, 6420072 used, 1319768 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 9560104 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
463 git 20 0 266556 81692 6868 R 98.7 0.5 0:04.96 bundle
31489 git 20 0 994860 625992 11888 R 98.7 3.8 0:42.72 bundle
32396 git 20 0 694824 334032 11844 R 98.3 2.0 0:18.69 bundle
32652 git 20 0 527236 189984 10636 R 98.3 1.2 0:11.82 bundle
32138 git 20 0 891432 467892 11852 R 97.3 2.9 0:25.69 bundle
31903 git 20 0 989736 567704 11876 S 94.4 3.5 0:31.40 bundle
672 git 20 0 183728 41360 5408 R 69.8 0.3 0:02.10 bundle
29713 git 20 0 553884 55036 5824 S 37.2 0.3 1:40.23 gitlab-exporter
30868 gitlab-+ 20 0 1177812 9172 3488 S 7.3 0.1 0:16.68 postgres
660 git 20 0 129400 21672 3608 S 6.6 0.1 0:00.20 ruby
32442 gitlab-+ 20 0 1178176 10420 3544 R 5.6 0.1 0:00.25 postgres
29897 gitlab-+ 20 0 3963996 194048 32420 S 1.3 1.2 0:17.30 prometheus
1890 root 20 0 947372 39780 15880 S 1.0 0.2 0:38.45 YDService
32656 gitlab-+ 20 0 1175708 8136 3532 S 1.0 0.0 0:00.08 postgres
14 root 20 0 0 0 0 S 0.7 0.0 0:09.74 ksoftirqd/1
39 root 20 0 0 0 0 S 0.7 0.0 0:08.99 ksoftirqd/6
44 root 20 0 0 0 0 S 0.7 0.0 0:08.80 ksoftirqd/7
467 gitlab-+ 20 0 1175708 7608 3492 S 0.7 0.0 0:00.04 postgres
29849 gitlab-+ 20 0 718420 17872 6228 S 0.7 0.1 0:01.22 node_exporter
6 root 20 0 0 0 0 R 0.3 0.0 0:08.48 ksoftirqd/0
9 root 20 0 0 0 0 R 0.3 0.0 0:07.29 rcu_sched
1536 root 20 0 4232 444 360 S 0.3 0.0 0:00.17 runsv
2752 root 20 0 113576 1780 1256 S 0.3 0.0 0:15.15 systemdd-libk
29716 git 20 0 2946400 70312 9360 S 0.3 0.4 0:02.70 ruby
30866 gitlab-+ 20 0 1176492 7704 3336 S 0.3 0.0 0:00.49 postgres
31372 root 20 0 160196 2392 1540 R 0.3 0.0 0:00.10 top
1 root 20 0 43380 3784 2556 S 0.0 0.0 0:02.08 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
4 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
5 root 20 0 0 0 0 S 0.0 0.0 0:00.07 kworker/u16:0
7 root rt 0 0 0 0 S 0.0 0.0 0:00.13 migration/0
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 lru-add-drain
13 root rt 0 0 0 0 S 0.0 0.0 0:00.17 migration/1
你好,你当前机器是什么配置?
2核8GB 的配置
bundle进程占用大量CPU,一般都是rails/puma组件上有大量的请求,可以查看这两个组件的日志,看有没有在大量刷新的请求日志。日志目录在/var/log/gitlab/gitlab-rails/
和/var/log/gitlab/puma
还可以切换到git用户,使用root用户只能看到bundle进程,使用git用户执行ps命令可以看到占用cpu和资源的实际进程名。
直接bundle会非常快的消耗服务器资源,比如用bundle import/export,如果是接口或者前端操作可能受组件影响,任务会失败,之前也遇到过,这种指令不建议直接在线上环境敲