What are some ways to go about running a Vagrant VM in RAM?

260 views Asked by At

I have a development environment running in a Vagrant VM (virtualBox). Considering I have 11Gb of spare RAM I thought I could run the VM completely in RAM.

Would anyone know of the approach to this and would I gain much performance from it?

1

There are 1 answers

0
Ivan On

If you have that much memory available, most probably you'll have the image cached in the host OS cache so you don't need to worry about that.

I've tried putting image files on to ramdisk on my Macbook and didn't see any improvement in 5 mins run (most of which was apt-get install stuff).

Traditionally, VirtualBox has opened disk image files as normal files, which results in them being cached by the host operating system like any other file. The main advantage of this is speed: when the guest OS writes to disk and the host OS cache uses delayed writing, the write operation can be reported as completed to the guest OS quickly while the host OS can perform the operation asynchronously. Also, when you start a VM a second time and have enough memory available for the OS to use for caching, large parts of the virtual disk may be in system memory, and the VM can access the data much faster. (c) 5.7. Host IO caching

Also the benefits you'll see greatly depend on the process you run there, if that's dominated by cpu / network, tinkering with the storage won't help you alot.