Workaround: Layer-2 Cache on GPT using VHD(x)

FAQ, getting help, user experience about PrimoCache
Post Reply
SkAzZ
Level 1
Level 1
Posts: 1
Joined: Thu Feb 20, 2014 3:08 pm

Workaround: Layer-2 Cache on GPT using VHD(x)

Post by SkAzZ »

I could not use a physical partition on my System drive for the L2 Cache because it uses GPT, so I created a Virtual Hard Disk for it.

I mounted this VHD(x) and managed to get primoacache to format it as its L2 Cache drive, and it appears to be working just fine!

Setting up MBR VHD(x)
To use the VHD(x) for the Layer-2 Caching it needs to be configured as MBR not GPT, when you create a VHD it creates it as the partition type of your disk, for me it was GPT and the disk management does not give you the option to change it. This can be worked around by using Diskpart to convert the virtual disk to MBR and here is how to do it:
  • Press Win+R (for Run Dialog), type diskmgmt.msc and press enter;
  • In the list view, select the disk you wish to put the VHD on;
  • In the top menu, go Action then Create VHD;
  • Choose the Location, Size, select VHDX and use fixed or expanding;
  • When you create it, it will mount itself, or at this point just mount it yourself by right clicking the file and clicking mount;
  • Press Win+R, type diskpart, press enter and say Yes to UAC;
  • In the diskpart Window, type LIST DISK and press enter;
  • SELECT DISK # where instead of the # you put the disk of the VHD using the list above (careful!);
  • Make sure the correct disk is select using LIST DISK again where a asterisk/star is next to the Disk # in the list
  • Type CONVERT MBR and press enter;
  • Now tell primocache to use the VHD MBR disk for the Layer-2 Cache.
VHD Benchmarks
I've done a bunch of benchmarks proving the VHD does not have a negative impact. Here are the Cache Drive, VHD Thin and Thick Provisioned Speeds:
SSD Cache Drive
SSD Cache Drive
a_drive_nocache.png (96.35 KiB) Viewed 3425 times
VHDX Thin Provisioned on SSD Cache Drive
VHDX Thin Provisioned on SSD Cache Drive
a_vhd_thin_cache_notaligned_rerunSeqWrite4MB.png (97.67 KiB) Viewed 3425 times
VHDX Thick Provisioned on SSD Cache Driv
VHDX Thick Provisioned on SSD Cache Driv
a_vhd_thick_cache_notaligned_rerunSeqWrite4MB.png (96.85 KiB) Viewed 3425 times
You see there is no notable performance loss vs a physical partition and the 10% marginal differences are reasonable. There is also no notable performance difference between Thin and Thick provisioning, but the format for layer-2 caching will expand it to its used size regardless.

Did notice the 4K QD16 (16 random threads reading 4K blocks) is 10k IOPS less using VHDX, but I reckon if I were to rerun that test till it gave 45K it would do so. Actually its probably the same thing as the Seq 4M write which I needed to re-run once to get the correct speed.

Other Notes
I was not sure what forum section to put this in, hope here will do.

If there are any oddities to this setup I have yet to discover them, but feel free to post in this thread or reference to it as the method you are using. If you do get odd behaviour with primocache, this method will need to be eliminated to fix any problems. (Not that I am any authority here, 1st post, just thought this would be useful to people)

I don't see why primocache would even notice the layer-2 cache is on the VHD, it's almost as transparent as a Folder Junction. I don't know about low-level I/O with Windows C but a range of bytes is just a range of bytes, primocache could use a Layer-2 Cache File instead of a partition, just different read/write functions within different ranges. (not trying to be disparaging to romex, I'm sure they have a really good reason)

The VHD will auto-mount if you leave it mounted when you shut-down, I am confident that it does not get dismounted on shut-down before primocache is finished with it. As an after thought, I think the auto mount/dismount is done in time for primocache to start and stop using it, but this could cause a problem if it dismounts before primocache is done with it or does not start soon enough for primocache to start using during boot-up.

I am using VHDX because I am on Windows 8.1, if you are on 7 then you may be stuck with just VHD.

I also noticed the benchmark software said the Alignment of the VHD is '64KB NOT OK', but I ran a few checks with fsutil/diskpart and it seems to be aligned to the blocks all-right, probably just miss-reporting because it is a VHD.

All in all, hope this helps! =]
Post Reply