![Gitlab 的 25 個 Sidekiq 進程](https://rvso.com/image/617812/Gitlab%20%E7%9A%84%2025%20%E5%80%8B%20Sidekiq%20%E9%80%B2%E7%A8%8B.png)
查看htop
伺服器上的輸出,我看到 Gitlab 產生了 25 個 sidekiq 進程。我私下使用 Gitlab,所以永遠不會有任何負載,所以我懷疑所有這些進程都是必需的,但我不知道如何配置它們的數量。
在資源受限的伺服器上,我真的有必要擔心這個問題嗎?
答案1
當然,請在這裡查看此線程:https://github.com/gitlabhq/gitlabhq/issues/2780
只需編輯 sidekiq config.yml,注意並發選項:https://github.com/mperham/sidekiq/blob/master/examples/config.yml
答案2
我編輯了 Sidekiq 啟動參數。在 GitLab <7.0.0 中,它位於下面,scripts/background_jobs
但在 >7.0.0 中,它位於下面bin/background_jobs
改變:
function start_sidekiq
{
bundle exec sidekiq -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1
}
到:
function start_sidekiq
{
bundle exec sidekiq -c 10 -q post_receive -q mailer -q system_hook -q project_web_hook -q gitlab_shell -q common -q default -e $RAILS_ENV -P $sidekiq_pidfile $@ >> $sidekiq_logfile 2>&1
}
注意-c 10
.將其更改為您想要的任何內容。
答案3
在 Debian 安裝的 9.3.0 版本中,我有/etc/gitlab/gitlab.rb
sidekiq 的設定行。
改變
# sidekiq['concurrency'] = 25
無論您認為合適的數字:
sidekiq['concurrency'] = 5
(我改變自己的原因是因為預設的 25 個進程佔用了大量內存,導致交換被使用,進而使 gitlab 變得非常慢。經過此更改後,我的性能提高了很多)
答案4
對我來說,去 就可以了/home/git/gitlab/config
。有一個sidekiq.yml.example
文件。我剛跑:
$ cd /home/git/gitlab/config
$ cp sidekiq.yml.example sidekiq.yml
使用vim sidekiq.yml
你會發現有一個:concurrency:
選項。將其設定為您希望的 sidekiq 進程數,儲存檔案並運行service gitlab restart
。
免責聲明:您的 GitLab 安裝資料夾的位置可能有所不同。對我來說是/home/git/gitlab