Optimize VM Startup Time

How to optimize the VM startup time.

🚧

Intel Nodes Only

This guide is applicable to VMs deployed on Intel nodes only. Read more about Apple ARM-based Support to see which commands and options are supported for VMs deployed on Apple ARM-based nodes.

🚧

Quick navigation

Jump to:

What is VM State | What are the benefits? | Limitations | Save VM state | Delete VM state | Deploy a VM from a saved state

For VMs deployed with Orka 1.5.0 or later, you can save their state - disk and memory. Once you save a VM state, it is used when you deploy new VMs from the same VM configuration. All new VMs use the state to boot up.

📘

Quick command/API summary

orka vm create
orka vm save-state -v <VM_ID> -y
orka vm deploy
orka vm delete-state -v <NAME> -y
POST /resources/vm/configs/save-state
DELETE /resources/vm/configs/<NAME>/delete-state

What is VM State

VM state is the VM's disk and memory at a certain moment. After saving the VM state, the VM will boot using the newly created saved state instead of the base image.

📘

IMPORTANT

When a VM boots up from a saved state the time in the VM is relevant to the time when the state is saved.

What are the benefits?

When your VM boots up from a VM saved state, the SSH, VNC, and Screenshare connectivity are already established as part of the saved state. Тhus making it immediately available after deploying. When compared to booting from the base image, boot time is substantially decreased.

👍

VM deployment with and without a saved state

According to our tests, when a VM is deployed from a VM configuration with a saved state for the first time on a node, it can be accessed via SSH, VNC, or Screen sharing in 30% less time than if it were deployed from a configuration without a saved state.

In case of a consecutive deployment from a VM configuration with a saved state, accessing the VM via SSH, VNC, or Screen sharing is more than two times faster compared to deployment from a VM configuration without a saved state.

Limitations

  • Once you save the VM state, it is associated with the relevant VM configuration. All the further VMs deployed from this VM configuration will use the saved state to boot up. To deploy a VM using the VM configuration base image, you need to delete the VM saved state first.

  • When you save a VM state, you won't be allowed to commit changes to the VM configuration base image. To commit to the base image, you need to ensure no other VMs or VM saved states are using it.

  • You can save VM state only for VMs which have GPU passthrough disabled.

  • You may observe delays in the deployment times the first time you deploy a VM configuration with a saved state on a node. Nevertheless, deploying with a saved state gives you access to the VM via SSH, VNC, or Screen sharing faster than when you deploy without a saved state.

Save VM state

To save a VM state you need at least one deployed VM.

ToolCommand
Orka CLIorka vm save-state -v <VM_ID> -y
Orka APIcurl --location --request POST 'http://<orka-api-ip>/resources/vm/configs/save-state' --header 'Content-Type: application/json' --header 'Authorization: Bearer <TOKEN>' --data-raw '{ "orka_vm_name": "<VM_ID>" }'

Replace <orka-api-ip> with 10.221.188.20, 10.221.188.100, or your Orka domain, or your external custom domain. Note that for Orka and custom domains you need to switch to https.

Delete VM state

ToolCommand
Orka CLIorka vm delete-state -v <NAME> -y
Orka APIcurl --location --request DELETE 'http://<orka-api-ip>/resources/vm/configs/<NAME>/delete-state' --header 'Content-Type: application/json' --header 'Authorization: Bearer <TOKEN>' --data-raw ''

Replace <orka-api-ip> with 10.221.188.20, 10.221.188.100, or your Orka domain, or your external custom domain. Note that for Orka and custom domains you need to switch to https.

Deploy a VM from a saved state

ToolCommand
Orka CLIorka vm create -v <NAME> -b <BASE_IMAGE> -c <CPU_COUNT> -C <vCPU_COUNT> -y

orka vm save-state -v <VM_ID> -y

orka vm deploy -v <NAME> -y
Orka APIcurl --location --request POST 'http://<orka-api-ip>/resources/vm/create' --header 'Content-Type: application/json' --header 'Authorization: Bearer <TOKEN>' --data-raw '{ "orka_vm_name": "<NAME>", "orka_base_image": "<BASE_IMAGE\>", "orka_image": "<NAME>", "orka_cpu_core": <CPU_COUNT>, "vcpu_count": <vCPU_COUNT> }'

curl --location --request POST 'http://<orka-api-ip>/resources/vm/deploy' --header 'Content-Type: application/json' --header 'Authorization: Bearer <TOKEN>' --data-raw '{ "orka_vm_name": "<NAME>" }'

curl --location --request POST 'http://<orka-api-ip>/resources/vm/configs/save-state' --header 'Content-Type: application/json' --header 'Authorization: Bearer <TOKEN>' --data-raw '{ "orka_vm_name": "<VM_ID>" }'

curl --location --request POST 'http://<orka-api-ip>/resources/vm/deploy' --header 'Content-Type: application/json' --header 'Authorization: Bearer <TOKEN>' --data-raw '{ "orka_vm_name": "<NAME>" }'

Replace <orka-api-ip> with 10.221.188.20, 10.221.188.100, or your Orka domain, or your external custom domain. Note that for Orka and custom domains you need to switch to https.


© 2019-2023 Copyright MacStadium, Inc. – Documentation built with readme.com. Orka is a registered trademark of MacStadium, Inc.