Enabling Kernel same page merging for vagrant or anybody else
Running the KubeVirt vagrant setup with 2 nodes is somewhat painful when it comes to memory consumption. But this is the price we are happy to pay for decent CI.
vagrant will launch three virtual machines (two nodes, one master) on your host. All three vagrant machines use the same (CentOS based) image, this is the optimal case for the kernel same page merger (ksm). This kernelf eatures wanders through memory pages and merges identical ones into one (if they are marked accordingly).
Using KSM on Fedora is simple, to enable it you just need to install and run some supporting services:
dnf install ksm ksmtunde
systemctl enable --now ksm ksmtuned
# Now check that it's working (if you have VMs running)
watch tail /sys/kernel/mm/ksm/*
...
== /sys/kernel/mm/ksm/pages_shared ==
379446
...
Please note that ksm requires some CPU cycles to perform the de-duplication.
::: {#footer} [ October 4th, 2017 3:24pm ]{#timestamp} [kubevirt]{.tag} [fedora]{.tag} [ksm]{.tag} [libvirt]{.tag} [vagrant]{.tag} :::