Commit 6645832b authored by Anton Beloglazov's avatar Anton Beloglazov

Fixed the examples of the static threshold policy with a random workload

parent dbf5b821
...@@ -10,7 +10,7 @@ public class Constants { ...@@ -10,7 +10,7 @@ public class Constants {
public final static boolean OUTPUT_CSV = false; public final static boolean OUTPUT_CSV = false;
public final static double SCHEDULING_INTERVAL = 300; public final static double SCHEDULING_INTERVAL = 300;
public final static double SIMULATION_LIMIT = 24 * 60 * 60; public final static double SIMULATION_LIMIT = 24 * 60;
public final static int CLOUDLET_LENGTH = 2500 * (int) SIMULATION_LIMIT; public final static int CLOUDLET_LENGTH = 2500 * (int) SIMULATION_LIMIT;
public final static int CLOUDLET_PES = 1; public final static int CLOUDLET_PES = 1;
......
...@@ -7,6 +7,16 @@ import java.io.IOException; ...@@ -7,6 +7,16 @@ import java.io.IOException;
* optimization of the VM allocation. The adjustment of the hosts' power consumption according to * optimization of the VM allocation. The adjustment of the hosts' power consumption according to
* their CPU utilization is happening in the PowerDatacenter class. * their CPU utilization is happening in the PowerDatacenter class.
* *
* 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 * @author Anton Beloglazov
* @since Jan 5, 2012 * @since Jan 5, 2012
*/ */
...@@ -55,8 +65,8 @@ public class Dvfs extends RandomRunnerAbstract { ...@@ -55,8 +65,8 @@ public class Dvfs extends RandomRunnerAbstract {
boolean outputToFile = false; boolean outputToFile = false;
String inputFolder = ""; String inputFolder = "";
String outputFolder = ""; String outputFolder = "";
String workload = ""; String workload = "random"; // Random workload
String vmAllocationPolicy = "dvfs"; String vmAllocationPolicy = "dvfs"; // DVFS policy without VM migrations
String vmSelectionPolicy = ""; String vmSelectionPolicy = "";
String parameter = ""; String parameter = "";
...@@ -70,4 +80,5 @@ public class Dvfs extends RandomRunnerAbstract { ...@@ -70,4 +80,5 @@ public class Dvfs extends RandomRunnerAbstract {
vmSelectionPolicy, vmSelectionPolicy,
parameter); parameter);
} }
} }
...@@ -18,6 +18,19 @@ import org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple; ...@@ -18,6 +18,19 @@ import org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple;
/** /**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all * A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time. * the time.
*
* 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 NonPowerAware { public class NonPowerAware {
...@@ -28,7 +41,7 @@ public class NonPowerAware { ...@@ -28,7 +41,7 @@ public class NonPowerAware {
* @throws IOException * @throws IOException
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
String experimentName = "npa"; String experimentName = "random_npa";
String outputFolder = "output"; String outputFolder = "output";
Log.setDisabled(!Constants.ENABLE_OUTPUT); Log.setDisabled(!Constants.ENABLE_OUTPUT);
......
package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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 ThrMc extends RandomRunnerAbstract {
public ThrMc(
boolean enableOutput,
boolean outputToFile,
String inputFolder,
String outputFolder,
String workload,
String vmAllocationPolicy,
String vmSelectionPolicy,
String parameter) {
super(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
public static void main(String[] args) throws IOException {
boolean enableOutput = true;
boolean outputToFile = false;
String inputFolder = "";
String outputFolder = "";
String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy
String vmSelectionPolicy = "mmt"; // Maximum Correlation VM selection policy
String parameter = "0.8"; // the static utilization threshold
new Dvfs(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
}
package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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 ThrMmt extends RandomRunnerAbstract {
public ThrMmt(
boolean enableOutput,
boolean outputToFile,
String inputFolder,
String outputFolder,
String workload,
String vmAllocationPolicy,
String vmSelectionPolicy,
String parameter) {
super(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
public static void main(String[] args) throws IOException {
boolean enableOutput = true;
boolean outputToFile = false;
String inputFolder = "";
String outputFolder = "";
String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy
String vmSelectionPolicy = "mmt"; // Minimum Migration Time VM selection policy
String parameter = "0.8"; // the static utilization threshold
new Dvfs(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
}
package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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 ThrMu extends RandomRunnerAbstract {
public ThrMu(
boolean enableOutput,
boolean outputToFile,
String inputFolder,
String outputFolder,
String workload,
String vmAllocationPolicy,
String vmSelectionPolicy,
String parameter) {
super(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
public static void main(String[] args) throws IOException {
boolean enableOutput = true;
boolean outputToFile = false;
String inputFolder = "";
String outputFolder = "";
String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy
String vmSelectionPolicy = "mu"; // Minimum Utilization VM selection policy
String parameter = "0.8"; // the static utilization threshold
new Dvfs(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
}
package org.cloudbus.cloudsim.examples.power.random;
import java.io.IOException;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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 ThrRs extends RandomRunnerAbstract {
public ThrRs(
boolean enableOutput,
boolean outputToFile,
String inputFolder,
String outputFolder,
String workload,
String vmAllocationPolicy,
String vmSelectionPolicy,
String parameter) {
super(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
public static void main(String[] args) throws IOException {
boolean enableOutput = true;
boolean outputToFile = false;
String inputFolder = "";
String outputFolder = "";
String workload = "random"; // Random workload
String vmAllocationPolicy = "thr"; // Static Threshold VM allocation policy
String vmSelectionPolicy = "rs"; // Random Selection VM selection policy
String parameter = "0.8"; // the static utilization threshold
new Dvfs(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
workload,
vmAllocationPolicy,
vmSelectionPolicy,
parameter);
}
}
package org.cloudbus.cloudsim.examples.power.random;
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.PowerVmAllocationPolicyMigrationStaticThreshold;
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
* the time.
*/
public class ThresholdsMc {
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
String experimentName = "thresh_mc_0.8";
String outputFolder = "output";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = RandomHelper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS);
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS);
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter",
PowerDatacenter.class, hostList, new PowerVmAllocationPolicyMigrationStaticThreshold(hostList,
new PowerVmSelectionPolicyMaximumCorrelation(
new PowerVmSelectionPolicyRandomSelection()), 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;
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.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*/
public class ThresholdsMmt {
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
String experimentName = "thresh_mmt_0.8";
String outputFolder = "output";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = RandomHelper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS);
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS);
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter",
PowerDatacenter.class, hostList, new PowerVmAllocationPolicyMigrationThresholds(hostList,
new PowerVmSelectionPolicyMinimumMigrationTime(), 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;
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.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*/
public class ThresholdsMu {
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
String experimentName = "thresh_mu_0.8";
String outputFolder = "output";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = RandomHelper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS);
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS);
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter",
PowerDatacenter.class, hostList, new PowerVmAllocationPolicyMigrationThresholds(hostList,
new PowerVmSelectionPolicyMinimumUtilization(), 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;
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.PowerVmAllocationPolicyMigrationThresholds;
import org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*/
public class ThresholdsRs {
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
String experimentName = "thresh_rs_0.8";
String outputFolder = "output";
Log.setDisabled(!RandomConstants.ENABLE_OUTPUT);
Log.printLine("Starting " + experimentName);
try {
CloudSim.init(1, Calendar.getInstance(), false);
DatacenterBroker broker = RandomHelper.createBroker();
int brokerId = broker.getId();
List<Cloudlet> cloudletList = RandomHelper.createCloudletList(brokerId, RandomConstants.NUMBER_OF_VMS);
List<Vm> vmList = RandomHelper.createVmList(brokerId, cloudletList.size());
List<PowerHost> hostList = RandomHelper.createHostList(RandomConstants.NUMBER_OF_HOSTS);
PowerDatacenter datacenter = (PowerDatacenter) RandomHelper.createDatacenter("Datacenter",
PowerDatacenter.class, hostList, new PowerVmAllocationPolicyMigrationThresholds(hostList,
new PowerVmSelectionPolicyRandomSelection(), 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);
}
}
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