From e9a5234cd22289b8358aa8b1f833a81391e4802c Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 13 Apr 2020 17:24:45 +0200 Subject: refactor: Make total burst calculation more reliable --- .../com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'opendc') diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt index 730d49f5..73f9dd5c 100644 --- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt +++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt @@ -275,7 +275,7 @@ class SimpleVirtDriver( } // The total requested burst that the VMs wanted to run in the time-frame that we ran. - val totalRequestedSubBurst = min(totalRequestedBurst, ceil(totalRequestedUsage * duration).toLong()) + val totalRequestedSubBurst = requests.map { ceil((duration * 1000) / (it.vm.deadline - start) * it.burst).toLong() }.sum() val totalRemainder = burst.sum() val totalGrantedBurst = totalAllocatedBurst - totalRemainder @@ -307,7 +307,7 @@ class SimpleVirtDriver( totalInterferedBurst += grantedBurst - usedBurst // Compute remaining burst time to be executed for the request - req.burst = max(0, vm.burst[i] - grantedBurst) + req.burst = max(0, vm.burst[i] - usedBurst) vm.burst[i] = req.burst if (req.burst <= 0L || req.isCancelled) { @@ -449,7 +449,6 @@ class SimpleVirtDriver( override suspend fun run(burst: LongArray, limit: DoubleArray, deadline: Long) { require(burst.size == limit.size) { "Array dimensions do not match" } - this.deadline = deadline this.burst = burst val requests = cpus.asSequence() -- cgit v1.2.3 From 41813a71c0e91d40a356d2b00584196693358e48 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 13 Apr 2020 17:25:56 +0200 Subject: feat: Make workload identifiers deterministic --- .../format/environment/sc20/Sc20ClusterEnvironmentReader.kt | 3 ++- .../com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'opendc') diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt index 708e27bf..89a59e1c 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt @@ -59,6 +59,7 @@ class Sc20ClusterEnvironmentReader( var memoryPerHostCol = 0 var coresPerHostCol = 0 + var clusterIdx: Int = 0 var clusterId: String var speed: Double var numberOfHosts: Int @@ -99,7 +100,7 @@ class Sc20ClusterEnvironmentReader( nodes.add( SimpleBareMetalDriver( dom.newDomain("node-$clusterId-$it"), - UUID.randomUUID(), + UUID((clusterIdx++).toLong(), it.toLong()), "node-$clusterId-$it", mapOf(NODE_CLUSTER to clusterId), List(coresPerHost) { coreId -> diff --git a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt index 950d2630..c40cb039 100644 --- a/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt +++ b/opendc/opendc-format/src/main/kotlin/com/atlarge/opendc/format/trace/sc20/Sc20TraceReader.kt @@ -79,7 +79,7 @@ class Sc20TraceReader( } vms - .forEach { vmFile -> + .forEachIndexed { idx, vmFile -> println(vmFile) val flopsHistory = mutableListOf() var vmId = "" @@ -107,9 +107,8 @@ class Sc20TraceReader( if (flopsHistory.isEmpty()) { flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) } else { - if (flopsHistory.last().flops != flops) { - flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) - } else { + // Restrict merging to empty fragments for now + if (flopsHistory.last().flops == 0L && flops == 0L) { val oldFragment = flopsHistory.removeAt(flopsHistory.size - 1) flopsHistory.add( FlopsHistoryFragment( @@ -119,12 +118,14 @@ class Sc20TraceReader( cpuUsage, cores) ) + } else { + flopsHistory.add(FlopsHistoryFragment(timestamp, flops, traceInterval, cpuUsage, cores)) } } } } - val uuid = UUID.randomUUID() + val uuid = UUID(0, idx.toLong()) val relevantPerformanceInterferenceModelItems = PerformanceInterferenceModel( performanceInterferenceModel.items.filter { it.workloadNames.contains(vmId) }.toSet() -- cgit v1.2.3 From 5db71b206f6bb77d6bb77c5f58c299bc87d1414b Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 13 Apr 2020 17:28:06 +0200 Subject: bug: Remove failed vms from monitor --- .../src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'opendc') diff --git a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt index 245aa250..7e6398bb 100644 --- a/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt +++ b/opendc/opendc-experiments-sc20/src/main/kotlin/com/atlarge/opendc/experiments/sc20/Sc20Monitor.kt @@ -17,7 +17,7 @@ class Sc20Monitor( private val lastServerStates = mutableMapOf>() init { - outputFile.write("time,duration,requestedBurst,grantedBurst,overcommissionedBurst,interferedBurst,cpuUsage,cpuDemand,numberOfDeployedImages,server,hostState,hostUsage,powerDraw,failedVms\n") + outputFile.write("time,duration,requestedBurst,grantedBurst,overcommissionedBurst,interferedBurst,cpuUsage,cpuDemand,numberOfDeployedImages,server,hostState,hostUsage,powerDraw\n") } suspend fun onVmStateChanged(server: Server) {} -- cgit v1.2.3 From facf2a785ff7c7cd4f904b4b42af415bb85ea7a0 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Mon, 13 Apr 2020 17:28:22 +0200 Subject: bug: Restrict provisioning to 5 minute batches --- .../compute/virt/service/SimpleVirtProvisioningService.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'opendc') diff --git a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt index 2d467e92..6200ad7c 100644 --- a/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt +++ b/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt @@ -106,8 +106,14 @@ class SimpleVirtProvisioningService( return } + val quantum = 300000 // 5 minutes in milliseconds + // We assume that the provisioner runs at a fixed slot every time quantum (e.g t=0, t=60, t=120). + // This is important because the slices of the VMs need to be aligned. + // We calculate here the delay until the next scheduling slot. + val delay = quantum - (ctx.clock.millis() % quantum) + val call = launch { - delay(1) + delay(delay) this@SimpleVirtProvisioningService.call = null schedule() } @@ -148,6 +154,11 @@ class SimpleVirtProvisioningService( if (event.server.state == ServerState.SHUTOFF) { activeImages -= imageInstance selectedHv.provisionedCores -= server.flavor.cpuCount + + // Try to reschedule if needed + if (incomingImages.isNotEmpty()) { + requestCycle() + } } } } -- cgit v1.2.3