~~NOTOC~~
====== Overview ======
The Scheduler module is in charge of the assignment between pending Virtual Machines and known Hosts. OpenNebula's architecture defines this module as a separate process that can be started independently of ''oned''. The OpenNebula scheduling framework is designed in a generic way, so it is highly modifiable and can be easily replace by third-party developments.
====== The Match-making Algorithm ======
OpenNebula comes with a ''match making'' scheduler (//mm_sched//) that implements the //Rank Scheduling Policy//. The goal of this policy is to prioritize those resources more suitable for the VM.
The algorithm works as follows:
* First those hosts that do not meet the VM requirements (see the [[.:template|''REQUIREMENTS'' attribute]]) and do not have enough resources (available CPU and memory) to run the VM are filtered out.
* [[.:template|The ''RANK'' expression ]] is evaluated upon this list using the information gathered by the monitor drivers. Any variable reported by the monitor driver can be included in the rank expression.
* Those resources with a higher rank are used first to allocate VMs.
====== Placement Policies ======
You can implement several placement heuristics by carefully choosing the ''RANK'' expression. Note that each VM has its own ''RANK'' and so its own policy. This is specially relevant when configuring a Cloud Interface as you can apply different policies to different instance types.
===== Packing Policy=====
* **Target**: Minimize the number of cluster nodes in use
* **Heuristic**: Pack the VMs in the cluster nodes to reduce VM fragmentation
* **Implementation**: Use those nodes with more VMs running first
RANK = RUNNING_VMS
===== Striping Policy=====
* **Target**: Maximize the resources available to VMs in a node
* **Heuristic**: Spread the VMs in the cluster nodes
* **Implementation**: Use those nodes with less VMs running first
RANK = - RUNNING_VMS
===== Load-aware Policy=====
* **Target**: Maximize the resources available to VMs in a node
* **Heuristic**: Use those nodes with less load
* **Implementation**: Use those nodes with more FREECPU first
RANK = FREECPU
====== The Haizea Scheduler ======
The [[http://haizea.cs.uchicago.edu/ | Haizea lease manager]] can also be used as a scheduling module in OpenNebula. Haizea allows OpenNebula to support advance reservation of resources and queuing of best effort requests (more generally, it allows you to lease your resources as VMs, with a variety of lease terms). The Haizea documentation includes a guide on [[http://haizea.cs.uchicago.edu | how to use OpenNebula and Haizea to manage VMs on a cluster]]