storm
storm copied to clipboard
make scheduling evenly distribute slots across all hosts
#359
Changed the way even schedule distribute slots into also considering the number of used slots across all hosts. Make sure the new assignment use slots evenly across all hosts.
Just change sort-slots works on out cluster. The code is bellow:
Index: src/clj/backtype/storm/scheduler/EvenScheduler.clj
===================================================================
--- src/clj/backtype/storm/scheduler/EvenScheduler.clj
+++ src/clj/backtype/storm/scheduler/EvenScheduler.clj
@@ -7,7 +7,12 @@
:implements [backtype.storm.scheduler.IScheduler]))
(defn sort-slots [all-slots]
- (let [split-up (vals (group-by first all-slots))]
+ (let [split-up
+ (map second
+ (reverse
+ (sort
+ (for [[host ports] (group-by first all-slots)]
+ [(count ports) ports]))))]
(apply interleave-all split-up)
))