diff --git a/constants/constants.go b/constants/constants.go index d8dcd9f..1cc97cf 100644 --- a/constants/constants.go +++ b/constants/constants.go @@ -24,9 +24,11 @@ var PowerClasses = map[string]map[string]bool{ }, "B": map[string]bool{ "stratos-007.cs.binghamton.edu": true, - "stratos-008.cs.binghamton.edu": true, }, "C": map[string]bool{ + "stratos-008.cs.binghamton.edu": true, + }, + "D": map[string]bool { "stratos-001.cs.binghamton.edu": true, "stratos-002.cs.binghamton.edu": true, "stratos-003.cs.binghamton.edu": true, diff --git a/schedulers/bottomHeavy.go b/schedulers/bottomHeavy.go index 4f9f15b..e1b5567 100644 --- a/schedulers/bottomHeavy.go +++ b/schedulers/bottomHeavy.go @@ -19,7 +19,7 @@ import ( /* Tasks are categorized into small and large tasks based on the watts requirement. -All the small tasks are packed into offers from agents belonging to power class C, using BinPacking. +All the small tasks are packed into offers from agents belonging to power class C and power class D, using BinPacking. All the large tasks are spread among the offers from agents belonging to power class A and power class B, using FirstFit. BinPacking has the most effect when co-scheduling of tasks is increased. Large tasks typically utilize more resources and hence, @@ -275,11 +275,11 @@ func (s *BottomHeavy) ResourceOffers(driver sched.SchedulerDriver, offers []*mes log.Printf("Received %d resource offers", len(offers)) // We need to separate the offers into - // offers from ClassA and ClassB and offers from ClassC. + // offers from ClassA and ClassB and offers from ClassC and ClassD. // Nodes in ClassA and ClassB will be packed with the large tasks. - // Small tasks will be spread out among the nodes in ClassC. - offersClassAB := []*mesos.Offer{} - offersClassC := []*mesos.Offer{} + // Small tasks will be spread out among the nodes in ClassC and ClassD. + offersHeavyPowerClasses := []*mesos.Offer{} + offersLightPowerClasses := []*mesos.Offer{} for _, offer := range offers { select { @@ -294,25 +294,26 @@ func (s *BottomHeavy) ResourceOffers(driver sched.SchedulerDriver, offers []*mes if constants.PowerClasses["A"][*offer.Hostname] || constants.PowerClasses["B"][*offer.Hostname] { - offersClassAB = append(offersClassAB, offer) - } else if constants.PowerClasses["C"][*offer.Hostname] { - offersClassC = append(offersClassC, offer) + offersHeavyPowerClasses = append(offersHeavyPowerClasses, offer) + } else if constants.PowerClasses["C"][*offer.Hostname] || + constants.PowerClasses["D"][*offer.Hostname] { + offersLightPowerClasses = append(offersLightPowerClasses, offer) } } log.Println("Packing Large tasks into ClassAB offers:") - for _, o := range offersClassAB { + for _, o := range offersHeavyPowerClasses { log.Println(*o.Hostname) } - // Packing tasks into offersClassAB - s.pack(offersClassAB, driver) + // Packing tasks into offersHeavyPowerClasses + s.pack(offersHeavyPowerClasses, driver) - log.Println("Spreading Small tasks among ClassC offers:") - for _, o := range offersClassC { + log.Println("Spreading Small tasks among ClassCD offers:") + for _, o := range offersLightPowerClasses { log.Println(*o.Hostname) } - // Spreading tasks among offersClassC - s.spread(offersClassC, driver) + // Spreading tasks among offersLightPowerClasses + s.spread(offersLightPowerClasses, driver) } func (s *BottomHeavy) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) { diff --git a/schedulers/topHeavy.go b/schedulers/topHeavy.go index da03f37..63c11e0 100644 --- a/schedulers/topHeavy.go +++ b/schedulers/topHeavy.go @@ -20,7 +20,7 @@ import ( /* Tasks are categorized into small and large tasks based on the watts requirement. All the large tasks are packed into offers from agents belonging to power class A and power class B, using BinPacking. -All the small tasks are spread among the offers from agents belonging to power class C, using FirstFit. +All the small tasks are spread among the offers from agents belonging to power class C and power class D, using FirstFit. This was done to give a little more room for the large tasks (power intensive) for execution and reduce the possibility of starvation of power intensive tasks. @@ -274,11 +274,11 @@ func (s *TopHeavy) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos. log.Printf("Received %d resource offers", len(offers)) // We need to separate the offers into - // offers from ClassA and ClassB and offers from ClassC. + // offers from ClassA and ClassB and offers from ClassC and ClassD. // Offers from ClassA and ClassB would execute the large tasks. - // Offers from ClassC would execute the small tasks. - offersClassAB := []*mesos.Offer{} - offersClassC := []*mesos.Offer{} + // Offers from ClassC and ClassD would execute the small tasks. + offersHeavyPowerClasses := []*mesos.Offer{} + offersLightPowerClasses := []*mesos.Offer{} for _, offer := range offers { select { @@ -293,25 +293,26 @@ func (s *TopHeavy) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos. if constants.PowerClasses["A"][*offer.Hostname] || constants.PowerClasses["B"][*offer.Hostname] { - offersClassAB = append(offersClassAB, offer) - } else if constants.PowerClasses["C"][*offer.Hostname] { - offersClassC = append(offersClassC, offer) + offersHeavyPowerClasses = append(offersHeavyPowerClasses, offer) + } else if constants.PowerClasses["C"][*offer.Hostname] || + constants.PowerClasses["D"][*offer.Hostname] { + offersLightPowerClasses = append(offersLightPowerClasses, offer) } } - log.Println("ClassAB Offers:") - for _, o := range offersClassAB { + log.Println("Spreading Large tasks into ClassAB Offers:") + for _, o := range offersHeavyPowerClasses { log.Println(*o.Hostname) } - log.Println("ClassC Offers:") - for _, o := range offersClassC { + log.Println("Packing Small tasks into ClassCD Offers:") + for _, o := range offersLightPowerClasses { log.Println(*o.Hostname) } - // Packing tasks into offersClassC - s.pack(offersClassC, driver) - // Spreading tasks among offersClassAB - s.spread(offersClassAB, driver) + // Packing tasks into offersLightPowerClasses + s.pack(offersLightPowerClasses, driver) + // Spreading tasks among offersHeavyPowerClasses + s.spread(offersHeavyPowerClasses, driver) } func (s *TopHeavy) StatusUpdate(driver sched.SchedulerDriver, status *mesos.TaskStatus) {