Computes the threshold for triggering an allocation.
Because the excessive workload value is EMA, even when the snapshot value of the excessive
workload is 1, the value never really gets to 1. So we need to introduce a notion of the margin M,
where we provision a new node if the EMA of the excessive workload goes beyond 1-M (where M is a small value
in the (0,1) range.)
M effectively controls how long Hudson waits until allocating a new node, in the face of workload.
This delay is justified for absorbing temporary ups and downs, and can be interpreted as Hudson
holding off provisioning in the hope that one of the existing nodes will become available.
M can be a constant value, but there's a benefit in adjusting M based on the total current capacity,
based on the above justification; that is, if there's no existing capacity at all, holding off
an allocation doesn't make much sense, as there won't be any executors available no matter how long we wait.
On the other hand, if we have a large number of existing executors, chances are good that some
of them become available — the chance gets better and better as the number of current total
capacity increases.
Therefore, we compute the threshold margin as follows:
M(t) = M* + (M0 - M*) alpha ^ t
... where:
- M* is the ultimate margin value that M(t) converges to with t->inf,
- M0 is the value of M(0), the initial value.
- alpha is the decay factor in (0,1). M(t) converges to M* faster if alpha is smaller.