How to use workload partitioning with Red Hat OpenShift Container Platform

Learn how to use workload partitioning with Red Hat® OpenShift® Container Platform to benefit resource-constrained environments.

This learning path is for operations teams or system administrators
Developers may want to check out Network observability with eBPF on developers.redhat.com. 

Get started on developers.redhat.com

Testing workload isolation with a virtual machine

1 hr and 20 mins

We’ve seen how workload partitioning works on cluster nodes, but it can also be applied to virtual machines (VM). Now we can test with virtual machines managed by Red Hat OpenShift Virtualization.

What will you learn?

  • How virtual machines can use workload isolation

What you need before starting:

Create a virtual machine

Use the OpenShift console or virtctl to create a virtual machine with 4 CPU cores in a project/namespace.

A screenshot of Red Hat console showing a virtual machine created from the virtctl command.
A screenshot of Red Hat console showing a virtual machine created from the virtctl command.

Access the VM and run a stress test

Use virtctl to SSH into the VM and execute the stress-ng command.

# Download and install virtctl if you haven't already
wget --no-check-certificate https://hyperconverged-cluster-cli-download-openshift-cnv.apps.demo-01-rhsys.wzhlab.top/amd64/linux/virtctl.tar.gz
tar zvxf virtctl.tar.gz
mv virtctl ~/.local/bin/

# SSH into the VM and run the test
virtctl -n demo ssh user@vm-name --identity-file=~/.ssh/id_rsa
stress-ng --cpu 4 --cpu-load 100 --temp-path /tmp

Observe Host CPU usage

Checking top on the host node will again show that the QEMU process for the VM is consuming CPU cycles exclusively from the isolated cores (20-23).

# top output snippet
%Cpu19 :  1.7 us,  2.0 sy,  0.0 ni, 96.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu20 : 99.0 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.7 hi,  0.0 si,  0.0 st
%Cpu21 : 96.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  1.0 hi,  2.0 si,  0.0 st
%Cpu22 : 98.7 us,  0.3 sy,  0.0 ni,  0.0 id,  0.0 wa,  1.0 hi,  0.0 si,  0.0 st
%Cpu23 : 99.0 us,  0.7 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.3 hi,  0.0 si,  0.0 st

Verifying VM Process CPU affinity

Finally, we can confirm the CPU affinity of the VM's QEMU process on the host node. This demonstrates that the entire virtual machine, as a workload, is constrained to the isolated CPU cores.

# Find the PID of the qemu-kvm process for the VM
ps -ef | grep qemu-kvm
# 107        44891   44699 62 03:04 ?        00:04:53 /usr/libexec/qemu-kvm -name guest=demo_centos-stream10-tan-tarantula-34,.............

# Check its CPU affinity
taskset -c -p 44891
# pid 44891's current affinity list: 20-23

Once you have finished this testing, we can take a look at how this all works together behind the scenes.  

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部