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 | |
| parent | 185c0ab39225e1c6d45122626f90e79c2f2f3cc4 (diff) | |
[ci skip] Add performance interference model start
6 files changed, 162 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() + } +} diff --git a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt index daa40193..7a67fc23 100644 --- a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt +++ b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/TestExperiment.kt @@ -34,6 +34,7 @@ import com.atlarge.opendc.compute.metal.service.ProvisioningService import com.atlarge.opendc.compute.virt.service.SimpleVirtProvisioningService import com.atlarge.opendc.compute.virt.service.allocation.AvailableMemoryAllocationPolicy import com.atlarge.opendc.format.environment.sc20.Sc20EnvironmentReader +import com.atlarge.opendc.format.trace.sc20.Sc20PerformanceInterferenceReader import com.atlarge.opendc.format.trace.vm.VmTraceReader import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.delay @@ -67,6 +68,10 @@ fun main(args: Array<String>) { val environment = Sc20EnvironmentReader(object {}.javaClass.getResourceAsStream("/env/setup-small.json")) .use { it.construct(root) } + val performanceInterferenceModel = Sc20PerformanceInterferenceReader( + object {}.javaClass.getResourceAsStream("/env/performance-interference.json") + ).construct() + println(simulationContext.clock.instant()) val scheduler = SimpleVirtProvisioningService( diff --git a/opendc/opendc-experiments-sc20/src/main/resources/env/performance-interference.json b/opendc/opendc-experiments-sc20/src/main/resources/env/performance-interference.json new file mode 100644 index 00000000..0d4f101c --- /dev/null +++ b/opendc/opendc-experiments-sc20/src/main/resources/env/performance-interference.json @@ -0,0 +1,2 @@ +[ +] diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt new file mode 100644 index 00000000..f9ebba3d --- /dev/null +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/PerformanceInterferenceModelReader.kt @@ -0,0 +1,38 @@ +/* + * MIT License + * + * Copyright (c) 2019 atlarge-research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.atlarge.opendc.format.trace + +import com.atlarge.opendc.core.workload.PerformanceInterferenceModel +import java.io.Closeable + +/** + * An interface for reading descriptions of performance interference models into memory. + */ +interface PerformanceInterferenceModelReader : Closeable { + /** + * Construct a [PerformanceInterferenceModel]. + */ + fun construct(): PerformanceInterferenceModel +} diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Model.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Model.kt new file mode 100644 index 00000000..1eeecb25 --- /dev/null +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Model.kt @@ -0,0 +1,6 @@ +package com.atlarge.opendc.format.trace.sc20 + +internal data class PerformanceInterferenceEntry( + val vms: List<String>, + val performanceScore: Double +) diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt new file mode 100644 index 00000000..b2d60bb9 --- /dev/null +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20PerformanceInterferenceReader.kt @@ -0,0 +1,61 @@ +/* + * MIT License + * + * Copyright (c) 2019 atlarge-research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.atlarge.opendc.format.trace.sc20 + +import com.atlarge.opendc.core.workload.PerformanceInterferenceModel +import com.atlarge.opendc.core.workload.PerformanceInterferenceModelItem +import com.atlarge.opendc.format.trace.PerformanceInterferenceModelReader +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import java.io.InputStream +import java.util.UUID + +/** + * A parser for the JSON performance interference setup files used for the SC20 paper. + * + * @param input The input stream to read from. + * @param mapper The Jackson object mapper to use. + */ +class Sc20PerformanceInterferenceReader(input: InputStream, mapper: ObjectMapper = jacksonObjectMapper()) : + PerformanceInterferenceModelReader { + /** + * The environment that was read from the file. + */ + private val performanceInterferenceModel: List<PerformanceInterferenceEntry> = mapper.readValue(input) + + override fun construct(): PerformanceInterferenceModel { + return PerformanceInterferenceModel( + performanceInterferenceModel.map { item -> + PerformanceInterferenceModelItem( + item.vms.map { name -> UUID(0L, name.toLong()) }.toSet(), + item.performanceScore + ) + }.toSet() + ) + } + + override fun close() {} +} |
