summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-03-17 11:56:11 +0100
committerGeorgios Andreadis <info@gandreadis.com>2020-03-17 11:56:11 +0100
commited5438692d74b04a2fc59bdb8e2b223129df8f67 (patch)
treeb23ab5a15c9241be1eb5a78eb76ea346f2417d43
parent1e95d668eb21eece59a402f500a9e38ec51af596 (diff)
Apply performance interference only to (on average) one VM
This matches more accurately how real deployments operate.
-rw-r--r--opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt
index 78d5cd82..e2032ff1 100644
--- a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt
+++ b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt
@@ -1,6 +1,7 @@
package com.atlarge.opendc.core.workload
import com.atlarge.opendc.core.resource.Resource
+import kotlin.random.Random
/**
* Meta-data key for the [PerformanceInterferenceModel] of an image.
@@ -24,10 +25,17 @@ data class PerformanceInterferenceModel(
if (intersectingItems.isEmpty()) {
return 1.0
}
- return intersectingItems
+ val score = intersectingItems
.filter { it.minServerLoad <= currentServerLoad }
.map { it.performanceScore }
- .min() ?: 1.0
+ .min()
+
+ // Apply performance penalty to (on average) only one of the VMs
+ return if (score != null && Random.nextInt(items.size) == 0) {
+ score
+ } else {
+ 1.0
+ }
}
}