How to estimate the dirty rate of a Virtual Machine without triggering a Live Migration in OpenShift Virtualization?
Environment
- Red Hat OpenShift Container Platform 4.x
- OpenShift Virtualization 4.x
Issue
- A heavy VM that does not migrate easily, how to estimate the required bandwidth for its migration?
- How to monitor a VM dirty rate?
Resolution
1. Find the Pod of the VM
# oc get pods
NAME READY STATUS RESTARTS AGE
virt-launcher-rhel-96-c2dm2 2/2 Running 0 40m
2. Use environment variables to define the Pod name (from above), and the monitoring period (60s in the example)
# POD=virt-launcher-rhel-96-c2dm2
# PERIOD=60
3. Run the following command and wait for the results:
# oc rsh $POD virsh domdirtyrate-calc 1 $PERIOD && sleep $PERIOD && oc rsh $POD virsh domstats 1 --dirtyrate
4. Once the defined period has elapsed, the statistics will be shown:
dirtyrate.calc_status=2
dirtyrate.calc_start_time=1765513585
dirtyrate.calc_period=60
dirtyrate.calc_mode=page-sampling
dirtyrate.megabytes_per_second=173 <---------
5. In the example above, a live-migration of this VM will need more than 173MB/s (or 1384Mbit/s), and therefore a 1G NIC would generally not be sufficient without longer downtimes, auto-converge or post-copy techniques. Ideally, the network speed should be higher than this number.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.