vm-bhyve swap space usage

Rodney W. Grimes freebsd-rwg at pdx.rh.CN85.dnsmgr.net
Wed Nov 14 16:10:42 UTC 2018


> Hi Folks,
> 
> I've recently started using vm-bhyve-1.2.3, on FreeBSD 11.2-RELEASE-p4 and noticed three processes, one for each VM, using swap as indicated by top -w.
> The processes are running the "vm" script as follows -         /bin/sh /usr/local/sbin/vm -tf _run {vm name}.
> Is this expected behaviour?

Have you over taxed your avaliable physical ram?  If so then yes,
this is expected behavior.  Bhyve uses "swap backed anon memory
regiones" for the memory configured to the vm.   If you do not
have that much spare free memory your system well start to swap,
including the vm processes.

You can specify a wired memory option to prevent the vm's from
using swap, but be aware that places memory pressure on other
parts of the system.  (I still stronly recommend doing this,
unless you have lots of vm's that are mostly idle and can have
slow responsiveness.)

bhyve -S option, not sure how to do that in vm-bhyve-1.2.3

Further note that if your using zfs the configuration for
it by default is to use up to 95% of your host memory
for ARC cache, this interacts very poorly with bhyve, and
I recommend reducing the max arc cache size by the amount
of memory allocated to all VM's.

sysctl vfs.zfs.arc_max


-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-virtualization mailing list