diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-04-20 15:21:35 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2020-04-20 15:21:35 +0200 |
| commit | 6981d5581e2ce5c6df42dfbf133c350bd9c35a0f (patch) | |
| tree | 74e8993babb28dd56950f1da69eda2d97735a0e8 /opendc/opendc-core | |
| parent | 60372f0022d423efd5267ef4008d9afcbe870911 (diff) | |
| parent | 3e056406616860c77168d827f1ca9d8d3c79c08e (diff) | |
Merge branch 'bug/experiment-issues' into '2.x'
Address issues during experiments
See merge request opendc/opendc-simulator!61
Diffstat (limited to 'opendc/opendc-core')
| -rw-r--r-- | opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt | 83 |
1 files changed, 0 insertions, 83 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 deleted file mode 100644 index 04056394..00000000 --- a/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt +++ /dev/null @@ -1,83 +0,0 @@ -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. - */ -const val IMAGE_PERF_INTERFERENCE_MODEL = "image:performance-interference" - -/** - * Performance Interference Model describing the variability incurred by different sets of workloads if colocated. - * - * @param items The [PerformanceInterferenceModelItem]s that make up this model. - */ -data class PerformanceInterferenceModel( - val items: Set<PerformanceInterferenceModelItem>, - val random: Random = Random(0) -) { - private var intersectingItems: List<PerformanceInterferenceModelItem> = emptyList() - private var comparator = Comparator<PerformanceInterferenceModelItem> { lhs, rhs -> - var cmp = lhs.performanceScore.compareTo(rhs.performanceScore) - if (cmp != 0) { - return@Comparator cmp - } - - cmp = lhs.minServerLoad.compareTo(rhs.minServerLoad) - if (cmp != 0) { - return@Comparator cmp - } - - 0 - } - - fun computeIntersectingItems(colocatedWorkloads: Set<Resource>) { - val colocatedWorkloadIds = colocatedWorkloads.map { it.name } - intersectingItems = items.filter { item -> - colocatedWorkloadIds.intersect(item.workloadNames).size > 1 - }.sortedWith(comparator) - } - - fun apply(currentServerLoad: Double): Double { - if (intersectingItems.isEmpty()) { - return 1.0 - } - val score = intersectingItems - .firstOrNull { it.minServerLoad <= currentServerLoad } - - // Apply performance penalty to (on average) only one of the VMs - return if (score != null && random.nextInt(score.workloadNames.size) == 0) { - score.performanceScore - } else { - 1.0 - } - } -} - -/** - * Model describing how a specific set of workloads causes performance variability for each workload. - * - * @param workloadNames The names of the workloads that together cause performance variability for each workload in the set. - * @param minServerLoad The minimum total server load at which this interference is activated and noticeable. - * @param performanceScore The performance score that should be applied to each workload's performance. 1 means no - * influence, <1 means that performance degrades, and >1 means that performance improves. - */ -data class PerformanceInterferenceModelItem( - val workloadNames: Set<String>, - val minServerLoad: Double, - val performanceScore: Double -) { - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as PerformanceInterferenceModelItem - - if (workloadNames != other.workloadNames) return false - - return true - } - - override fun hashCode(): Int = workloadNames.hashCode() -} |
