storm icon indicating copy to clipboard operation
storm copied to clipboard

use fixed point math for Offer resource calculations

Open erikdw opened this issue 8 years ago • 0 comments

Problem Description

During testing of PR #154 we noticed that the floating point math done in the AggregatedOffers logic can lead to incorrectly accounting for the resources used. e.g., with CPUs available being 4.1 and then having a worker need 1.1 CPUs, the subtraction lead to the CPUs being 2.9999999999999996 instead of 3.0 as expected. [1]

Effect?

The effect of this will be a failure to squeeze every bit of resources out of a set of Offers.

Implementation Options

Switch from Double/double to one of these fixed-point implementations:

  1. BigDecimal
  2. decimal4j (supposedly more performant than BigDecimal, although I'm not sure that's a concern for us)

Appendix

[1] Specifically, this value is the "bad" one: CreateMesosWorkerSlot()'s aggregatedOffers.availableResources[0].value.totalAvailableResource.

erikdw avatar Jul 21 '16 21:07 erikdw