#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to perform load balancing using CloudSim?
  • Configure Datacenter, Host, Vms and cloudlets

    vmlist = createVM();

    broker.submitVmList(vmlist);

    newList = createCloudlet();

    broker.submitCloudletList(newList);

  • Find Utilization of resources

    double mip = server.getAvailableMips();

    double band = server.getUtilizationOfBw();

    long st = server.getStorage();

    avmip[x] = ((instruction – mip) / instruction) * 100;

    System.out.println(“Host: ======> ” + hostId);

    System.out.println(“Average cpu utilization is ======> ” + avmip[x]);

    hostlMap.put(avmip[x], hst);

    mipsAvg.add(avmip[x]);

    avband[x] = ((bandwidth – BW) / bandwidth) * 100;

    System.out.println(“Average BW utilization is ======> ” + avband[x]);

    avmem[x] = ((size – MEM) / size) * 100;

    System.out.println(“Average mem utilization is ======> ” + avmem[x] + “\n\n”);

  • VMs from the hosts that are overutilized are migrated to other hosts to reduce the execution time of the tasks.

    overUtilizedHost.put(idhost, ht);

    pm.removeMigratingInVm(vi);

    boolean result = alloc.allocateHostForVm(vi, toGet, newCreated);

    send(this.getId(), delay, CloudSimTags.VM_MIGRATE, ma);

  • VMs from the hosts that are under utilized are migrated to other hosts and the corresponding hosts are put into switched off.

    PM pm = (PM) underUtilized;

    machine[g] = vmToMigrate.get(g);

    System.out.println(“VMs to migrate: ” + machine[g].getId());

    send(this.getId(), delay, CloudSimTags.VM_MIGRATE, ma);

  • Print execution time of task.

    for (int i = 0; i < size; i++) {

    cloudlet = list.get(i);

    Log.print(indent + cloudlet.getCloudletId() + indent + indent);

    if (cloudlet.getCloudletStatus() == CreatedCloudlet.SUCCESS) {

    Log.print(“SUCCESS”);

    Log.printLine(indent + indent + cloudlet.getResourceId()

    + indent + indent + indent + cloudlet.getVmId()

    + indent + indent

    + dft.format(cloudlet.getActualCPUTime()) + indent

    + indent + dft.format(cloudlet.getExecStartTime())

    + indent + indent

    dft.format(cloudlet.getFinishTime()));

    }

    }