VM Scheduling in Orka 2.0

One of the new, useful features of Orka 2.0 is VM scheduling. What is it and why should you care? Learn all about VM scheduling and how it can improve your Orka cluster.

Orka VM Scheduler

Orka 2.0 has arrived, and with it came a great new feature -- VM scheduling. VM scheduling is the option to choose the scheduling algorithm for deploying VMs across the nodes in an Orka cluster.

The Problem

Imagine your Orka cluster has 2 worker nodes, with 12 vCPU each. 

Before Orka 2.0, if you deploy 2 VMs with 6 vCPU each, there will be one VM deployed on each node:

VM scheduler default

In this situation, 12 vCPUs are free in the cluster (6 vCPU remaining in each node). However, you won’t be able to deploy an additional VM with 12 vCPU, because the available resources are split between the nodes. This is how the default scheduling algorithm works. It schedules the VMs in such a way that resources are balanced between the nodes.

How Does VM Scheduling Help?

With the VM Scheduling feature, you are now able to change the scheduling algorithm used when deploying VMs. In addition to the default scheduler presented in the previous example, you can now also use the most-allocated scheduler. With the most-allocated scheduler, the above scenario results in both VMs deployed on the same node:

VM scheduler most-allocated

The most-allocated scheduler tries to schedule VMs on the same node until all available resources on that node are exhausted. Then it starts scheduling VMs on the next node with available resources.

Depending on your needs, you can choose to use one or the other.

Usage

The VM Scheduling feature is flexible and can be configured in several different ways. The scheduling algorithm can be set at the cluster level, which will dictate the scheduling algorithm used when deploying any VM. Alternatively, the scheduling algorithm can be specified per VM configuration or per VM deployment.

Change the Default Scheduler for the Cluster

To change the default scheduler for the full Orka cluster, you need to request an Orka upgrade. Once the scheduler is configured for the cluster, it will be used by default when scheduling VMs unless it is explicitly changed using the methods described below.

Configure VM Scheduler in a VM Configuration 

To change the scheduling algorithm used when deploying VMs from a certain VM config, use the --scheduler option in the CLI or the scheduler property in the API.

CLI Example

1  // configure `default` scheduler 
2 orka vm create-config -v demo -c 3 --scheduler default -y
3
4 // configure `most-allocated` scheduler
5 orka vm create-config -v demo -c 3 --scheduler most-allocated -y

API Example

1  curl --location --request POST '<orka-api-url>/resources/vm/create' \ 
2 --header 'Content-Type: application/json' \
3 --header 'orka-licensekey: <license-key>' \
4 --header 'Authorization: Bearer <token>' \
5 --data-raw '{
6 "orka_vm_name": "demo",
7 "orka_base_image": "90GCatalinaSSH.img",
8 "orka_image": "demo",
9 "orka_cpu_core": 3,
10 "vcpu_count": 3,
11 "scheduler": "<scheduler-name>"
12 }'

where <scheduler-name> is default or most-allocated

Run orka vm configs to view the scheduler configured for all existing VM configurations. All VMs deployed from a certain VM configuration will be scheduled according to this scheduler, unless explicitly overridden during deployment.

VM scheduler screen

Configure VM Scheduler while Deploying a VM

To change the scheduling algorithm used when deploying a VM, use the --scheduler option in CLI or the scheduler property in the API.

CLI Example

1  // configure `default` scheduler 
2 orka vm deploy -v demo --scheduler default -y
3
4 // configure `most-allocated` scheduler
5 orka vm deploy -v demo --scheduler most-allocated -y

API Example

1  curl --location --request POST '<orka-api-url>/resources/vm/deploy' \ 
2 --header 'Authorization: Bearer <token>' \
3 --header 'Content-Type: application/json' \
4 --data-raw '{
5 "orka_vm_name": "demo",
6 "scheduler": "<scheduler-name>"
7 }'

where <scheduler-name> is default or most-allocated