Sunday, March 5, 2017

RAMdisk performance in a virtual machine

Thought I would share some performance testing I have done, regarding using RAM disks in conjunction with virtual machines.

imageI am using VMware Workstation, to do a lot of software demonstrations, and of course wants the best performance possible, when in front of potential customers. So I am dragging around one of the fastest laptops on the market, Dell XPS 15 9550 spec’ed as you can see in the picture, using it as the Host machine for my demo VM’s. The physical HD is a 1TB SSD.

imageSo with plenty of RAM, I want to se if I can squeeze some more performance out my VM’s, running web applications with databases intensive tasks. My intention is to move both websites and DB to RAMdisks, and wanted to see if I should just create one RAMdisk for both website and DB’s of have two RAMdisk, one for the websites and one for the DB’s.

My VM is Microsoft Windows Server 2012 R2 Standard, and configures as in the picture.

One thing to note about VMware configuration, is that VMware has a general setting, where you can force to keep the VM’s in physical RAM, so that when configured to use 16 GB, it will use 16 GB physical RAM, and not try to swap some of the ram to the hard drive. Not sure how it affects a RAMdisk inside the VM, but to be sure I have enabled this option.

I am using . Did a lot of investigation, as there is many RAMdisk vendors out there. Softperfect RAM disk, was chosen because of top performance, ability to create persistent disks and OK price ($29.00 private/$49.00 Business).

So on to the testing. First, some normal disk performance figures running CrystalDiskMark (CDM), both inside the VM and on the host. As you can see, there is a performance penalty inside the virtual machine, when it comes to disk performance.

Standard VM disk For reference, Host physical SSD
image image

Next, performance of RAMdisk.

RAMdisk inside the VM For reference, Host RAMdisk
image image

As expected, significant performance increase, compared to regular disks, both inside VM and on the Host.

Odd thing here is that the 4K tests inside the VM actually out performs the same on the host.

Now lets see if we can get higher performance with two RAMdrive’s inside the VM, tested simultaneously
RAMdrive 1 RAMdrive 2
image image

A small performance gain, but I am sure that it is caused by the two tests, not running 100% in sync. CDM does each test 5 time, and pauses both between each repetition and each of the eight test. As the tests are not pausing at exactly the same time, one of the CDM instances will have 100% of the bandwidth on its own.

One thing to note here is that, even running two instances of CDM, only one CPU kernel is used, and it is maxing out.
IO and CPU performance counters  
image image

Just for reference, testing two RAMdrive’s simultaneously on the host. ON the Host, we have the same issue that both CDM instances uses CPU1 that is maxed out, and the sum Read/Write is about the same as for one RAMdisk.
Two RAM drives on host – IO performance counter
image  image  image

Just to confirm, the problem running two instances of CDM at the same time, I have also tested with one RAM Disks inside the VM (NTFS), but tested simultaneously with two instances of CDM. Results here are mixed. Some are better than when testing two RAM disks, some are worse. Again, sure that this is caused by the two instances not being 100% in sync.

As you can see in the I/O graph, comparing it to the same for testing two RAMdisks, the read sequences, are slightly more off. For the pink write test, especially the second last one, they run more simultaneously, and here we actually gets less MB/s compared to writing to two disks.
image image image


Great performance gain of using RAMdisk. No real gain of using two disks, but this can be caused by several reasons. CDM only using one CPU that max out, is one of them. But it could also be that Soft perfect RAM disk driver is handling both disks.

As for my own purpose, I have moved my websites and DB’s to a RAM disk, and see a significant increase in especially load time when hitting my websites for the first time after boot. As the websites/applications utilize heavy caching, once warmed up, there is not much difference. But my websites has some DB heavy publishing process, where huge amount of date is read/written to my databases. One of these process take about 10 minutes, with website and DB’s moved to a RAMdisk, I was able to cut that down to 6 minutes.

One caveat of RAMdisk the way I am using it, using persistent disks, is that it takes longer booting and shutting down the VM. In my case, I have a 6GB persistent disk, and that of course need to be loaded every time I boot the machine, as well as written to disk on shutdown. Also there is a risk associated with RAMdisks, as you loose all data when your machine crash. Softperfect has an option, to write the content of persistent RAM disks to its disk file, at configurable intervals, and you can also do it manually.

This also affects Microsoft SQL Server, as the RAMdisk, on boot, actually does not get loaded fast enough, so the DB you have on RAMdisk, will go into recovery mode. This can be fixed, just restarting the SQL server service. You can also make SQL Server service delay start, or start it manually.

No comments:

Post a Comment