org.cloudsimplus.selectionpolicies.VmSelectionPolicyMinimumUtilization Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudsim-plus Show documentation
Show all versions of cloudsim-plus Show documentation
CloudSim Plus: A modern, highly extensible and easier-to-use Java 8+ Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services
The newest version!
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2012, The University of Melbourne, Australia
*/
package org.cloudsimplus.selectionpolicies;
import org.cloudsimplus.hosts.Host;
import org.cloudsimplus.vms.Vm;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import static java.util.Comparator.comparingDouble;
/**
* A VM selection policy that selects for migration the VM with Minimum Utilization (MU)
* of CPU.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
*
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class VmSelectionPolicyMinimumUtilization implements VmSelectionPolicy {
@Override
public Optional getVmToMigrate(final Host host) {
final List migratableVms = host.getMigratableVms();
if (migratableVms.isEmpty()) {
return Optional.empty();
}
final Predicate inMigration = Vm::isInMigration;
final Comparator vmCpuUsageComparator = comparingDouble(Vm::getCpuPercentUtilization);
return migratableVms.stream()
.filter(inMigration.negate())
.min(vmCpuUsageComparator);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy