Killing multiple workers on each iteration of reaper, if needed #104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current
reap()
method picks only one singlepuma
worker and terminates that to free memory. However, in many cases, this would not be sufficient to bring thetotal
memory to undermax_ram
. And then the system would have to wait for the subsequent cycles for this to happen.This is not very optimal. In this proposed change, in each cycle, enough workers will be selected and terminated until the total consumed memory by
puma
is below the desired threshold.The log outputs have slightly changed to indicate this. Example: