Multiqueue is a technology for multithreading network packets. When using multiqueue, packets passing through a network interface are processed by several parallel queues. Multiqueue allows you to increase VM network throughput at the expense of increased CPU resource consumption.
Features of the function
In the current version of the platform operation with multiqueue is available only via API.
The function is available only in clusters with KVM virtualization.
If multiqueue is not configured, each NIC in the VM uses one queue.
The number of queues on each interface of a VM cannot exceed the number of its vCPUs. If the number of vCPUs becomes less than the number of queues, the number of queues is automatically reduced.
Changing the number of queues is supported only for VirtIO devices.
Multiqueue configuring
Creating the VM configuration
To create a VM configuration with multiqueue, perform a POST request /vm/v3/preset. Specify the number of queues in the iface_queues parameter.
curl -X 'POST' \
'localhost:1500/vm/v3/preset' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'internal-auth:on' \
-d '{
"name": “test_preset",
"cpu_number": 4,
"ram_mib": 2048,
"virtualization_type": "kvm",
"hdd_mib": 1024,
"iface_queues": 2
}'
Changing the VM configuration
To change the configuration of a VM with multiqueue, perform a POST request /vm/v3/preset/{preset_id}. Specify the number of queues in the iface_queues parameter.
curl -X 'POST' \
'localhost:1500/vm/v3/preset/1' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'internal-auth:on' \
-d '{
"name": “test_preset",
"cpu_number": 4,
"ram_mib": 2048,
"virtualization_type": "kvm",
"iface_queues": 2
}'
VM creation
To create a VM with multiqueue, perform a POST request /vm/v3/host. Specify the number of queues in the queues parameter for each interface.
curl -X 'POST' \
'localhost:1500/vm/v3/host' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'x-xsrf-token: some_token' \
-d '{
"cpu_number": 4,
"custom_interfaces": [
{
"bridge_id": 1,
"is_main_network": true,
"model": "virtio",
"queues": 4
}
],
"vxlan": [
{
"id": 5,
"ipnet": 12,
"ipv4_number": 1,
"model": "virtio",
"queues": 3
}
]
}'
Creating a VM network interface
To create a network interface with multiqueue, perform a POST request /vm/v3/host/{host_id}/iface. Specify the number of queues in the queues parameter.
curl -X 'POST' \
'localhost:1500/vm/v3/host/1/iface' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'internal-auth:on' \
-d '{
"bridge_id": 124,
"ip_count": 1,
"ippool": 1,
"is_main_network": true,
"mac": "AA:BB:CC:DD:EE:FF",
"model": "virtio",
"no_ip": false,
…
"queues": 2
}'
Changing a VM network interface
To change a network interface with multiqueue, perform a POST request /vm/v3/host/{host_id}/iface/{iface_id}. Specify the number of queues in the queues parameter.
curl -X 'POST' \
'localhost:1500/vm/v3/host/1/iface/1' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'internal-auth:on' \
-d '{
"model": "virtio",
"queues": 3
}'
Possible errors
The following errors may occur when working with multiqueue:
Diagnostics
To see the number of queues on network interfaces:
- Connect to the VM via SSH.
- Run the command: Examine the output of the command. The number of queues is displayed for each interface in the numtxqueues and numrxqueues parameters.
ip -d a show