Lab Setup
One-time setup for the hands-on appendix demos: the two-guest KVM lab (Appendix A and B) and OpenShift Local (CRC) for the KubeVirt RDMA demo (Appendix C).
The appendix demos run against environments you stand up once and reuse. This
page is the prerequisites and one-time setup for those environments, so each
appendix’s walkthrough can stay about the demo itself. Nothing here changes your
host: the labs run as your own unprivileged user in throwaway guests and in a
user-mode cluster, with no host kernel, boot-parameter, or package change and no
sudo on the host.
The chapter examples (Chapters 0 through 10) are different and need none of this: they build and run on the host with the project’s C++ toolchain, and each example’s README covers that. This page is only for the hands-on appendix demos.
Which appendix needs what
| Appendix | Demo | Environment |
|---|---|---|
| A, sharing memory between VMs | examples/12-inter-vm-ipc |
The two-guest KVM lab |
| B, remote memory across hosts | examples/13-rdma-remote-memory |
The two-guest KVM lab |
| C, RDMA on OpenShift Virtualization | examples/14-openshift-virt-rdma |
OpenShift Local (CRC) |
Clone the repository once and work from its root:
git clone https://github.com/patterncatalyst/latency-patterns-in-cpp.git
cd latency-patterns-in-cpp
The two-guest KVM lab (Appendix A and B)
Both of these appendices boot two throwaway Fedora guests directly with
qemu-system-x86_64, as your own user. You need:
- KVM enabled, with
/dev/kvmreadable and writable by your user (a group such askvmis enough). qemu-system-x86_64installed./dev/vhost-vsockusable by your user (Appendix A’s vsock lane) and a writable/dev/shmtmpfs (Appendix A backs its shared-memory region with a/dev/shmfile, never host HugePages).virtiofsdavailable (Appendix A’s virtio-fs lane).cloud-localds(fromcloud-utils) and a Fedora cloud image, which the scripts underscripts/lab/use to boot the guests.- Enough free RAM for two small guests, about 2 GB each.
Check the device nodes:
ls -l /dev/kvm /dev/vhost-vsock && ls -ld /dev/shm
Nothing is installed on the guests ahead of time. At first boot each guest’s
cloud-init installs what the demo needs: rdma-core, the RDMA development
libraries, gcc-c++, and the rxe software-RoCE module for Appendix B, and the
shared-memory and vsock lanes for Appendix A need no extra packages at all.
Appendix A’s benchmark is built on the host with the project’s C++ toolchain and shipped into the guests as a static binary, so run the toolchain bootstrap once:
scripts/bootstrap-toolchain.sh
Appendix B’s one-sided RDMA program is C++ and is compiled inside the guests, so
it needs no host toolchain. Each appendix page walks the ./demo.sh steps from
there.
OpenShift Local / CRC (Appendix C)
Appendix C runs two KubeVirt virtual machines on a single-node OpenShift Local (CRC) cluster. CRC is itself a virtual machine running as your user, so this still changes nothing on the host. You need:
- CRC installed, configured, and set up, with nested virtualization on so the single CRC node can itself run virtual machines.
crc,oc, andcurlon your PATH. The demo downloadsvirtctlfrom the cluster on first use.- A KVM-capable host with enough free RAM for CRC’s allocation, around 32 GB.
CRC is memory-hungry. Size it before the first start, roughly 12 vCPU, 32 GB, and an 80 GB disk:
crc config set cpus 12
crc config set memory 32768
crc config set disk-size 80
crc setup
The demo reads the kubeadmin password from crc at run time and never stores
or prints it. A running CRC instance holds its full memory allocation whether or
not the demo is using it, so run ./demo.sh down stop when you finish to stop
the cluster and free that RAM. From there the Appendix C page walks the
./demo.sh up / vms / run / down steps.