From d01feec31a997d8d21195535734408b1ae4b8fc0 Mon Sep 17 00:00:00 2001 From: Qingyu Zhao Date: Wed, 4 Sep 2019 21:44:43 +1000 Subject: Add sidekiq_options memory_killer_memory_growth_kb --- app/workers/gitlab/github_import/stage/finish_import_worker.rb | 2 ++ app/workers/gitlab/github_import/stage/import_repository_worker.rb | 2 ++ app/workers/repository_import_worker.rb | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/app/workers/gitlab/github_import/stage/finish_import_worker.rb b/app/workers/gitlab/github_import/stage/finish_import_worker.rb index a779e631516..91ec2d9e779 100644 --- a/app/workers/gitlab/github_import/stage/finish_import_worker.rb +++ b/app/workers/gitlab/github_import/stage/finish_import_worker.rb @@ -8,6 +8,8 @@ module Gitlab include GithubImport::Queue include StageMethods + sidekiq_options memory_killer_memory_growth_kb: 50, memory_killer_max_memory_growth_kb: 200_000 + # project - An instance of Project. def import(_, project) project.after_import diff --git a/app/workers/gitlab/github_import/stage/import_repository_worker.rb b/app/workers/gitlab/github_import/stage/import_repository_worker.rb index 4d16cef1130..09ed41c437d 100644 --- a/app/workers/gitlab/github_import/stage/import_repository_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_repository_worker.rb @@ -8,6 +8,8 @@ module Gitlab include GithubImport::Queue include StageMethods + sidekiq_options memory_killer_memory_growth_kb: 50, memory_killer_max_memory_growth_kb: 300_000 + # client - An instance of Gitlab::GithubImport::Client. # project - An instance of Project. def import(client, project) diff --git a/app/workers/repository_import_worker.rb b/app/workers/repository_import_worker.rb index dff9c8f50bf..861ea5bf896 100644 --- a/app/workers/repository_import_worker.rb +++ b/app/workers/repository_import_worker.rb @@ -6,6 +6,12 @@ class RepositoryImportWorker include ProjectStartImport include ProjectImportOptions + # Whitelist this job from Gitlab::SidekiqDaemon::MemoryKiller + # [TODO] statistic the better value. Maybe staging server is a good test environment? + # The value 50 means: contribute 50K rss increase per second. This is estimated from: 15M RSS increase when import running for 300 seconds. + sidekiq_options memory_killer_memory_growth_kb: 50, memory_killer_max_memory_growth_kb: 300_000 + + def perform(project_id) @project = Project.find(project_id) -- cgit v1.2.1