Subru Krishnan Thanks for the review, I will start addressing it right away. Few comments answers:
Regarding "Use Math.round instead of (int) Math.ceil in splitIndividualAny." I don't think we can, as this might lead to less than what the user asked, e.g., I have 3 subclusters with equal weights/load and you ask for 1 container anywhere... I will end up rounding down the 0.333 containers for each subclusters and give you zero containers back.
testStressTest was mostly to measure how much it takes to run a large number of big allocations. Do you think we should measure time and assert it should be < X? (Seems bad, though the timing information are generally useful as we develop/evolve this). I guess as it stands it only checks that large/many allocations don't end up throwing off anything. I am unsure about this.
Re: thread safety I am assuming that, though we should validate it carefully...
I am happy to walk over the getHeadroomWeighting stuff with you... I am also mostly convinced is correct, but must be validated well.