From 9e5e830e15b74f040708e98c09ea41cd96d13871 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 27 May 2021 16:34:06 +0200 Subject: simulator: Centralize resource logic in SimResourceInterpreter This change introduces the SimResourceInterpreter which centralizes the logic for scheduling and interpreting the communication between resource consumer and provider. This approach offers better performance due to avoiding invalidating the state of the resource context when not necessary. Benchmarks show in the best case a 5x performance improvement and at worst a 2x improvement. --- .../main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'opendc-serverless/opendc-serverless-simulator/src') diff --git a/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt b/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt index b5516b4d..1871bb04 100644 --- a/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt +++ b/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt @@ -37,6 +37,7 @@ import org.opendc.simulator.compute.SimMachineModel import org.opendc.simulator.compute.cpufreq.PerformanceScalingGovernor import org.opendc.simulator.compute.cpufreq.SimpleScalingDriver import org.opendc.simulator.compute.power.ConstantPowerModel +import org.opendc.simulator.resources.SimResourceInterpreter import java.time.Clock import java.util.ArrayDeque import kotlin.coroutines.Continuation @@ -72,7 +73,7 @@ public class SimFunctionDeployer( /** * The machine that will execute the workloads. */ - public val machine: SimMachine = SimBareMetalMachine(scope.coroutineContext, clock, model, PerformanceScalingGovernor(), SimpleScalingDriver(ConstantPowerModel(0.0))) + public val machine: SimMachine = SimBareMetalMachine(SimResourceInterpreter(scope.coroutineContext, clock), model, PerformanceScalingGovernor(), SimpleScalingDriver(ConstantPowerModel(0.0))) /** * The job associated with the lifecycle of the instance. -- cgit v1.2.3 From 84468f4e3a331d7ea073ac7033b3d9937168ed9f Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 2 Jun 2021 23:23:55 +0200 Subject: simulator: Split CPUFreq subsystem in compute simulator This change splits the functionality present in the CPUFreq subsystem of the compute simulation. Currently, the DVFS functionality is embedded in SimBareMetalMachine. However, this functionality should not exist within the firmware layer of a machine. Instead, the operating system should perform this logic (in OpenDC this should be the hypervisor). Furthermore, this change moves the scaling driver into the power package. The power driver is a machine/firmware specific implementation that computes the power consumption of a machine. --- .../org/opendc/serverless/simulator/SimFunctionDeployer.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'opendc-serverless/opendc-serverless-simulator/src') diff --git a/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt b/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt index 1871bb04..32e5f75e 100644 --- a/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt +++ b/opendc-serverless/opendc-serverless-simulator/src/main/kotlin/org/opendc/serverless/simulator/SimFunctionDeployer.kt @@ -34,9 +34,8 @@ import org.opendc.serverless.simulator.workload.SimServerlessWorkloadMapper import org.opendc.simulator.compute.SimBareMetalMachine import org.opendc.simulator.compute.SimMachine import org.opendc.simulator.compute.SimMachineModel -import org.opendc.simulator.compute.cpufreq.PerformanceScalingGovernor -import org.opendc.simulator.compute.cpufreq.SimpleScalingDriver import org.opendc.simulator.compute.power.ConstantPowerModel +import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.resources.SimResourceInterpreter import java.time.Clock import java.util.ArrayDeque @@ -73,7 +72,11 @@ public class SimFunctionDeployer( /** * The machine that will execute the workloads. */ - public val machine: SimMachine = SimBareMetalMachine(SimResourceInterpreter(scope.coroutineContext, clock), model, PerformanceScalingGovernor(), SimpleScalingDriver(ConstantPowerModel(0.0))) + public val machine: SimMachine = SimBareMetalMachine( + SimResourceInterpreter(scope.coroutineContext, clock), + model, + SimplePowerDriver(ConstantPowerModel(0.0)) + ) /** * The job associated with the lifecycle of the instance. -- cgit v1.2.3