Skip to content

Commit

Permalink
Save unique_set_size when saving process info
Browse files Browse the repository at this point in the history
Why?  USS is a more reliable mechanism for tracking workers with runaway
memory growth.  PSS is great, until the server process that forks new
processes grows large. As each new worker is forked, it inherits a share
of the large amount of the parent process' memory and therefore starts
with a large PSS, possibly exceeding our limits before doing any work.
USS only measures a process' private memory and is a better indicator
when a process is responsible for allocating too much memory without
freeing it.
  • Loading branch information
jrafanie committed Nov 30, 2017
1 parent 48846ec commit a60fbdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/miq_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MiqWorker < ApplicationRecord
STATUSES_STOPPED = [STATUS_STOPPED, STATUS_KILLED, STATUS_ABORTED]
STATUSES_CURRENT_OR_STARTING = STATUSES_CURRENT + STATUSES_STARTING
STATUSES_ALIVE = STATUSES_CURRENT_OR_STARTING + [STATUS_STOPPING]
PROCESS_INFO_FIELDS = %i(priority memory_usage percent_memory percent_cpu memory_size cpu_time proportional_set_size)
PROCESS_INFO_FIELDS = %i(priority memory_usage percent_memory percent_cpu memory_size cpu_time proportional_set_size unique_set_size)

PROCESS_TITLE_PREFIX = "MIQ:".freeze

Expand Down
4 changes: 3 additions & 1 deletion spec/models/miq_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ def check_has_required_role(worker_role_names, expected_result)
:cpu_time => 660,
:priority => "31",
:name => "ruby",
:proportional_set_size => 198_721_987
:proportional_set_size => 198_721_987,
:unique_set_size => 172_122_122
}

fields = described_class::PROCESS_INFO_FIELDS.dup
Expand All @@ -475,6 +476,7 @@ def check_has_required_role(worker_role_names, expected_result)
expect(@worker.public_send(field)).to be_present
end
expect(@worker.proportional_set_size).to eq 198_721_987
expect(@worker.unique_set_size).to eq 172_122_122
end
end
end
Expand Down

0 comments on commit a60fbdd

Please sign in to comment.