在 CentOS 上运行的 GitLab 出现卡顿,通常不是单一原因,而是资源、配置、存储、版本等多因素叠加。下面按最常见 → 较少见的顺序给你一个系统排查清单。
GitLab 非常吃资源,官方最低要求:
top
free -h
df -h
常见症状:
git 操作慢✅ 解决:
GitLab 默认开启:
ps aux | grep gitlab
✅ 如果是内部小团队:
# 关闭监控
gitlab-ctl stop prometheus
gitlab-ctl stop grafana
CentOS 上常见问题是 Puma 线程太多
vi /etc/gitlab/gitlab.rb
示例(8G 内存):
puma['worker_processes'] = 2
puma['threads_min'] = 4
puma['threads_max'] = 8
sidekiq['concurrency'] = 10
然后:
gitlab-ctl reconfigure
gitlab-ctl restart
GitLab:
iostat -x 1
✅ 常见问题:
/var/opt/gitlab 在慢盘✅ 解决:
getenforce
如果是 Enforcing:
setenforce 0
并修改:
vi /etc/selinux/config
SELINUX=permissive
systemctl status firewalld
✅ 建议:
systemctl stop firewalld
systemctl disable firewalld
✅ 建议:
gitlab-rake gitlab:env:info
✅ 建议:
✅ 解决:
git gc
git repack
或清理 CI artifacts
free -h
top
df -h
iostat -x 1
gitlab-ctl status
你可以直接告诉我:
我可以给你精确到参数的优化方案。