diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-06-24 00:07:29 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2020-06-24 00:07:29 +0200 |
commit | 0f6d45fddc44506857a285637099e49f53b67913 (patch) | |
tree | 3c829979d5b6b23445ba16b06ca39bff110fedae /node-repository/src/main | |
parent | 236161f1716c7c695ba407746191e3d072e160ca (diff) |
Prefer hosts at least twice the size of the node
Diffstat (limited to 'node-repository/src/main')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/PrioritizableNode.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/PrioritizableNode.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/PrioritizableNode.java index 0c1b396c40c..8633c1ca325 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/PrioritizableNode.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/PrioritizableNode.java @@ -103,6 +103,11 @@ class PrioritizableNode implements Comparable<PrioritizableNode> { other.parent.get().flavor().resources().storageType()); if (storageCostDifference != 0) return storageCostDifference; + + // Prefer hosts that are at least twice the size of this node + // (utilization is more even if one application does not dominate the host) + if ( lessThanHalfTheHost(this) && ! lessThanHalfTheHost(other)) return -1; + if ( ! lessThanHalfTheHost(this) && lessThanHalfTheHost(other)) return 1; } int hostPriority = Double.compare(this.skewWithThis() - this.skewWithoutThis(), @@ -128,6 +133,15 @@ class PrioritizableNode implements Comparable<PrioritizableNode> { /** Returns the allocation skew of the parent of this after adding this node to it */ double skewWithThis() { return skewWith(node.resources()); } + private boolean lessThanHalfTheHost(PrioritizableNode node) { + var n = node.node.resources(); + var h = node.parent.get().resources(); + if (h.vcpu() < n.vcpu() * 2) return false; + if (h.memoryGb() < n.memoryGb() * 2) return false; + if (h.diskGb() < n.diskGb() * 2) return false; + return true; + } + private double skewWith(NodeResources resources) { if (parent.isEmpty()) return 0; |