From 1f5bf69c069c6c96706d36ed249fc35ce00c071f Mon Sep 17 00:00:00 2001 From: Andreas Egger Date: Thu, 13 Jun 2013 13:27:03 +0200 Subject: [PATCH] Adjust migration algorithm to get max. utilization --- src/at/ac/tuwien/lsdc/SchedSimulator.java | 8 ++++---- .../tuwien/lsdc/sched/AbstractSchedulerWithMigration.java | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/at/ac/tuwien/lsdc/SchedSimulator.java b/src/at/ac/tuwien/lsdc/SchedSimulator.java index 2ed2bb3..1c03d04 100644 --- a/src/at/ac/tuwien/lsdc/SchedSimulator.java +++ b/src/at/ac/tuwien/lsdc/SchedSimulator.java @@ -41,9 +41,9 @@ public class SchedSimulator { if (args.length == 7) { parseCommandLineArgs(args); } else if (args.length == 1) { - String[] newArgs = args[0].split(" "); - if (newArgs.length == 7) { - parseCommandLineArgs(newArgs); + String[] splitArgs = args[0].split(" "); + if (splitArgs.length == 7) { + parseCommandLineArgs(splitArgs); } else { log.info(USAGE); System.exit(1); @@ -92,8 +92,8 @@ public class SchedSimulator { String schedulerLogStr = args[6]; try { - scenario = ScenarioType.valueOf(scenarioStr); schedulerType = SchedulerType.valueOf(schedulerTypeStr); + scenario = ScenarioType.valueOf(scenarioStr); numPMs = Integer.parseInt(numPMsStr); numCloudPartners = Integer.parseInt(numCloudPartnersStr); inputFile = new File(inputFileStr); diff --git a/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java b/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java index e0fff5a..26d90ae 100644 --- a/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java +++ b/src/at/ac/tuwien/lsdc/sched/AbstractSchedulerWithMigration.java @@ -38,7 +38,9 @@ public abstract class AbstractSchedulerWithMigration extends AbstractScheduler { VirtualMachine currentVM = currentPM.getVirtualMachines().values().iterator() .next(); for (Application app : currentVM.getApplications()) { - for (int j = i; i < pms.size(); i++) { + + // try to fit app on most utilized machine to get maximum utilization + for (int j = pms.size()-1; j > i; j--) { PhysicalMachine nextPM = pms.get(j); if (nextPM.isRunning() && (nextPM.getTotalVMs() > 0)) { VirtualMachine nextVM = nextPM.getVirtualMachines().values().iterator() -- 2.43.0