-
Klaus Aehlig authored
The test is testing for a property that just isn't true. Iterated allocation greedily place one instance at a time taking the locally most balanced solution. Then it is tested whether the resulting global allocation can be improved. To see that this assumption does not hold, consider placing 3 identical instances on 3 nodes. The most balanced allocation of all 3 instances would be that each node is primary and secondary for one instance. Now let's see what iterative allocation does. Up to symmetry, the placing of the first instance is unique. Any placement of the second instance that keeps the way to the global optimum open would be one node being primary and secondary for one instance each, one node being only secondary for instance, and one node being only primary for one instance. An alternative allocation would be to place the instances on two different nodes as primaries and using the third node as shared secondary. For cpu (2 nodes with 1 cpu, 1 with none), free memory (on two nodes all minus 1 unit, on one node all), and disk (2 nodes with 1 disk, 1 with 2) there is no difference between these allocations. For reserved memory, there's a difference in the values. In the first case, on two nodes, there's one unit reserved and nothing on the third. In the second case, on two nodes, there is nothing reserved, while on the third node, there still is only one unit reserved, as the two instances have different primaries. Nevertheless, the standard deviations of 0,0,1 and 1,1,0 are both sqrt(5/9); so, in everything that contributes to the balancedness metric these allocations are equal. Therefore, it is locally correct to chose the wrong allocation. Signed-off-by: Klaus Aehlig <aehlig@google.com> Reviewed-by: Thomas Thrainer <thomasth@google.com>
f4d1bb75