Skip to content

Commit

Permalink
Job memory consumption evaluation refined
Browse files Browse the repository at this point in the history
  • Loading branch information
luav committed Jul 6, 2018
1 parent 8511f2a commit fc6dec8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mpepool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,15 +1024,15 @@ def _updateMem(self):
try:
up = psutil.Process(self.proc.pid)
pmem = up.memory_info()
# Note: take average of mem and rss to not over reserve RAM especially for Java apps
# Note: take weighted average of mem and rss to not over/under reserve RAM especially for Java apps
wrss = 0.85 # Weight of the rss: 0.5 .. 0.95
curmem = pmem.vms * (1 - wrss) + pmem.rss * wrss
if self.memkind:
amem = curmem # Memory consumption of the whole process tree
xmem = curmem # Memory consumption of the heaviest process in the tree
for ucp in up.children(recursive=True): # Note: fetches only children processes
pmem = ucp.memory_info()
mem = (pmem.vms + pmem.rss) / 2 # MB
mem = pmem.vms * (1 - wrss) + pmem.rss * wrss # MB
amem += mem
if xmem < mem:
xmem = mem
Expand Down

0 comments on commit fc6dec8

Please sign in to comment.