Optimizing a Windows 10 VM for PowerBI
If you run powerBI in a VM, and you’re working with a large dataset, there are a couple of optimizations you may want to consider. The tabular database within PowerBI is an in memory database, and it can be computationally and memory intensive. Here’s a simple list of things that will speed up your VM. I’m using VMware Fusion 8.5.
If you’re running VMware on OSX, check your boot args
I found that some users experienced better performance in OSX El Cap (10.10) if they turned on the kernel boot argument for debug logging. I found that suggestion here. However, I found that turning on debugging actually slowed things down in OSX.
Turn on debugging with:sudo nvram boot-args=debug=0x10
Turn off debugging with:sudo nvram boot-args=debug=””
To see that it’s taken effect:
nvram -p | grep boot-args
You’ll have to reboot for these changes to take effect. Here are some more details on boot options in OSX. It seems that the guest will run more quickly if all debugging is turned off.
VM was taking a long time to shutdown
I found that VM overhead was changed a little if I forced OSX to leave the guests memory alone.
- MemTrimRate = “0” – Disable scale down of memory allocation
- mainMem.useNamedFile = “FALSE” – VMware fusion will open a file for the memory of the VM that’s running, such that it can write to the file should you suspend it. Setting useNamedFile to FALSE removed that option.
- mainMem.backing = “swap”
- sched.mem.pshare.enable = “FALSE” – Disable page sharing
- MemAllowAutoScaleDown = “FALSE”
- prefvmx.useRecommendedLockedMemSize = “TRUE”
Preallocate your VM’s disk and make sure there are no Snapshots
Be sure to allocate your VM’s disk upon creation. This reduces the need for your VM to consume cycles managing the disk size. Also be sure that you’ve turned off snapshots and backups, as that will add significant overhead.
Turn off Windows prefetch.
Windows prefetch is a service that runs in the background and tries to predict what you’ll need in memory, and prefetches it from disk. Since we’re really only using one application (powerBI), this background service only consumes resources and contributes some CPU utilization in the background. It runs as a service, and can simply be disabled.
Adjust for best performance.
Turn off all the pretty things and set Windows to “performance”
Manually set Paging file size.
Under Advanced System Settings->Performance options->Virtual Memory, turn off the default “Automatically manage paging file size for all drives”. Set it manually to the size recommended or larger. Make sure to hit the “Set” button to persist. I’ve found that when dealing with a large dataset that consumes a lot of memory, the windows kernel may page out to the file and seems to spend a lot of resources managing that file after the memory has been de-allocated.
Disable Windows Defender
Windows defender has a habit of firing up right when the VM is maxed out with a large powerBI file. If you disable it in the services, it will automatically turn itself back on. The only way to really disable it is to find it in the group policy. Run gpedit.msc in the run window and navigate to Administrative Templates -> Windows Components -> Windows Defender Antivirus, and enable the “Turn off windows defender antivirus” flag.
Turn off VMWare sharing.
This may or may not matter. If there is process running in the background scanning files (read windows defender), removing access to all of the local files may help. It may not make any difference, but it’s worth doing everything on the local disk within your VM.
If you’re a VMware fusion poweruser and want to find ways to further optimize your VM, you can find the details here.