Netflix / Fenzo

Extensible Scheduler for Mesos Frameworks
698 stars 116 forks source link

BinPacking with weights #160

Open skonto opened 7 years ago

skonto commented 7 years ago

From a quick glance in this line https://github.com/Netflix/Fenzo/blob/5de0e0861def4a655be35a9624e67318a6c0afac/fenzo-core/src/main/java/com/netflix/fenzo/plugins/BinPackingFitnessCalculators.java#L146 every type of resource is considered equal. For example (0.9 + 0.1 + 0.1 )/3 ~= 0.36 and fitness being 0.64 . For me such a machine with high cpu utilization may be useless even if I only need one more cpu for subsequent tasks and leads to wasted resources. This can be true especially for machines with many GBs of RAM but few cpus. Instead of having that formula I think we should try normalize the different type of items in the bins or use some type of weights. Also another question is that bin packing optimizes the number of bins but how about load balancing. I might missing something here.

spodila commented 7 years ago

You are right in that the included bin packing fitness calculator is relatively simple in giving equal weights to the three resources. A different one can be composed with multiple individual calculators using custom weights. A variation of #123 could be constructed to take individual calculators along with associated weights.

In practice, such bin packing is one of the criteria. For example, we also include task type packing as a criteria, where we may prefer packing certain types of workloads together on the same host, or not. A recent change in our framework also introduces another criteria that prefers to decrease the number of concurrent launches on the same host, say, due to host related idiosyncrasies in concurrently starting several tasks.

Load balancing hosts by spreading the load is another criteria, as you mention. https://github.com/Netflix/Fenzo/blob/master/fenzo-core/src/main/java/com/netflix/fenzo/plugins/SpreadingFitnessCalculators.java attempts to achieve the spreading behavior. Also, https://github.com/Netflix/Fenzo/blob/master/fenzo-core/src/main/java/com/netflix/fenzo/plugins/BalancedHostAttrConstraint.java attempts to spread tasks of a given set across hosts, etc.

Fenzo's goal is to provide a way for framework writers to input the desired objective(s) via fitness calculator plugins. The bin packing plugins are provided as one set of examples.

skonto commented 7 years ago

Ok thanx. Multiple criteria I think are more appropriate for certain cases, for example I might want to use the least number of bins while my bins are also full. SpreadingFitnessCalculator uses the BinPack to decide whether to pick a host in order to avoid overloaded hosts while BinPack picks the host which can fill faster. In theory seems those criteria to be contradicting yet there are some results in literature for example "The load-balanced multi-dimensional bin-packing problem" paper but in this case which is on-line I am not sure what is applicable (not an expert in scheduling theory). Anyway... just some thoughts.