从 GitLab 13.0
开始,Puma
是默认的应用程序服务器
. 计划在 GitLab 14.0
中删除对 Unicorn 的支持.
Puma 具有多线程体系结构,与像 Unicorn 这样的多进程应用程序服务器相比,它使用的内存更少. 在 GitLab.com 上,我们发现内存消耗减少了 40%.
大多数 Rails 应用程序请求通常都包含一定比例的 I / O 等待时间. 在 I / O 等待时间内,MRI Ruby 将释放 GVL(全局 VM 锁定)到其他线程. 因此,多线程 Puma 仍然可以处理比单个进程更多的请求.
环境:
CentOS 7.9
GitLab 13.10.3
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION # 查看版本
解决:
1.修改 puma.rb
配置
vim /var/opt/gitlab/gitlab-rails/etc/puma.rb
# Bind the server to "url". "tcp://", "unix://" and "ssl://" are the only
# accepted protocols.
bind 'unix:///var/opt/gitlab/gitlab-rails/sockets/gitlab.socket'
bind 'tcp://127.0.0.1:8092' ## 默认8080,修改为自己服务不冲突的端口,这里我改为8092
directory '/var/opt/gitlab/gitlab-rails/working'
workers 6
require_relative "/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/cluster/lifecycl