task flow and network from mobile device to edge orchestrator is modified

1- finding which device to offlod is decided in edge orchestrator
(EdgeOrchestrator), instead of deciding while generating task
(LoadGeneratorModel)
2- file logging option is now read from config file
3- minor modification on the network delay calculation
This commit is contained in:
Cagatay Sonmez 2017-02-26 14:07:47 +03:00
parent 81fed10dd0
commit 22b654d719
9 changed files with 128 additions and 57 deletions

View File

@ -3,6 +3,7 @@ simulation_time=2
warm_up_period=1200 warm_up_period=1200
vm_load_check_interval=30 vm_load_check_interval=30
vm_location_check_interval=30 vm_location_check_interval=30
basic_file_log_enabled=false
deep_file_log_enabled=false deep_file_log_enabled=false
min_number_of_mobile_devices=50 min_number_of_mobile_devices=50

View File

@ -40,10 +40,14 @@ public class SimSettings {
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 }
//predifined ID for cloud components. //predifined IDs for cloud components.
public static int CLOUD_DATACENTER_ID = 1000; public static int CLOUD_DATACENTER_ID = 1000;
public static int CLOUD_HOST_ID = CLOUD_DATACENTER_ID + 1; public static int CLOUD_HOST_ID = CLOUD_DATACENTER_ID + 1;
public static int CLOUD_VM_ID = CLOUD_DATACENTER_ID + 2; public static int CLOUD_VM_ID = CLOUD_DATACENTER_ID + 2;
//predifined IDs for edge devices
public static int EDGE_ORCHESTRATOR_ID = 2000;
public static int GENERIC_EDGE_DEVICE_ID = EDGE_ORCHESTRATOR_ID + 1;
//delimiter for output file. //delimiter for output file.
public static String DELIMITER = ";"; public static String DELIMITER = ";";
@ -52,7 +56,8 @@ public class SimSettings {
private double WARM_UP_PERIOD; //seconds unit in properties file private double WARM_UP_PERIOD; //seconds unit in properties file
private double INTERVAL_TO_GET_VM_LOAD_LOG; //seconds unit in properties file private double INTERVAL_TO_GET_VM_LOAD_LOG; //seconds unit in properties file
private double INTERVAL_TO_GET_VM_LOCATION_LOG; //seconds unit in properties file private double INTERVAL_TO_GET_VM_LOCATION_LOG; //seconds unit in properties file
private boolean DEEP_FILE_LOG_ENABLED; //used for each success failed task private boolean FILE_LOG_ENABLED; //boolean to check file logging option
private boolean DEEP_FILE_LOG_ENABLED; //boolean to check deep file logging option
private int MIN_NUM_OF_MOBILE_DEVICES; private int MIN_NUM_OF_MOBILE_DEVICES;
private int MAX_NUM_OF_MOBILE_DEVICES; private int MAX_NUM_OF_MOBILE_DEVICES;
@ -118,6 +123,7 @@ public class SimSettings {
WARM_UP_PERIOD = Double.parseDouble(prop.getProperty("warm_up_period")); //seconds WARM_UP_PERIOD = Double.parseDouble(prop.getProperty("warm_up_period")); //seconds
INTERVAL_TO_GET_VM_LOAD_LOG = Double.parseDouble(prop.getProperty("vm_load_check_interval")); //seconds INTERVAL_TO_GET_VM_LOAD_LOG = Double.parseDouble(prop.getProperty("vm_load_check_interval")); //seconds
INTERVAL_TO_GET_VM_LOCATION_LOG = Double.parseDouble(prop.getProperty("vm_location_check_interval")); //seconds INTERVAL_TO_GET_VM_LOCATION_LOG = Double.parseDouble(prop.getProperty("vm_location_check_interval")); //seconds
FILE_LOG_ENABLED = Boolean.parseBoolean(prop.getProperty("file_log_enabled"));
DEEP_FILE_LOG_ENABLED = Boolean.parseBoolean(prop.getProperty("deep_file_log_enabled")); DEEP_FILE_LOG_ENABLED = Boolean.parseBoolean(prop.getProperty("deep_file_log_enabled"));
MIN_NUM_OF_MOBILE_DEVICES = Integer.parseInt(prop.getProperty("min_number_of_mobile_devices")); MIN_NUM_OF_MOBILE_DEVICES = Integer.parseInt(prop.getProperty("min_number_of_mobile_devices"));
@ -218,6 +224,14 @@ public class SimSettings {
return DEEP_FILE_LOG_ENABLED; return DEEP_FILE_LOG_ENABLED;
} }
/**
* returns deep statistics logging status from properties file
*/
public boolean getFileLoggingEnabled()
{
return FILE_LOG_ENABLED;
}
/** /**
* returns WAN propogation delay (in second unit) from properties file * returns WAN propogation delay (in second unit) from properties file
*/ */

View File

@ -38,6 +38,7 @@ public class MobileDeviceManager extends DatacenterBroker {
private static final int REQUEST_PROCESSED_BY_CLOUD = BASE + 2; private static final int REQUEST_PROCESSED_BY_CLOUD = BASE + 2;
private static final int REQUEST_RECIVED_BY_EDGE_DEVICE = BASE + 3; private static final int REQUEST_RECIVED_BY_EDGE_DEVICE = BASE + 3;
private static final int RESPONSE_RECEIVED_BY_MOBILE_DEVICE = BASE + 4; private static final int RESPONSE_RECEIVED_BY_MOBILE_DEVICE = BASE + 4;
private static final int REQUEST_RECIVED_BY_EDGE_ORCHESTRATOR = BASE + 5;
private int taskIdCounter=0; private int taskIdCounter=0;
public MobileDeviceManager() throws Exception { public MobileDeviceManager() throws Exception {
@ -149,37 +150,21 @@ public class MobileDeviceManager extends DatacenterBroker {
break; break;
} }
case REQUEST_RECIVED_BY_EDGE_ORCHESTRATOR:
{
Task task = (Task) ev.getData();
double internalDelay = networkModel.getDownloadDelay(
SimSettings.EDGE_ORCHESTRATOR_ID,
SimSettings.GENERIC_EDGE_DEVICE_ID);
submitTaskToEdgeDevice(task,internalDelay);
break;
}
case REQUEST_RECIVED_BY_EDGE_DEVICE: case REQUEST_RECIVED_BY_EDGE_DEVICE:
{ {
Task task = (Task) ev.getData(); Task task = (Task) ev.getData();
submitTaskToEdgeDevice(task,0);
Location currentLocation = SimManager.getInstance().getMobilityModel().getLocation(task.getMobileDeviceId(),CloudSim.clock());
//select a VM
EdgeVM selectedVM = SimManager.getInstance().getEdgeOrchestrator().selectVm(task);
if(selectedVM != null){
//save task info
task.setSubmittedLocation(currentLocation);
task.setAssociatedHostId(selectedVM.getHost().getId());
//bind task to related VM
getCloudletList().add(task);
bindCloudletToVm(task.getCloudletId(),selectedVM.getId());
//SimLogger.printLine(CloudSim.clock() + ": Cloudlet#" + task.getCloudletId() + " is submitted to VM#" + task.getVmId());
sendNow(getVmsToDatacentersMap().get(task.getVmId()), CloudSimTags.CLOUDLET_SUBMIT, task);
SimLogger.getInstance().uploaded(task.getCloudletId(),
selectedVM.getHost().getDatacenter().getId(),
selectedVM.getHost().getId(),
selectedVM.getId(),
selectedVM.getVmType().ordinal());
}
else{
//SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
SimLogger.getInstance().rejectedDueToVMCapacity(task.getCloudletId(), CloudSim.clock());
}
break; break;
} }
@ -197,6 +182,37 @@ public class MobileDeviceManager extends DatacenterBroker {
} }
} }
public void submitTaskToEdgeDevice(Task task, double delay) {
//select a VM
EdgeVM selectedVM = SimManager.getInstance().getEdgeOrchestrator().getVmToOffload(task);
if(selectedVM != null){
Location currentLocation = SimManager.getInstance().getMobilityModel().
getLocation(task.getMobileDeviceId(),CloudSim.clock());
//save task info
task.setSubmittedLocation(currentLocation);
task.setAssociatedHostId(selectedVM.getHost().getId());
//bind task to related VM
getCloudletList().add(task);
bindCloudletToVm(task.getCloudletId(),selectedVM.getId());
//SimLogger.printLine(CloudSim.clock() + ": Cloudlet#" + task.getCloudletId() + " is submitted to VM#" + task.getVmId());
schedule(getVmsToDatacentersMap().get(task.getVmId()), delay, CloudSimTags.CLOUDLET_SUBMIT, task);
SimLogger.getInstance().uploaded(task.getCloudletId(),
selectedVM.getHost().getDatacenter().getId(),
selectedVM.getHost().getId(),
selectedVM.getId(),
selectedVM.getVmType().ordinal());
}
else{
//SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
SimLogger.getInstance().rejectedDueToVMCapacity(task.getCloudletId(), CloudSim.clock());
}
}
public void submitTask(EdgeTask edgeTask) { public void submitTask(EdgeTask edgeTask) {
NetworkModel networkModel = SimManager.getInstance().getNetworkModel(); NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
@ -210,9 +226,12 @@ public class MobileDeviceManager extends DatacenterBroker {
(int)task.getCloudletLength(), (int)task.getCloudletLength(),
(int)task.getCloudletFileSize(), (int)task.getCloudletFileSize(),
(int)task.getCloudletOutputSize()); (int)task.getCloudletOutputSize());
int nextHopId = SimManager.getInstance().getEdgeOrchestrator().getDeviceToOffload(task);
if(edgeTask.requireCloud){ if(nextHopId == SimSettings.CLOUD_DATACENTER_ID){
double WanDelay = networkModel.getUploadDelay(task.getMobileDeviceId(),SimSettings.CLOUD_DATACENTER_ID); double WanDelay = networkModel.getUploadDelay(task.getMobileDeviceId(), nextHopId);
if(WanDelay>0){ if(WanDelay>0){
schedule(getId(), WanDelay, REQUEST_RECEIVED_BY_CLOUD, task); schedule(getId(), WanDelay, REQUEST_RECEIVED_BY_CLOUD, task);
SimLogger.getInstance().uploadStarted(task.getCloudletId(),WanDelay); SimLogger.getInstance().uploadStarted(task.getCloudletId(),WanDelay);
@ -223,8 +242,20 @@ public class MobileDeviceManager extends DatacenterBroker {
SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock()); SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock());
} }
} }
else { else if(nextHopId == SimSettings.EDGE_ORCHESTRATOR_ID){
double WlanDelay = networkModel.getUploadDelay(task.getMobileDeviceId(),0); double WlanDelay = networkModel.getUploadDelay(task.getMobileDeviceId(), nextHopId);
if(WlanDelay > 0){
schedule(getId(), WlanDelay, REQUEST_RECIVED_BY_EDGE_ORCHESTRATOR, task);
SimLogger.getInstance().uploadStarted(task.getCloudletId(),WlanDelay);
}
else {
SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock());
}
}
else if(nextHopId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
double WlanDelay = networkModel.getUploadDelay(task.getMobileDeviceId(), nextHopId);
if(WlanDelay > 0){ if(WlanDelay > 0){
schedule(getId(), WlanDelay, REQUEST_RECIVED_BY_EDGE_DEVICE, task); schedule(getId(), WlanDelay, REQUEST_RECIVED_BY_EDGE_DEVICE, task);
SimLogger.getInstance().uploadStarted(task.getCloudletId(),WlanDelay); SimLogger.getInstance().uploadStarted(task.getCloudletId(),WlanDelay);
@ -233,6 +264,10 @@ public class MobileDeviceManager extends DatacenterBroker {
SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock()); SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock());
} }
} }
else {
SimLogger.printLine("Unknown nextHopId! Terminating simulation...");
System.exit(0);
}
} }
public Task createTask(EdgeTask edgeTask){ public Task createTask(EdgeTask edgeTask){

View File

@ -44,7 +44,23 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
} }
@Override @Override
public EdgeVM selectVm(Task task) { public int getDeviceToOffload(Task task) {
int result = SimSettings.GENERIC_EDGE_DEVICE_ID;
if(!simScenario.equals("SINGLE_TIER")){
//decide to use cloud or cloudlet VM
int CloudVmPicker = SimUtils.getRandomNumber(0, 100);
if(CloudVmPicker <= SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType().ordinal()][1])
result = SimSettings.CLOUD_DATACENTER_ID;
else
result = SimSettings.EDGE_ORCHESTRATOR_ID;
}
return result;
}
@Override
public EdgeVM getVmToOffload(Task task) {
if(simScenario.equals("TWO_TIER_WITH_EO")) if(simScenario.equals("TWO_TIER_WITH_EO"))
return selectVmOnLoadBalancer(task); return selectVmOnLoadBalancer(task);
else else

View File

@ -30,8 +30,13 @@ public abstract class EdgeOrchestrator {
*/ */
public abstract void initialize(); public abstract void initialize();
/*
* decides where to offload
*/
public abstract int getDeviceToOffload(Task task);
/* /*
* returns proper VM from the related edge orchestrator point of view * returns proper VM from the related edge orchestrator point of view
*/ */
public abstract EdgeVM selectVm(Task task); public abstract EdgeVM getVmToOffload(Task task);
} }

View File

@ -69,18 +69,21 @@ public class MM1Queue extends NetworkModel {
double delay = 0; double delay = 0;
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(sourceDeviceId,CloudSim.clock()); Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(sourceDeviceId,CloudSim.clock());
//if destination device is the cloud datacenter, both wan and wlan delay should be considered //mobile device to cloud server
if(destDeviceId == SimSettings.CLOUD_DATACENTER_ID){ if(destDeviceId == SimSettings.CLOUD_DATACENTER_ID){
double wlanDelay = getWlanUploadDelay(accessPointLocation, CloudSim.clock()); double wlanDelay = getWlanUploadDelay(accessPointLocation, CloudSim.clock());
double wanDelay = getWanUploadDelay(accessPointLocation, CloudSim.clock() + wlanDelay); double wanDelay = getWanUploadDelay(accessPointLocation, CloudSim.clock() + wlanDelay);
if(wlanDelay > 0 && wanDelay >0) if(wlanDelay > 0 && wanDelay >0)
delay = wlanDelay + wanDelay; delay = wlanDelay + wanDelay;
} }
else{ //mobile device to edge orchestrator
else if(destDeviceId == SimSettings.EDGE_ORCHESTRATOR_ID){
delay = getWlanUploadDelay(accessPointLocation, CloudSim.clock()) +
SimSettings.getInstance().getInternalLanDelay();
}
//mobile device to edge device (wifi access point)
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
delay = getWlanUploadDelay(accessPointLocation, CloudSim.clock()); delay = getWlanUploadDelay(accessPointLocation, CloudSim.clock());
//all requests are send to edge orchestrator first than redirected related VM
delay += (SimSettings.getInstance().getInternalLanDelay() * 2);
} }
return delay; return delay;
@ -91,16 +94,23 @@ public class MM1Queue extends NetworkModel {
*/ */
@Override @Override
public double getDownloadDelay(int sourceDeviceId, int destDeviceId) { public double getDownloadDelay(int sourceDeviceId, int destDeviceId) {
//Special Case -> edge orchestrator to edge device
if(sourceDeviceId == SimSettings.EDGE_ORCHESTRATOR_ID &&
destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
return SimSettings.getInstance().getInternalLanDelay();
}
double delay = 0; double delay = 0;
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(destDeviceId,CloudSim.clock()); Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(destDeviceId,CloudSim.clock());
//if source device is the cloud datacenter, both wan and wlan delay should be considered //cloud server to mobile device
if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID){ if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID){
double wlanDelay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock()); double wlanDelay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock());
double wanDelay = getWanDownloadDelay(accessPointLocation, CloudSim.clock() + wlanDelay); double wanDelay = getWanDownloadDelay(accessPointLocation, CloudSim.clock() + wlanDelay);
if(wlanDelay > 0 && wanDelay >0) if(wlanDelay > 0 && wanDelay >0)
delay = wlanDelay + wanDelay; delay = wlanDelay + wanDelay;
} }
//edge device (wifi access point) to mobile device
else{ else{
delay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock()); delay = getWlanDownloadDelay(accessPointLocation, CloudSim.clock());

View File

@ -34,7 +34,6 @@ public class mainApp {
//enable console ourput and file output of this application //enable console ourput and file output of this application
SimLogger.enablePrintLog(); SimLogger.enablePrintLog();
SimLogger.enableFileLog();
int iterationNumber = 1; int iterationNumber = 1;
String configFile = ""; String configFile = "";
@ -64,8 +63,10 @@ public class mainApp {
System.exit(0); System.exit(0);
} }
if(SimLogger.isFileLogEnabled()) if(SS.getFileLoggingEnabled()){
SimLogger.enableFileLog();
SimUtils.cleanOutputFolder(outputFolder); SimUtils.cleanOutputFolder(outputFolder);
}
DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date SimulationStartDate = Calendar.getInstance().getTime(); Date SimulationStartDate = Calendar.getInstance().getTime();

View File

@ -86,17 +86,8 @@ public class IdleActiveLoadGenerator extends LoadGeneratorModel{
virtualTime = activePeriodStartTime; virtualTime = activePeriodStartTime;
continue; continue;
} }
boolean requireCloud = false;
if(!simScenario.equals("SINGLE_TIER")){
//decide to use cloud or cloudlet VM
int CloudVmPicker = SimUtils.getRandomNumber(0, 100);
if(CloudVmPicker <= SimSettings.getInstance().getTaskLookUpTable()[randomTaskType.ordinal()][1])
requireCloud = true;
}
taskList.add(new EdgeTask(i,randomTaskType, virtualTime, requireCloud, poissonRngList)); taskList.add(new EdgeTask(i,randomTaskType, virtualTime, poissonRngList));
} }
} }
} }

View File

@ -15,15 +15,13 @@ import edu.boun.edgecloudsim.core.SimSettings.APP_TYPES;
public class EdgeTask { public class EdgeTask {
public APP_TYPES taskType; public APP_TYPES taskType;
public boolean requireCloud;
public double startTime; public double startTime;
public long length, inputFileSize, outputFileSize; public long length, inputFileSize, outputFileSize;
public int pesNumber; public int pesNumber;
public int mobileDeviceId; public int mobileDeviceId;
public EdgeTask(int _mobileDeviceId, APP_TYPES _taskType, double _startTime, boolean _requireCloud, PoissonDistr[][] poissonRngList) { public EdgeTask(int _mobileDeviceId, APP_TYPES _taskType, double _startTime, PoissonDistr[][] poissonRngList) {
mobileDeviceId=_mobileDeviceId; mobileDeviceId=_mobileDeviceId;
requireCloud=_requireCloud;
startTime=_startTime; startTime=_startTime;
taskType=_taskType; taskType=_taskType;