summaryrefslogtreecommitdiff
path: root/opendc/opendc-compute/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-09 20:55:45 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-03-09 20:55:45 +0100
commit2dd2bfe87bcbe368f46ce8e975ccccbfac2c0560 (patch)
tree8880b748cb5918ee2523c6859c6e77f98b75076e /opendc/opendc-compute/src/main
parentfa7455ac6aaa1e0c34a4218c32423d544373e795 (diff)
parent0930e73c319ecd01ecdae47e15f077555c12db0c (diff)
Merge branch 'feat/2.x-perf-interference' into '2.x'
Implement a basic performance interference model Closes #50 See merge request opendc/opendc-simulator!33
Diffstat (limited to 'opendc/opendc-compute/src/main')
-rw-r--r--opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt
index 3f358516..6fe11c28 100644
--- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt
+++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/hypervisor/HypervisorVirtDriver.kt
@@ -26,9 +26,9 @@ package com.atlarge.opendc.compute.virt.driver.hypervisor
import com.atlarge.odcsim.SimulationContext
import com.atlarge.odcsim.simulationContext
-import com.atlarge.opendc.compute.core.Server
import com.atlarge.opendc.compute.core.Flavor
import com.atlarge.opendc.compute.core.ProcessingUnit
+import com.atlarge.opendc.compute.core.Server
import com.atlarge.opendc.compute.core.ServerState
import com.atlarge.opendc.compute.core.execution.ServerContext
import com.atlarge.opendc.compute.core.execution.ServerManagementContext
@@ -37,6 +37,8 @@ import com.atlarge.opendc.compute.core.monitor.ServerMonitor
import com.atlarge.opendc.compute.virt.driver.VirtDriver
import com.atlarge.opendc.compute.virt.driver.VirtDriverMonitor
import com.atlarge.opendc.compute.virt.monitor.HypervisorMonitor
+import com.atlarge.opendc.core.workload.IMAGE_PERF_INTERFERENCE_MODEL
+import com.atlarge.opendc.core.workload.PerformanceInterferenceModel
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
@@ -135,7 +137,13 @@ class HypervisorVirtDriver(
val burst = LongArray(hostContext.cpus.size)
+ val imagesRunning = vms.map { it.server.image }.toSet()
+
for (vm in vms) {
+ // Apply performance interference model
+ val performanceModel = vm.server.image.tags[IMAGE_PERF_INTERFERENCE_MODEL] as? PerformanceInterferenceModel?
+ val performanceScore = performanceModel?.apply(imagesRunning) ?: 1.0
+
for (i in 0 until min(vm.cpus.size, vm.requestedBurst.size)) {
val cpu = vm.cpus[i]
@@ -143,7 +151,7 @@ class HypervisorVirtDriver(
val actualUsage = min(vm.limit[i], cpu.frequency / vms.size)
val actualBurst = (duration * actualUsage * 1_000_000L).toLong()
- burst[i] += actualBurst
+ burst[i] += (performanceScore * actualBurst).toLong()
}
}