Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-27 18:06:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-27 18:06:16 +0300
commit8320f7956d72986f5a7c850874fce4f8b5a8e015 (patch)
treec761b309cfff422609d47a17ac4d6a732c142f49 /lib/gitlab/cluster
parent45482d5a2704da7fabe4ccf07f85d9be6e0a791a (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/cluster')
-rw-r--r--lib/gitlab/cluster/puma_worker_killer_initializer.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/gitlab/cluster/puma_worker_killer_initializer.rb b/lib/gitlab/cluster/puma_worker_killer_initializer.rb
index 4affc52b7b0..a8440b63baa 100644
--- a/lib/gitlab/cluster/puma_worker_killer_initializer.rb
+++ b/lib/gitlab/cluster/puma_worker_killer_initializer.rb
@@ -3,7 +3,7 @@
module Gitlab
module Cluster
class PumaWorkerKillerInitializer
- def self.start(puma_options, puma_per_worker_max_memory_mb: 650)
+ def self.start(puma_options, puma_per_worker_max_memory_mb: 850, puma_master_max_memory_mb: 550)
require 'puma_worker_killer'
PumaWorkerKiller.config do |config|
@@ -12,10 +12,9 @@ module Gitlab
# not each worker as is the case with GITLAB_UNICORN_MEMORY_MAX
worker_count = puma_options[:workers] || 1
# The Puma Worker Killer checks the total RAM used by both the master
- # and worker processes. Bump the limits to N+1 instead of N workers
- # to account for this:
+ # and worker processes.
# https://github.com/schneems/puma_worker_killer/blob/v0.1.0/lib/puma_worker_killer/puma_memory.rb#L57
- config.ram = (worker_count + 1) * puma_per_worker_max_memory_mb
+ config.ram = puma_master_max_memory_mb + (worker_count * puma_per_worker_max_memory_mb)
config.frequency = 20 # seconds
@@ -23,10 +22,9 @@ module Gitlab
# of available RAM.
config.percent_usage = 0.98
- # Ideally we'll never hit the maximum amount of memory. If so the worker
- # is restarted already, thus periodically restarting workers shouldn't be
- # needed.
- config.rolling_restart_frequency = false
+ # Ideally we'll never hit the maximum amount of memory. Restart the workers
+ # regularly rather than rely on OOM behavior for periodic restarting.
+ config.rolling_restart_frequency = 43200 # 12 hours in seconds.
observer = Gitlab::Cluster::PumaWorkerKillerObserver.new
config.pre_term = observer.callback