Repository: storm Updated Branches: refs/heads/master 50c8f8360 -> 36c10f7ab
[STORM-1403] consider gc childopts in memory calculation for worker JVM Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/27d8b280 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/27d8b280 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/27d8b280 Branch: refs/heads/master Commit: 27d8b280eb2ee15d78e1f5c397c4fdb84d57dfc9 Parents: 418792f Author: zhuol <[email protected]> Authored: Fri Dec 18 13:13:39 2015 -0600 Committer: zhuol <[email protected]> Committed: Fri Dec 18 13:13:39 2015 -0600 ---------------------------------------------------------------------- .../jvm/backtype/storm/scheduler/Cluster.java | 27 ++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/27d8b280/storm-core/src/jvm/backtype/storm/scheduler/Cluster.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/scheduler/Cluster.java b/storm-core/src/jvm/backtype/storm/scheduler/Cluster.java index ff2b233..17e5e8e 100644 --- a/storm-core/src/jvm/backtype/storm/scheduler/Cluster.java +++ b/storm-core/src/jvm/backtype/storm/scheduler/Cluster.java @@ -480,6 +480,27 @@ public class Cluster { * */ private Double getAssignedMemoryForSlot(Map topConf) { Double totalWorkerMemory = 0.0; + final Integer TOPOLOGY_WORKER_DEFAULT_MEMORY_ALLOCATION = 768; + + String topologyWorkerGcChildopts = null; + if (topConf.get(Config.TOPOLOGY_WORKER_GC_CHILDOPTS) instanceof List) { + topologyWorkerGcChildopts = getStringFromStringList(topConf.get(Config.TOPOLOGY_WORKER_GC_CHILDOPTS)); + } else { + topologyWorkerGcChildopts = Utils.getString(topConf.get(Config.TOPOLOGY_WORKER_GC_CHILDOPTS), null); + } + + String workerGcChildopts = null; + if (topConf.get(Config.WORKER_GC_CHILDOPTS) instanceof List) { + workerGcChildopts = getStringFromStringList(topConf.get(Config.WORKER_GC_CHILDOPTS)); + } else { + workerGcChildopts = Utils.getString(topConf.get(Config.WORKER_GC_CHILDOPTS), null); + } + + Double memGcChildopts = null; + memGcChildopts = Utils.parseJvmHeapMemByChildOpts(topologyWorkerGcChildopts, null); + if (memGcChildopts == null) { + memGcChildopts = Utils.parseJvmHeapMemByChildOpts(workerGcChildopts, null); + } String topologyWorkerChildopts = null; if (topConf.get(Config.TOPOLOGY_WORKER_CHILDOPTS) instanceof List) { @@ -497,12 +518,14 @@ public class Cluster { } Double memWorkerChildopts = Utils.parseJvmHeapMemByChildOpts(workerChildopts, null); - if (memTopologyWorkerChildopts != null) { + if (memGcChildopts != null) { + totalWorkerMemory += memGcChildopts; + } else if (memTopologyWorkerChildopts != null) { totalWorkerMemory += memTopologyWorkerChildopts; } else if (memWorkerChildopts != null) { totalWorkerMemory += memWorkerChildopts; } else { - totalWorkerMemory += Utils.getInt(topConf.get(Config.WORKER_HEAP_MEMORY_MB)); + totalWorkerMemory += Utils.getInt(topConf.get(Config.WORKER_HEAP_MEMORY_MB), TOPOLOGY_WORKER_DEFAULT_MEMORY_ALLOCATION); } String topoWorkerLwChildopts = null;
