major modifications for v2.0 release

Release notes

1- Cloud server processing was simplified in the initial version, it is handled via cloudsim components now.

2- Cloud server manager, edge server manager, mobile device manager and vm allocation policy are used as abstract class in factory pattern to allow developers to use different business logic without modifying EdgeCloudSim source code.

3- The task and place types are no longer defined as enumeration. They are used as integer value in order to manipulate more place type without modifying enum variable.

4- Two sample applications (one of them is simple and the other one extended application) are added along with the corresponding matlab files to plot statistics.

5- Cloud server properties are added to the simulation settings file

6- New log items are added to simulation result files

7- Code refactoring is applied including the modification of comments
This commit is contained in:
Cagatay Sonmez
2018-09-10 14:22:27 +03:00
parent e01833bda6
commit d4545f009f
89 changed files with 10699 additions and 4689 deletions

View File

@@ -14,8 +14,12 @@ package edu.boun.edgecloudsim.edge_orchestrator;
import java.util.List;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.SimEvent;
import edu.boun.edgecloudsim.cloud_server.CloudVM;
import edu.boun.edgecloudsim.core.SimManager;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.edge_server.EdgeVM;
@@ -47,10 +51,10 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
public int getDeviceToOffload(Task task) {
int result = SimSettings.GENERIC_EDGE_DEVICE_ID;
if(!simScenario.equals("SINGLE_TIER")){
//decide to use cloud or cloudlet VM
//decide to use cloud or Edge VM
int CloudVmPicker = SimUtils.getRandomNumber(0, 100);
if(CloudVmPicker <= SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType().ordinal()][1])
if(CloudVmPicker <= SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType()][1])
result = SimSettings.CLOUD_DATACENTER_ID;
else
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
@@ -60,11 +64,31 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
}
@Override
public EdgeVM getVmToOffload(Task task) {
if(simScenario.equals("TWO_TIER_WITH_EO"))
return selectVmOnLoadBalancer(task);
public Vm getVmToOffload(Task task, int deviceId) {
Vm selectedVM = null;
if(deviceId == SimSettings.CLOUD_DATACENTER_ID){
//Select VM on cloud devices via Least Loaded algorithm!
double selectedVmCapacity = 0; //start with min value
List<Host> list = SimManager.getInstance().getCloudServerManager().getDatacenter().getHostList();
for (int hostIndex=0; hostIndex < list.size(); hostIndex++) {
List<CloudVM> vmArray = SimManager.getInstance().getCloudServerManager().getVmList(hostIndex);
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(vmIndex).getVmType());
double targetVmCapacity = (double)100 - vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
if(requiredCapacity <= targetVmCapacity && targetVmCapacity > selectedVmCapacity){
selectedVM = vmArray.get(vmIndex);
selectedVmCapacity = targetVmCapacity;
}
}
}
}
else if(simScenario.equals("TWO_TIER_WITH_EO"))
selectedVM = selectVmOnLoadBalancer(task);
else
return selectVmOnHost(task);
selectedVM = selectVmOnHost(task);
return selectedVM;
}
public EdgeVM selectVmOnHost(Task task){
@@ -74,7 +98,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
//in our scenasrio, serving wlan ID is equal to the host id
//because there is only one host in one place
int relatedHostId=deviceLocation.getServingWlanId();
List<EdgeVM> vmArray = SimManager.getInstance().getLocalServerManager().getVmList(relatedHostId);
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(relatedHostId);
if(policy.equalsIgnoreCase("RANDOM_FIT")){
int randomIndex = SimUtils.getRandomNumber(0, vmArray.size()-1);
@@ -137,7 +161,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
if(policy.equalsIgnoreCase("RANDOM_FIT")){
int randomHostIndex = SimUtils.getRandomNumber(0, numberOfHost-1);
List<EdgeVM> vmArray = SimManager.getInstance().getLocalServerManager().getVmList(randomHostIndex);
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(randomHostIndex);
int randomIndex = SimUtils.getRandomNumber(0, vmArray.size()-1);
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(randomIndex).getVmType());
@@ -148,7 +172,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
else if(policy.equalsIgnoreCase("WORST_FIT")){
double selectedVmCapacity = 0; //start with min value
for(int hostIndex=0; hostIndex<numberOfHost; hostIndex++){
List<EdgeVM> vmArray = SimManager.getInstance().getLocalServerManager().getVmList(hostIndex);
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(hostIndex);
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(vmIndex).getVmType());
double targetVmCapacity = (double)100 - vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
@@ -162,7 +186,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
else if(policy.equalsIgnoreCase("BEST_FIT")){
double selectedVmCapacity = 101; //start with max value
for(int hostIndex=0; hostIndex<numberOfHost; hostIndex++){
List<EdgeVM> vmArray = SimManager.getInstance().getLocalServerManager().getVmList(hostIndex);
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(hostIndex);
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(vmIndex).getVmType());
double targetVmCapacity = (double)100 - vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
@@ -175,7 +199,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
}
else if(policy.equalsIgnoreCase("FIRST_FIT")){
for(int hostIndex=0; hostIndex<numberOfHost; hostIndex++){
List<EdgeVM> vmArray = SimManager.getInstance().getLocalServerManager().getVmList(hostIndex);
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(hostIndex);
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(vmIndex).getVmType());
double targetVmCapacity = (double)100 - vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
@@ -192,7 +216,7 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
int tries = 0;
lastSelectedHostIndex = (lastSelectedHostIndex+1) % numberOfHost;
List<EdgeVM> vmArray = SimManager.getInstance().getLocalServerManager().getVmList(lastSelectedHostIndex);
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(lastSelectedHostIndex);
while(tries < vmArray.size()){
lastSelectedVmIndexes[lastSelectedHostIndex] = (lastSelectedVmIndexes[lastSelectedHostIndex]+1) % vmArray.size();
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(lastSelectedVmIndexes[lastSelectedHostIndex]).getVmType());
@@ -210,4 +234,22 @@ public class BasicEdgeOrchestrator extends EdgeOrchestrator {
return selectedVM;
}
@Override
public void processEvent(SimEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void shutdownEntity() {
// TODO Auto-generated method stub
}
@Override
public void startEntity() {
// TODO Auto-generated method stub
}
}

View File

@@ -1,42 +1,45 @@
/*
* Title: EdgeCloudSim - Edge Orchestrator
*
* Description:
* EdgeOrchestrator is an abstract class which is used for selecting VM
* for each client requests. For those who wants to add a custom
* Edge Orchestrator to EdgeCloudSim should extend this class and provide
* a concreate instance via ScenarioFactory
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_orchestrator;
import edu.boun.edgecloudsim.edge_server.EdgeVM;
import edu.boun.edgecloudsim.edge_client.Task;
public abstract class EdgeOrchestrator {
protected String policy;
protected String simScenario;
public EdgeOrchestrator(String _policy, String _simScenario){
policy = _policy;
simScenario = _simScenario;
}
/*
* initialize edge orchestrator if needed
*/
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
*/
public abstract EdgeVM getVmToOffload(Task task);
}
/*
* Title: EdgeCloudSim - Edge Orchestrator
*
* Description:
* EdgeOrchestrator is an abstract class which is used for selecting VM
* for each client requests. For those who wants to add a custom
* Edge Orchestrator to EdgeCloudSim should extend this class and provide
* a concreate instance via ScenarioFactory
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_orchestrator;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.SimEntity;
import edu.boun.edgecloudsim.edge_client.Task;
public abstract class EdgeOrchestrator extends SimEntity{
protected String policy;
protected String simScenario;
public EdgeOrchestrator(String _policy, String _simScenario){
super("EdgeOrchestrator");
policy = _policy;
simScenario = _simScenario;
}
/*
* initialize edge orchestrator if needed
*/
public abstract void initialize();
/*
* decides where to offload
*/
public abstract int getDeviceToOffload(Task task);
/*
* returns proper VM from the edge orchestrator point of view
*/
public abstract Vm getVmToOffload(Task task, int deviceId);
}