Commit bc1fa0a6 authored by Anton Beloglazov's avatar Anton Beloglazov

Fixed the examples of the LR and LRR policies with a random workload

parent 8a508691
...@@ -33,7 +33,7 @@ public class IqrMc { ...@@ -33,7 +33,7 @@ public class IqrMc {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "iqr"; // Inter Quartile Range VM allocation policy String vmAllocationPolicy = "iqr"; // Inter Quartile Range (IQR) VM allocation policy
String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy
String parameter = "1.5"; // the safety parameter of the IQR policy String parameter = "1.5"; // the safety parameter of the IQR policy
......
...@@ -33,7 +33,7 @@ public class IqrMmt { ...@@ -33,7 +33,7 @@ public class IqrMmt {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "iqr"; // Inter Quartile Range VM allocation policy String vmAllocationPolicy = "iqr"; // Inter Quartile Range (IQR) VM allocation policy
String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy
String parameter = "1.5"; // the safety parameter of the IQR policy String parameter = "1.5"; // the safety parameter of the IQR policy
......
...@@ -33,7 +33,7 @@ public class IqrMu { ...@@ -33,7 +33,7 @@ public class IqrMu {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "iqr"; // Inter Quartile Range VM allocation policy String vmAllocationPolicy = "iqr"; // Inter Quartile Range (IQR) VM allocation policy
String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy
String parameter = "1.5"; // the safety parameter of the IQR policy String parameter = "1.5"; // the safety parameter of the IQR policy
......
...@@ -33,7 +33,7 @@ public class IqrRs { ...@@ -33,7 +33,7 @@ public class IqrRs {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "iqr"; // Inter Quartile Range VM allocation policy String vmAllocationPolicy = "iqr"; // Inter Quartile Range (IQR) VM allocation policy
String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy
String parameter = "1.5"; // the safety parameter of the IQR policy String parameter = "1.5"; // the safety parameter of the IQR policy
......
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMaximumCorrelation;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time. * allocation policy and Maximum Correlation (MC) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrMc { public class LrMc {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lr_mc"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lr"; // Local Regression (LR) VM allocation policy
try { String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyMaximumCorrelation( vmSelectionPolicy,
new PowerVmSelectionPolicyRandomSelection()); parameter);
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter",
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegression(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationThresholds(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("Unwanted errors happen");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time. * allocation policy and Minimum Migration Time (MMT) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrMmt { public class LrMmt {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lr_mmt"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lr"; // Local Regression (LR) VM allocation policy
try { String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyMinimumMigrationTime(); vmSelectionPolicy,
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter", parameter);
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegression(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationThresholds(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("Unwanted errors happen");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time. * allocation policy and Minimum Utilization (MU) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrMu { public class LrMu {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lr_mu"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lr"; // Local Regression (LR) VM allocation policy
try { String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyMinimumUtilization(); vmSelectionPolicy,
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter", parameter);
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegression(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationThresholds(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("Unwanted errors happen");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time. * allocation policy and Random Selection (RS) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrRs { public class LrRs {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lr_rs"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lr"; // Local Regression (LR) VM allocation policy
try { String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyRandomSelection(); vmSelectionPolicy,
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter", parameter);
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegression(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationThresholds(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("Unwanted errors happen");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMaximumCorrelation;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time. * (LRR) VM allocation policy and Maximum Correlation (MC) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrrMc { public class LrrMc {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lrr_mc"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lrr"; // Local Regression Robust (LRR) VM allocation policy
try { String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LRR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyMaximumCorrelation( vmSelectionPolicy,
new PowerVmSelectionPolicyRandomSelection()); parameter);
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter",
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegressionRobust(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationThresholds(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("Unwanted errors happen");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time. * (LRR) VM allocation policy and Minimum Migration Time (MMT) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrrMmt { public class LrrMmt {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lrr_mmt"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lrr"; // Local Regression Robust (LRR) VM allocation policy
try { String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LRR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyMinimumMigrationTime(); vmSelectionPolicy,
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter", parameter);
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegressionRobust(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationStaticThreshold(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time. * (LRR) VM allocation policy and Minimum Utilization (MU) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrrMu { public class LrrMu {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lrr_mu"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lrr"; // Local Regression Robust (LRR) VM allocation policy
try { String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LRR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyMinimumUtilization(); vmSelectionPolicy,
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter", parameter);
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegressionRobust(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationStaticThreshold(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
Log.printLine("Finished " + experimentName);
} }
} }
package org.cloudbus.cloudsim.examples.power.random; package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException; import java.io.IOException;
import java.util.Calendar;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.power.PowerDatacenter;
import org.cloudbus.cloudsim.power.PowerHost;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust;
import org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicy;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time. * (LRR) VM allocation policy and Random Selection (RS) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/ */
public class LrrRs { public class LrrRs {
/** /**
* Creates main() to run this example. * The main method.
* *
* @param args the args * @param args the arguments
* @throws IOException Signals that an I/O exception has occurred. * @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "lrr_rs"; boolean enableOutput = true;
String outputFolder = "output"; boolean outputToFile = false;
String inputFolder = "";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT); String outputFolder = "";
Log.printLine("Starting " + experimentName); String workload = "random"; // Random workload
String vmAllocationPolicy = "lrr"; // Local Regression Robust (LRR) VM allocation policy
try { String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy
CloudSim.init(1, Calendar.getInstance(), false); String parameter = "1.2"; // the safety parameter of the LRR policy
DatacenterBroker broker = RandomHelper.createBroker(); new RandomRunner(
int brokerId = broker.getId(); enableOutput,
outputToFile,
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS); inputFolder,
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size()); outputFolder,
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS); workload,
vmAllocationPolicy,
PowerVmSelectionPolicy vmSelectionPolicy = new PowerVmSelectionPolicyRandomSelection(); vmSelectionPolicy,
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter", parameter);
PowerDatacenter.class, hostList,
new PowerVmAllocationPolicyMigrationLocalRegressionRobust(hostList, vmSelectionPolicy,
RandomConstants.SCHEDULING_INTERVAL, new PowerVmAllocationPolicyMigrationThresholds(
hostList, vmSelectionPolicy, 0.8)), -1);
datacenter.setDisableMigrations(false);
broker.submitVmList(vmList);
broker.submitCloudletList(cloudletList);
double lastClock = CloudSim.startSimulation();
List<Cloudlet> newList = broker.getCloudletReceivedList();
Log.printLine("Received " + newList.size() + " cloudlets");
CloudSim.stopSimulation();
RandomHelper.printResults(datacenter, vmList, lastClock, experimentName, RandomConstants.OUTPUT_CSV,
outputFolder);
} catch (Exception e) {
e.printStackTrace();
Log.printLine("Unwanted errors happen");
}
Log.printLine("Finished " + experimentName);
} }
} }
...@@ -33,7 +33,7 @@ public class MadMc { ...@@ -33,7 +33,7 @@ public class MadMc {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "mad"; // Median Absolute Deviation VM allocation policy String vmAllocationPolicy = "mad"; // Median Absolute Deviation (MAD) VM allocation policy
String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy
String parameter = "2.5"; // the safety parameter of the MAD policy String parameter = "2.5"; // the safety parameter of the MAD policy
......
...@@ -33,7 +33,7 @@ public class MadMmt { ...@@ -33,7 +33,7 @@ public class MadMmt {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "mad"; // Median Absolute Deviation VM allocation policy String vmAllocationPolicy = "mad"; // Median Absolute Deviation (MAD) VM allocation policy
String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy
String parameter = "2.5"; // the safety parameter of the MAD policy String parameter = "2.5"; // the safety parameter of the MAD policy
......
...@@ -33,7 +33,7 @@ public class MadMu { ...@@ -33,7 +33,7 @@ public class MadMu {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "mad"; // Median Absolute Deviation VM allocation policy String vmAllocationPolicy = "mad"; // Median Absolute Deviation (MAD) VM allocation policy
String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy
String parameter = "2.5"; // the safety parameter of the MAD policy String parameter = "2.5"; // the safety parameter of the MAD policy
......
...@@ -33,7 +33,7 @@ public class MadRs { ...@@ -33,7 +33,7 @@ public class MadRs {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "mad"; // Median Absolute Deviation VM allocation policy String vmAllocationPolicy = "mad"; // Median Absolute Deviation (MAD) VM allocation policy
String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy
String parameter = "2.5"; // the safety parameter of the MAD policy String parameter = "2.5"; // the safety parameter of the MAD policy
......
...@@ -33,7 +33,7 @@ public class ThrMc { ...@@ -33,7 +33,7 @@ public class ThrMc {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy String vmAllocationPolicy = "thr"; // Static Threshold (THR) VM allocation policy
String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy String vmSelectionPolicy = "mc"; // Maximum Correlation (MC) VM selection policy
String parameter = "0.8"; // the static utilization threshold String parameter = "0.8"; // the static utilization threshold
......
...@@ -33,7 +33,7 @@ public class ThrMmt { ...@@ -33,7 +33,7 @@ public class ThrMmt {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy String vmAllocationPolicy = "thr"; // Static Threshold (THR) VM allocation policy
String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy String vmSelectionPolicy = "mmt"; // Minimum Migration Time (MMT) VM selection policy
String parameter = "0.8"; // the static utilization threshold String parameter = "0.8"; // the static utilization threshold
......
...@@ -33,7 +33,7 @@ public class ThrMu { ...@@ -33,7 +33,7 @@ public class ThrMu {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy String vmAllocationPolicy = "thr"; // Static Threshold (THR) VM allocation policy
String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy String vmSelectionPolicy = "mu"; // Minimum Utilization (MU) VM selection policy
String parameter = "0.8"; // the static utilization threshold String parameter = "0.8"; // the static utilization threshold
......
...@@ -33,7 +33,7 @@ public class ThrRs { ...@@ -33,7 +33,7 @@ public class ThrRs {
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = "random"; // Random workload String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy String vmAllocationPolicy = "thr"; // Static Threshold (THR) VM allocation policy
String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy String vmSelectionPolicy = "rs"; // Random Selection (RS) VM selection policy
String parameter = "0.8"; // the static utilization threshold String parameter = "0.8"; // the static utilization threshold
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment