modification on reading settings from config file
1- simulation scenarios are defined in config file instead of static enumarations 2- defining multiple edge orchestrator policy in config file support is added
This commit is contained in:
parent
19c4b9de40
commit
81fed10dd0
@ -17,7 +17,11 @@ gsm_bandwidth=10
|
|||||||
|
|
||||||
mips_for_cloud=20000
|
mips_for_cloud=20000
|
||||||
|
|
||||||
task_provisioning=NEXT_FIT
|
#use ',' for multiple values
|
||||||
|
orchestrator_policies=NEXT_FIT
|
||||||
|
|
||||||
|
#use ',' for multiple values
|
||||||
|
simulation_scenarios=SINGLE_TIER,TWO_TIER,TWO_TIER_WITH_EO
|
||||||
|
|
||||||
attractiveness_L1_mean_waiting_time=60
|
attractiveness_L1_mean_waiting_time=60
|
||||||
attractiveness_L2_mean_waiting_time=30
|
attractiveness_L2_mean_waiting_time=30
|
||||||
|
@ -47,7 +47,7 @@ public class SimManager extends SimEntity {
|
|||||||
|
|
||||||
private static SimManager instance = null;
|
private static SimManager instance = null;
|
||||||
|
|
||||||
public SimManager(ScenarioFactory _scenarioFactory, int _numOfMobileDevice, SimSettings.SCENARIO_TYPES _simScenario) throws Exception {
|
public SimManager(ScenarioFactory _scenarioFactory, int _numOfMobileDevice, String _simScenario) throws Exception {
|
||||||
super("SimManager");
|
super("SimManager");
|
||||||
scenarioFactory = _scenarioFactory;
|
scenarioFactory = _scenarioFactory;
|
||||||
numOfMobileDevice = _numOfMobileDevice;
|
numOfMobileDevice = _numOfMobileDevice;
|
||||||
|
@ -33,13 +33,12 @@ public class SimSettings {
|
|||||||
private static SimSettings instance = null;
|
private static SimSettings instance = null;
|
||||||
private Document edgeDevicesDoc = null;
|
private Document edgeDevicesDoc = null;
|
||||||
|
|
||||||
//enumarations for the scenarion, VM, appplication, and place.
|
//enumarations for the VM, appplication, and place.
|
||||||
//if you want to add different types on your config file,
|
//if you want to add different types on your config file,
|
||||||
//you may modify current types or add new types here.
|
//you may modify current types or add new types here.
|
||||||
public static enum VM_TYPES { EDGE_VM, CLOUD_VM }
|
public static enum VM_TYPES { EDGE_VM, CLOUD_VM }
|
||||||
public static enum APP_TYPES { FACE_REC_APP, HEALTH_APP, HEAVY_COMP_APP, VIDEO_GAME_APP, SIMPLE_SERVICE_APP }
|
public static enum APP_TYPES { FACE_REC_APP, HEALTH_APP, HEAVY_COMP_APP, VIDEO_GAME_APP, SIMPLE_SERVICE_APP }
|
||||||
public static enum PLACE_TYPES { ATTRACTIVENESS_L1, ATTRACTIVENESS_L2, ATTRACTIVENESS_L3 }
|
public static enum PLACE_TYPES { ATTRACTIVENESS_L1, ATTRACTIVENESS_L2, ATTRACTIVENESS_L3 }
|
||||||
public static enum SCENARIO_TYPES { SINGLE_TIER, TWO_TIER, TWO_TIER_WITH_EO }
|
|
||||||
|
|
||||||
//predifined ID for cloud components.
|
//predifined ID for cloud components.
|
||||||
public static int CLOUD_DATACENTER_ID = 1000;
|
public static int CLOUD_DATACENTER_ID = 1000;
|
||||||
@ -71,7 +70,8 @@ public class SimSettings {
|
|||||||
|
|
||||||
private int MIPS_FOR_CLOUD; //MIPS
|
private int MIPS_FOR_CLOUD; //MIPS
|
||||||
|
|
||||||
private String ORCHESTRATOR_POLICY;
|
private String[] SIMULATION_SCENARIOS;
|
||||||
|
private String[] ORCHESTRATOR_POLICIES;
|
||||||
|
|
||||||
// mean waiting time (minute) is stored for each place types
|
// mean waiting time (minute) is stored for each place types
|
||||||
private double[] mobilityLookUpTable;
|
private double[] mobilityLookUpTable;
|
||||||
@ -135,7 +135,9 @@ public class SimSettings {
|
|||||||
//-Each task is executed with maximum capacity (as if there is no task in the cloud)
|
//-Each task is executed with maximum capacity (as if there is no task in the cloud)
|
||||||
MIPS_FOR_CLOUD = Integer.parseInt(prop.getProperty("mips_for_cloud"));
|
MIPS_FOR_CLOUD = Integer.parseInt(prop.getProperty("mips_for_cloud"));
|
||||||
|
|
||||||
ORCHESTRATOR_POLICY = prop.getProperty("task_provisioning");
|
ORCHESTRATOR_POLICIES = prop.getProperty("orchestrator_policies").split(",");
|
||||||
|
|
||||||
|
SIMULATION_SCENARIOS = prop.getProperty("simulation_scenarios").split(",");
|
||||||
|
|
||||||
//avg waiting time in a place (min)
|
//avg waiting time in a place (min)
|
||||||
double place1_mean_waiting_time = Double.parseDouble(prop.getProperty("attractiveness_L1_mean_waiting_time"));
|
double place1_mean_waiting_time = Double.parseDouble(prop.getProperty("attractiveness_L1_mean_waiting_time"));
|
||||||
@ -314,11 +316,19 @@ public class SimSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns orchestrator policy as string
|
* returns simulation screnarios as string
|
||||||
*/
|
*/
|
||||||
public String getOrchestratorPolicy()
|
public String[] getSimulationScenarios()
|
||||||
{
|
{
|
||||||
return ORCHESTRATOR_POLICY;
|
return SIMULATION_SCENARIOS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns orchestrator policies as string
|
||||||
|
*/
|
||||||
|
public String[] getOrchestratorPolicies()
|
||||||
|
{
|
||||||
|
return ORCHESTRATOR_POLICIES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,6 @@ import org.cloudbus.cloudsim.core.CloudSim;
|
|||||||
|
|
||||||
import edu.boun.edgecloudsim.core.SimManager;
|
import edu.boun.edgecloudsim.core.SimManager;
|
||||||
import edu.boun.edgecloudsim.core.SimSettings;
|
import edu.boun.edgecloudsim.core.SimSettings;
|
||||||
import edu.boun.edgecloudsim.core.SimSettings.SCENARIO_TYPES;
|
|
||||||
import edu.boun.edgecloudsim.edge_server.EdgeVM;
|
import edu.boun.edgecloudsim.edge_server.EdgeVM;
|
||||||
import edu.boun.edgecloudsim.edge_client.CpuUtilizationModel_Custom;
|
import edu.boun.edgecloudsim.edge_client.CpuUtilizationModel_Custom;
|
||||||
import edu.boun.edgecloudsim.edge_client.Task;
|
import edu.boun.edgecloudsim.edge_client.Task;
|
||||||
@ -30,8 +29,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
|
|||||||
private int lastSelectedHostIndex; //used by load balancer
|
private int lastSelectedHostIndex; //used by load balancer
|
||||||
private int[] lastSelectedVmIndexes; //used by each host individually
|
private int[] lastSelectedVmIndexes; //used by each host individually
|
||||||
|
|
||||||
public BasicEdgeOrchestrator(String _policy,
|
public BasicEdgeOrchestrator(String _policy, String _simScenario) {
|
||||||
SCENARIO_TYPES _simScenario) {
|
|
||||||
super(_policy, _simScenario);
|
super(_policy, _simScenario);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +45,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EdgeVM selectVm(Task task) {
|
public EdgeVM selectVm(Task task) {
|
||||||
if(simScenario == SimSettings.SCENARIO_TYPES.TWO_TIER_WITH_EO)
|
if(simScenario.equals("TWO_TIER_WITH_EO"))
|
||||||
return selectVmOnLoadBalancer(task);
|
return selectVmOnLoadBalancer(task);
|
||||||
else
|
else
|
||||||
return selectVmOnHost(task);
|
return selectVmOnHost(task);
|
||||||
|
@ -13,15 +13,14 @@
|
|||||||
|
|
||||||
package edu.boun.edgecloudsim.edge_orchestrator;
|
package edu.boun.edgecloudsim.edge_orchestrator;
|
||||||
|
|
||||||
import edu.boun.edgecloudsim.core.SimSettings;
|
|
||||||
import edu.boun.edgecloudsim.edge_server.EdgeVM;
|
import edu.boun.edgecloudsim.edge_server.EdgeVM;
|
||||||
import edu.boun.edgecloudsim.edge_client.Task;
|
import edu.boun.edgecloudsim.edge_client.Task;
|
||||||
|
|
||||||
public abstract class EdgeOrchestrator {
|
public abstract class EdgeOrchestrator {
|
||||||
protected String policy;
|
protected String policy;
|
||||||
protected SimSettings.SCENARIO_TYPES simScenario;
|
protected String simScenario;
|
||||||
|
|
||||||
public EdgeOrchestrator(String _policy, SimSettings.SCENARIO_TYPES _simScenario){
|
public EdgeOrchestrator(String _policy, String _simScenario){
|
||||||
policy = _policy;
|
policy = _policy;
|
||||||
simScenario = _simScenario;
|
simScenario = _simScenario;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import org.cloudbus.cloudsim.UtilizationModel;
|
|||||||
import org.cloudbus.cloudsim.VmAllocationPolicy;
|
import org.cloudbus.cloudsim.VmAllocationPolicy;
|
||||||
|
|
||||||
import edu.boun.edgecloudsim.core.ScenarioFactory;
|
import edu.boun.edgecloudsim.core.ScenarioFactory;
|
||||||
import edu.boun.edgecloudsim.core.SimSettings;
|
|
||||||
import edu.boun.edgecloudsim.core.SimSettings.APP_TYPES;
|
import edu.boun.edgecloudsim.core.SimSettings.APP_TYPES;
|
||||||
import edu.boun.edgecloudsim.edge_orchestrator.BasicEdgeOrchestrator;
|
import edu.boun.edgecloudsim.edge_orchestrator.BasicEdgeOrchestrator;
|
||||||
import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
|
import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
|
||||||
@ -34,12 +33,12 @@ public class SampleScenarioFactory implements ScenarioFactory {
|
|||||||
private int numOfMobileDevice;
|
private int numOfMobileDevice;
|
||||||
private double simulationTime;
|
private double simulationTime;
|
||||||
private String orchestratorPolicy;
|
private String orchestratorPolicy;
|
||||||
private SimSettings.SCENARIO_TYPES simScenario;
|
private String simScenario;
|
||||||
|
|
||||||
SampleScenarioFactory(int _numOfMobileDevice,
|
SampleScenarioFactory(int _numOfMobileDevice,
|
||||||
double _simulationTime,
|
double _simulationTime,
|
||||||
String _orchestratorPolicy,
|
String _orchestratorPolicy,
|
||||||
SimSettings.SCENARIO_TYPES _simScenario){
|
String _simScenario){
|
||||||
orchestratorPolicy = _orchestratorPolicy;
|
orchestratorPolicy = _orchestratorPolicy;
|
||||||
numOfMobileDevice = _numOfMobileDevice;
|
numOfMobileDevice = _numOfMobileDevice;
|
||||||
simulationTime = _simulationTime;
|
simulationTime = _simulationTime;
|
||||||
@ -75,5 +74,4 @@ public class SampleScenarioFactory implements ScenarioFactory {
|
|||||||
public UtilizationModel getCpuUtilizationModel(APP_TYPES _taskType) {
|
public UtilizationModel getCpuUtilizationModel(APP_TYPES _taskType) {
|
||||||
return new CpuUtilizationModel_Custom(_taskType);
|
return new CpuUtilizationModel_Custom(_taskType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -75,44 +75,50 @@ public class mainApp {
|
|||||||
|
|
||||||
for(int j=SS.getMinNumOfMobileDev(); j<=SS.getMaxNumOfMobileDev(); j+=SS.getMobileDevCounterSize())
|
for(int j=SS.getMinNumOfMobileDev(); j<=SS.getMaxNumOfMobileDev(); j+=SS.getMobileDevCounterSize())
|
||||||
{
|
{
|
||||||
for (SimSettings.SCENARIO_TYPES scenario : SimSettings.SCENARIO_TYPES.values())
|
for(int k=0; k<SS.getSimulationScenarios().length; k++)
|
||||||
{
|
{
|
||||||
Date ScenarioStartDate = Calendar.getInstance().getTime();
|
for(int i=0; i<SS.getOrchestratorPolicies().length; i++)
|
||||||
now = df.format(ScenarioStartDate);
|
|
||||||
|
|
||||||
SimLogger.printLine("Scenario started at " + now);
|
|
||||||
SimLogger.printLine(scenario + "(" + SS.getOrchestratorPolicy() + ")" + " - duration: " + SS.getSimulationTime()/3600 + " hour(s) - poisson: " + SS.getTaskLookUpTable()[0][2] + " - #devices: " + j + " - ite: " + iterationNumber);
|
|
||||||
SimLogger.getInstance().simStarted(outputFolder,"SIMRESULT_" + scenario + "_" + j + "DEVICES");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// First step: Initialize the CloudSim package. It should be called
|
String simScenario = SS.getSimulationScenarios()[k];
|
||||||
// before creating any entities.
|
String orchestratorPolicy = SS.getOrchestratorPolicies()[i];
|
||||||
int num_user = 2; // number of grid users
|
Date ScenarioStartDate = Calendar.getInstance().getTime();
|
||||||
Calendar calendar = Calendar.getInstance();
|
now = df.format(ScenarioStartDate);
|
||||||
boolean trace_flag = false; // mean trace events
|
|
||||||
|
|
||||||
// Initialize the CloudSim library
|
|
||||||
CloudSim.init(num_user, calendar, trace_flag, 0.01);
|
|
||||||
|
|
||||||
ScenarioFactory sampleFactory = new SampleScenarioFactory(j,SS.getSimulationTime(), SS.getOrchestratorPolicy(), scenario);
|
SimLogger.printLine("Scenario started at " + now);
|
||||||
|
SimLogger.printLine("Scenario: " + simScenario + " - Policy: " + orchestratorPolicy + " - #iteration: " + iterationNumber);
|
||||||
|
SimLogger.printLine("Duration: " + SS.getSimulationTime()/3600 + " hour(s) - Poisson: " + SS.getTaskLookUpTable()[0][2] + " - #devices: " + j);
|
||||||
|
SimLogger.getInstance().simStarted(outputFolder,"SIMRESULT_" + simScenario + "_" + orchestratorPolicy + "_" + j + "DEVICES");
|
||||||
|
|
||||||
SimManager manager = new SimManager(sampleFactory, j, scenario);
|
try
|
||||||
manager.startSimulation();
|
{
|
||||||
}
|
// First step: Initialize the CloudSim package. It should be called
|
||||||
catch (Exception e)
|
// before creating any entities.
|
||||||
{
|
int num_user = 2; // number of grid users
|
||||||
SimLogger.printLine("The simulation has been terminated due to an unexpected error");
|
Calendar calendar = Calendar.getInstance();
|
||||||
e.printStackTrace();
|
boolean trace_flag = false; // mean trace events
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Date ScenarioEndDate = Calendar.getInstance().getTime();
|
// Initialize the CloudSim library
|
||||||
now = df.format(ScenarioEndDate);
|
CloudSim.init(num_user, calendar, trace_flag, 0.01);
|
||||||
SimLogger.printLine("Scenario finished at " + now + ". It took " + SimUtils.getTimeDifference(ScenarioStartDate,ScenarioEndDate));
|
|
||||||
SimLogger.printLine("----------------------------------------------------------------------");
|
ScenarioFactory sampleFactory = new SampleScenarioFactory(j,SS.getSimulationTime(), orchestratorPolicy, simScenario);
|
||||||
}//End of SCENARIO_TYPES loop
|
|
||||||
}//End of NUMBER_OF_MOBILE_DEVICE loop
|
SimManager manager = new SimManager(sampleFactory, j, simScenario);
|
||||||
|
manager.startSimulation();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
SimLogger.printLine("The simulation has been terminated due to an unexpected error");
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Date ScenarioEndDate = Calendar.getInstance().getTime();
|
||||||
|
now = df.format(ScenarioEndDate);
|
||||||
|
SimLogger.printLine("Scenario finished at " + now + ". It took " + SimUtils.getTimeDifference(ScenarioStartDate,ScenarioEndDate));
|
||||||
|
SimLogger.printLine("----------------------------------------------------------------------");
|
||||||
|
}//End of orchestrators loop
|
||||||
|
}//End of scenarios loop
|
||||||
|
}//End of mobile devices loop
|
||||||
|
|
||||||
Date SimulationEndDate = Calendar.getInstance().getTime();
|
Date SimulationEndDate = Calendar.getInstance().getTime();
|
||||||
now = df.format(SimulationEndDate);
|
now = df.format(SimulationEndDate);
|
||||||
|
@ -26,7 +26,7 @@ import edu.boun.edgecloudsim.utils.SimUtils;
|
|||||||
|
|
||||||
public class IdleActiveLoadGenerator extends LoadGeneratorModel{
|
public class IdleActiveLoadGenerator extends LoadGeneratorModel{
|
||||||
|
|
||||||
public IdleActiveLoadGenerator(int _numberOfMobileDevices, double _simulationTime, SimSettings.SCENARIO_TYPES _simScenario) {
|
public IdleActiveLoadGenerator(int _numberOfMobileDevices, double _simulationTime, String _simScenario) {
|
||||||
super(_numberOfMobileDevices, _simulationTime, _simScenario);
|
super(_numberOfMobileDevices, _simulationTime, _simScenario);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ public class IdleActiveLoadGenerator extends LoadGeneratorModel{
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean requireCloud = false;
|
boolean requireCloud = false;
|
||||||
if(simScenario != SimSettings.SCENARIO_TYPES.SINGLE_TIER){
|
if(!simScenario.equals("SINGLE_TIER")){
|
||||||
//decide to use cloud or cloudlet VM
|
//decide to use cloud or cloudlet VM
|
||||||
int CloudVmPicker = SimUtils.getRandomNumber(0, 100);
|
int CloudVmPicker = SimUtils.getRandomNumber(0, 100);
|
||||||
|
|
||||||
|
@ -15,16 +15,15 @@ package edu.boun.edgecloudsim.task_generator;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import edu.boun.edgecloudsim.core.SimSettings;
|
|
||||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||||
|
|
||||||
public abstract class LoadGeneratorModel {
|
public abstract class LoadGeneratorModel {
|
||||||
protected List<EdgeTask> taskList;
|
protected List<EdgeTask> taskList;
|
||||||
protected int numberOfMobileDevices;
|
protected int numberOfMobileDevices;
|
||||||
protected double simulationTime;
|
protected double simulationTime;
|
||||||
protected SimSettings.SCENARIO_TYPES simScenario;
|
protected String simScenario;
|
||||||
|
|
||||||
public LoadGeneratorModel(int _numberOfMobileDevices, double _simulationTime, SimSettings.SCENARIO_TYPES _simScenario){
|
public LoadGeneratorModel(int _numberOfMobileDevices, double _simulationTime, String _simScenario){
|
||||||
numberOfMobileDevices=_numberOfMobileDevices;
|
numberOfMobileDevices=_numberOfMobileDevices;
|
||||||
simulationTime=_simulationTime;
|
simulationTime=_simulationTime;
|
||||||
simScenario=_simScenario;
|
simScenario=_simScenario;
|
||||||
|
Loading…
Reference in New Issue
Block a user