Ubuntu下解决GitLab内存不足可尝试以下方法:
/etc/gitlab/gitlab.rb,减少Unicorn/Puma工作进程数(如 unicorn['worker_processes'] = 2)。sidekiq['concurrency'] = 5)。gitlab_rails['db_pool'] = 5)和共享缓冲区(如 postgresql['shared_buffers'] = "128MB")。sudo fallocate -l 4G /swapfile,然后启用并添加到 /etc/fstab)。vm.swappiness 值(如 sudo sysctl vm.swappiness=10,写入 /etc/sysctl.conf 永久生效)。redis['maxmemory'] = '1gb')。gitaly['cgroups_memory_limit'] = 1024*1024*1024)。htop 或 top 监控内存使用,确认调整后资源占用下降。sudo gitlab-ctl restart。注意:GitLab官方推荐最低4GB内存,若长期内存不足建议升级服务器配置。