Gitlab在初始页面加载时超时/缓慢



我使用存储库中的包在Debian上运行Gitlab。大多数情况下,Gitlab运行速度非常快,但在较长的空闲时间后,Gitlab运行速度非常慢,甚至超时(错误502)。有一次,我在远程git访问上也出现了超时(无法在内部API上重现问题-超时)。

在我的设置中,Debian机器位于另一个nginx代理后面,该代理也可以提供一些其他服务。我做了gitlabcli检查,一切似乎都很好。

在我的反向代理的错误日志中,我只看到连接超时:

[error] 8643#0: *4139 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 10.1.1.10, server: gitlab.mydomain.tld, request: "GET / HTTP/1.1", upstream: "http://{SERVER-IP}:80/", host: "gitlab.mydomain.tld"

我可以在我的unicorn_stderr.log 中看到一些错误

E, [2016-03-30T19:40:20.183991 #783] ERROR -- : worker=1 PID:16798 timeout (61s > 60s), killing
E, [2016-03-30T19:40:20.194969 #783] ERROR -- : reaped #<Process::Status: pid 16798 SIGKILL (signal 9)> worker=1
I, [2016-03-30T19:40:20.197554 #16871]  INFO -- : worker=1 spawned pid=16871
I, [2016-03-30T19:40:20.197909 #16871]  INFO -- : worker=1 ready
E, [2016-03-30T20:08:42.911429 #783] ERROR -- : worker=0 PID:16866 timeout (61s > 60s), killing
E, [2016-03-30T20:08:43.191151 #783] ERROR -- : reaped #<Process::Status: pid 16866 SIGKILL (signal 9)> worker=0
I, [2016-03-30T20:08:43.758363 #18728]  INFO -- : worker=0 spawned pid=18728
I, [2016-03-30T20:08:44.108244 #18728]  INFO -- : worker=0 ready

我有点好奇的是,gitlab交付的nginx的日志中没有错误。

更多系统信息:

#sudo gitlab-rake gitlab:env:info
System information
System:         Debian 8.3
Current User:   git
Using RVM:      no
Ruby Version:   2.1.8p440
Gem Version:    2.5.1
Bundler Version:1.10.6
Rake Version:   10.5.0
Sidekiq Version:4.0.1
GitLab information
Version:        8.5.0
Revision:       a513e09
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     postgresql
URL:            http://gitlab.mydomain.tld
HTTP Clone URL: http://gitlab.mydomain.tld/some-group/some-project.git
SSH Clone URL:  git@gitlab.mydomain.tld:some-group/some-project.git
Using LDAP:     no
Using Omniauth: no
GitLab Shell
Version:        2.6.10
Repositories:   /var/opt/gitlab/git-data/repositories
Hooks:          /opt/gitlab/embedded/service/gitlab-shell/hooks/
Git:            /opt/gitlab/embedded/bin/git

编辑:

我在"外部"反向代理上的nginx配置如下:

server {
        listen  443;
        ssl     on;
        server_name gitlab.mydomain.tld;
        access_log  /var/log/nginx/gitlab.mydomain.tld.access.log;
        error_log   /var/log/nginx/gitlab.mydomain.tld.error.log;
        ssl_certificate         /etc/nginx/ssl/gitlab.mydomain.tld_unified.crt;
        ssl_certificate_key     /etc/nginx/ssl/mydomain.tld.key;
        location / {
                proxy_pass http://gitlab:80;
                proxy_redirect default;
                proxy_set_header        Host    $http_host;
                proxy_set_header        X_FORWARDED_PROTO "https";
                satisfy any;
        }
}

第2版:

我考虑了建议的答案,也考虑了这个来源:https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/requirements.md

我现在为虚拟机分配了2GB的RAM,还添加了一个额外的独角兽工作者。

第3版:

这个问题似乎可以通过添加更多内存和使用3个独角兽工人来解决。

Jan,

我有一个类似的设置,尽管我们的盒子是专门为GITlab。在不知道服务器规格(GITLAB喜欢内存)和盒子上的负载的情况下,我建议进行以下诊断:

  1. 您的上游nginx是否使用与gitlab nginx配置相同的参数?他们调整了很多事情,包括暂停
  2. 什么样的请求会导致超时?某些操作(如生成diff)可能需要一些时间才能进行渲染
  3. 如果您通过SSH运行请求,您是否也会经历超时
  4. 你在/var/log中检查全局日志了吗

仅供参考:我不得不扩大我的小型GitLab安装,以拥有4GB RAM,以免引发OOM错误

现在我想,我最好选择眼镜或其他选择。

最新更新