diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-03-02 13:15:11 +0100 |
|---|---|---|
| committer | Georgios Andreadis <info@gandreadis.com> | 2020-03-04 17:51:55 +0100 |
| commit | 78417251806e079c998380a76ab3533de373289b (patch) | |
| tree | ec705d74131a40849c4beb39a074b62c334999ef /opendc/opendc-core/src | |
| parent | 185c0ab39225e1c6d45122626f90e79c2f2f3cc4 (diff) | |
[ci skip] Add performance interference model start
Diffstat (limited to 'opendc/opendc-core/src')
| -rw-r--r-- | opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt | 50 |
1 files changed, 50 insertions, 0 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 new file mode 100644 index 00000000..310b3a27 --- /dev/null +++ b/opendc/opendc-core/src/main/kotlin/com/atlarge/opendc/core/workload/PerformanceInterferenceModel.kt @@ -0,0 +1,50 @@ +package com.atlarge.opendc.core.workload + +import java.util.UUID + +/** + * 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> +) { + fun apply(colocatedWorkloads: Set<Workload>): Double { + val intersectingItems = items.filter { item -> + colocatedWorkloads.map { it.uid }.intersect(item.workloadIds).size > 1 + } + + if (intersectingItems.isEmpty()) { + return 1.0 + } + return intersectingItems.map { it.performanceScore }.min() ?: error("Minimum score must exist.") + } +} + +/** + * Model describing how a specific set of workloads causes performance variability for each workload. + * + * @param workloadIds The IDs of the workloads that together cause performance variability for each workload in the set. + * @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 workloadIds: Set<UUID>, + val performanceScore: Double +) { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as PerformanceInterferenceModelItem + + if (workloadIds != other.workloadIds) return false + + return true + } + + override fun hashCode(): Int { + return workloadIds.hashCode() + } +} |
