You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by kn...@apache.org on 2016/03/17 21:04:33 UTC

[5/8] storm git commit: adding code documentation explaining math of combining component resources.

adding code documentation explaining math of combining component resources.


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/5404023a
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/5404023a
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/5404023a

Branch: refs/heads/master
Commit: 5404023ae5372ac84d7f77a2bcc71015cd50d240
Parents: 178dd54
Author: Kyle Nusbaum <Ky...@gmail.com>
Authored: Wed Mar 16 15:52:38 2016 -0500
Committer: Kyle Nusbaum <Ky...@gmail.com>
Committed: Wed Mar 16 15:52:38 2016 -0500

----------------------------------------------------------------------
 .../jvm/org/apache/storm/trident/TridentTopology.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/5404023a/storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java b/storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java
index 6a4e92f..3aefdc5 100644
--- a/storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java
+++ b/storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java
@@ -473,6 +473,18 @@ public class TridentTopology {
         Number offHeap = res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB);
         Number cpuLoad = res.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT);
 
+        /* We take the max of the default and whatever the user put in here.
+           Each node's resources can be the sum of several operations, so the simplest
+           thing to do is get the max.
+
+           The situation we want to avoid is that the user sets low resources on one
+           node, and when that node is combined with a bunch of others, the sum is still
+           that low resource count. If any component isn't set, we want to use the default.
+
+           Right now, this code does not check that. It just takes the max of the summed
+           up resource counts for simplicity's sake. We could perform some more complicated
+           logic to be more accurate, but the benefits are very small, and only apply to some
+           very odd corner cases. */g
         if(onHeap == null) {
             onHeap = onHeapDefault;
         }