From a77829c7a8cf300a99a695423d85f905e0209286 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 15 Apr 2020 12:16:42 +0200 Subject: perf: Optimize performance interference --- .../core/workload/PerformanceInterferenceModel.kt | 83 ---------------------- 1 file changed, 83 deletions(-) delete mode 100644 opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt (limited to 'opendc/opendc-core/src') 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, - val random: Random = Random(0) -) { - private var intersectingItems: List = emptyList() - private var comparator = Comparator { 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) { - 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, - 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() -} -- cgit v1.2.3