summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-10-16 17:24:19 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-10-16 17:24:19 +0200
commit6689925862f271e9ddfc6d328272b11b0959b57e (patch)
tree83445a212e0f10890a33164cffbf1fec04add6e8 /config-provisioning/src
parentc51b015a8dd8f9fc8f6c6f65c4ceab4090831df3 (diff)
Pick hosts for nodes to reduce resource allocation skew
Diffstat (limited to 'config-provisioning/src')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
index 4469eef98cf..5687697aff9 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeResources.java
@@ -11,9 +11,24 @@ import java.util.Objects;
public class NodeResources {
public enum DiskSpeed {
+
fast, // SSD disk or similar speed is needed
slow, // This is tuned to work with the speed of spinning disks
- any // The performance of the cluster using this does not depend on disk speed
+ any; // The performance of the cluster using this does not depend on disk speed
+
+ /**
+ * Compares disk speeds by cost: Slower is cheaper, and therefore before.
+ * Any can be slow and therefore costs the same as slow.
+ */
+ public static int compare(DiskSpeed a, DiskSpeed b) {
+ if (a == any) a = slow;
+ if (b == any) b = slow;
+
+ if (a == slow && b == fast) return -1;
+ if (a == fast && b == slow) return 1;
+ return 0;
+ }
+
}
private final double vcpu;