Getting the most out of VMware Fusion 8.5 running Windows 10

I’ve been trying to get the most performance out of my Window 10 virtual machines running on my MacBook Pro through VMware Fusion. I have a Windows 10 virtual machine that I use for software demos and testing beta versions of Windows. It’s been running much slower than you would expect on a 2 3 year old MacBook Pro with a quad core i7.  I’ve collected the following tips (the sources are listed at the end) and they have improved the performance.

From the MacOS Side

Exclude the virtual disks from Time Machine backups.

You’ll want to avoid trying to back up the virtual machines by Time Machine.  If Time Machine is trying to back up the virtual machine while it is being used, it will probably fail to perform the backup and it will definitely throttle the disk I/O.

  • Run the Settings App
  • Open “Time Machine”
  • Click the “Options” button
  • Under the “Exclude these items from backups”, click the “+” button.
  • Select the Virtual Machines folder.  By default, this will be located in your documents folder.  Once you have selected the folder, press the “Exclude” button.
  • Press the “Save” button

If you are running an anti-virus application on your Mac, make sure that it is excluding the Virtual Machines folder

From the Virtual Machine Side

With your virtual machine stopped, you can make some system changes to achieve better performance.  Within Fusion and with the virtual machine open (but not running), open the Settings dialog.  You’ll want to make the following changes:

  • Open “Display” and clear the “Accelerate 3D Graphics” checkbox.
  • Open “Processors & Memory”
    • Set the number of processor cores to a value of n-1 or less, where n is the number of actual cores on your Mac.  My Macbook Pro has a quad core i7, so I run with 2 cores assigned to the virtual machine.
    • Give the virtual machine as much ram as you can, but without starving the host OS.  My Mac has 16 GB, so I split it 50/50.  If you have less memory, remember to leave at least 2 GB to the MacOS OS.
    • Open Advanced Options and select “Enable hypervisor applications in this virtual machine”
  • Open “Hard Disk (SCSI)”
    • Open “Advanced options”
    • Set bus type to SCSI
    • Set “Pro-allocate disk space” to enabled.

There are some settings that are not directly exposed through the settings dialog.  You’ll need to modify the .xmx file directly.  There are a couple of ways of getting at the .vmx file, the clearest technique is documented on the vmguru.com page: “Modifying the .vmx file step-by-step”.

  • Change ethernet0.virtualDev = “e1000e” to ethernet0.virtualDev = “vmxnet3”
    This will change the default network adaptive to an enhanced driver
  • Add the line scsi0:0.virtualSSD = 1
    This will optimize disk I/O for SSD drives.  Only use this if your MacBook has a SSD drive
  • mainMem.backing = “swap”
    May speed up memory swap files
  • MemTrimRate = “0”
    Disable memory trimming, less overhead for the Fusion memory manager
  • sched.mem.pshare.enable = “FALSE”
    Turns off memory sharing between virtual machines
  • prefvmx.useRecommendedLockedMemSize = “TRUE”
    Speed up I/O at the cost of increased memory usage in the host OS
  • MemAllowAutoScaleDown = “FALSE”
    Prevents Fusion from attempting to start the virtual machine with less memory than specified.  This can trigger Windows activation.
  • logging = “FALSE”
    Disabling the logging should speed things up a bit

If you don’t need snapshots, remove them.  When you use a snapshot, disk I/O is parsed through each snapshot.  That will show things down.

 

Resources for these suggestions

  1. VMware Performance Enhancing Tweaks (Over-the-Counter Solutions)
  2. Making Windows 10 inside VMWare Fusion 8.x a bit quicker on OSX 10.11 El Capitan
  3. How to Fix Slow Windows VMs on VMware Fusion 8.x
  4. Excluding the Virtual Machines folder from being backed up by Time Machine (1014046)
  5. Troubleshooting Fusion virtual machine performance for disk issues (1022625)

Using console jQuery to scrape lists from Apple’s developer portal.

Scrape
I needed to grab the lists of registered devices and developers from our company’s Apple Developer portal. Unless I’m being particularly obtuse (an outcome that I never rule out), Apple does not provide any means of exporting the lists.

Apple only allows 100 devices of each type (iPhone, iPad, iWhatever) to be registered as development devices. No matter how many iOS developers that you have at your company, 100 is the limit. And if you remove a device from that list, it still counts towards that total.  Once a year, you can reset the list and carry over the devices that you still need and drop off the ones that are not needed.  To make this easier to manage, I wanted to get a list of the devices and their ids and have the developers pick the ones that they still need.

So I wanted to export that list.  And Apple doesn’t let you export that list.  You can see it on the screen and work with the items in the list, but no export.  I figured that I wasn’t the only person dealing with that limitation so I did a quick search on Stack Overflow and found this little gem.

var ids = ["Device ID"];
var names = ["Device Name"];
$("td[aria-describedby=grid-table_name]").each(function(){
    names.push($(this).html());
});
$("td[aria-describedby=grid-table_deviceNumber]").each(function(){
    ids.push($(this).html());
});

var output = "";
for (var index = 0; index < ids.length; index++) {
    output += ids[index] + "\t" + names[index] + "\n";
}
console.log(output);

To use that code, you would go to the list of devices in the browser. Then open up the developer tools for that browser. For example, in Chrome you would press F12 to open up the developer tools. Staying with the Chrome example, you would click on the Console tab in the developer tools and paste that Javascript code in and then press the Enter key. The code would execute within the domain of the page and generate a two column list of device ids and names.

To understand what that code does, you need to look at how the data is rendered on the page. The device list is stored in a HTML table, with each row looking like this

<tr id="1" tabindex="-1" role="row" class="ui-widget-content jqgrow ui-row-ltr">
    <td role="gridcell" style="text-align:center;display:none;width: 34px;" aria-describedby="grid-table_cb">
        <input role="checkbox" type="checkbox" id="jqg_grid-table_1" class="cbox" name="jqg_grid-table_1">
    </td>
    <td role="gridcell" style="" class="ui-ellipsis bold" title="iPad" aria-describedby="grid-table_name">iPad</td>
    <td role="gridcell" style="display:none;" class="ui-ellipsis" title="c" aria-describedby="grid-table_status">c</td>
    <td role="gridcell" style="" class="ui-ellipsis" title="twletpb659m0ju078namuy8xnv2j0fzt1kytanfz" aria-describedby="grid-table_deviceNumber">twletpb659m0ju078namuy8xnv2j0fzt1kytanfz</td>
</tr>

Looking at the highlighted lines 6 and 9, we can see the device name and device id as the text of table cell tag. Each cell has a aria-describedby attribute to identity the type of value being stored. We can search on the values of the attributes to locate the data that we want. Going back to the javascript, look at the following lines:

var names = ["Device Name"];
$("td[aria-describedby=grid-table_name]").each(function(){
    names.push($(this).html());
});

The first line declares a Javascript array with an initial array element of “Device Name”. The next line performs a jQuery select for all of the <td/> elements that have attribute of aria-describedby with the value grid-table_name. The next part of the statement iterates over the list of matching <td/> elements and uses the jQuery html() to get the text value of the cell and add it to the array. We then can then do the same technique to get the device id and then build a list as a string and finally dump it to the browser’s console.

I also needed to the email addresses of all of our registered developers. The email addresses were not in a table, but part of a list. Each email address is wrapped inside a section element like this

<section class="col-100 ng-scope">
  <p ng-bind="::person.fullName" class="ng-binding">First Last</p>
  <a class="smaller ng-binding" 
    ng-bind="::person.email" 
    ng-href="mailto:first.last@yourcompany.com" 
    href="mailto:first.last@yourcompany.com">
    first.last@yourcompany.com
  </a>
</section>

I just needed the text part from the <a/> element. Getting the email addresses was a simpler version of the code to get the devices. I just a jQuery select on the ng-bind attribute and matched on the value “::person.email”. That ended up being a single line of code to run in the browser’s developer console

$('a[ng-bind="::person.email"]').each(function(){
  console.log($(this).text())
  });

And that’s how you can screen scrape data from a web page that doesn’t provide any support for exporting the data.

Bonus round
The aria-describedby attribute is a commonly used accessibility element used to describe the element that the tag is part of. The “aria” part of the attribute name is an acronym for Accessible Rich Internet Applications. Among other things, it was designed to allow assisted reading devices help parse a page for users with visual difficulties. It’s a good technology to use on your web pages.