以下是CentOS中GitLab的内存优化技巧:
/etc/gitlab/gitlab.rb,减少unicorn['worker_processes'](建议设为CPU核心数+1,最低2)。sidekiq['concurrency'](默认25,可减至10-20)。gitlab_rails['db_pool'](默认50,可减至20-30)。gitlab_ci['enable'] = false。postgresql['shared_buffers'](建议256MB-1GB),max_worker_processes(默认8,可减至4-8)。redis['maxmemory'] = '2GB'。dd if=/dev/zero of=/swapfile bs=1M count=4096,并设置vm.swappiness=10。vm.swappiness(默认60,可减至10-30)。top、htop或vmstat,及时调整配置。注意:修改配置前需备份gitlab.rb,并通过gitlab-ctl reconfigure重启服务生效。生产环境建议先在测试环境验证。