Using Powershell to create 64 Hyper-V Virtual Machines on Gridstore array


This script uses another script Create-VM.PS1 from a prior post. It creates 64 Hyper-V virtual machines on 8 different LUNs. It creates them synchronously (one after the other). The 8 LUNs are on a 6 node GridStore array using H-nodes. Details of the Gridstore array setup are in this post.

GS-012i

# Script to create 64 test VMs on 8 diffent LUNs on current HyperV Host
# Uses Create-VM.ps1 from https://superwidgets.wordpress.com/category/powershell/
# Sam Boutros – 7/1/2014
#
$VMPrefix = “V-2012R2-LAB”
$VMG = 2
$VMMemoryType = “Dynamic”
$VMStartupRAM = 1GB
$VMminRAM = 512MB
$VMmaxRAM = 1GB
$vSwitch = “Gridstore_vSwitch”
$VMCores = 2
$VLAN = 19
$AdditionalDisksTotal = 2
$AdditionalDisksSize = 1TB
$GoldenImageDiskPath = “E:\Golden\V-2012R2-3-C.VHDX”
$CSV = (Get-Location).path + “\IOPS_” + (Get-Date -format yyyyMMdd_hhmmsstt) + “.csv”
$VMFirstNumber = 1 # Starting number
$TargetLUNs = @(“e”,”g”,”h”,”i”,”j”,”k”,”l”,”m”)
$NumberofVMs = 8 # Per target LUN
#
foreach ($LUN in $TargetLUNs) {
$VMrootPath = $LUN + “:\VMs”
For ($j=$VMFirstNumber; $j -lt $NumberofVMs+$VMFirstNumber; $j++) {
$VMName = $VMPrefix + $j
$VMFolder = $VMRootPath + “\” + $VMName
.\Create-VM.ps1 -VMName $VMName -VMFolder $VMFolder -VMG $VMG -VMMemoryType $VMMemoryType -VMStartupRAM $VMStartupRAM -VMminRAM $VMminRAM -VMmaxRAM $VMmaxRAM -vSwitch $vSwitch -VMCores $VMCores -VLAN $VLAN -AdditionalDisksTotal $AdditionalDisksTotal -AdditionalDisksSize $AdditionalDisksSize -GoldenImageDiskPath $GoldenImageDiskPath -CSV $CSV
Start-VM -Name $VMName
}
$VMFirstNumber += $NumberofVMs
}

During the script execution the Hyper-V resource monitor showed the following:

GS-012a

GS-012b

The GridControl snap-in showed:

GS-012c

GS-012d

GS-012e

I can also see the VMs popping up in Hyper-V Manager:

GS-012f

and their files in the file system:

GS-012g

GS-012h

This file is derived from the script’s CSV file output.. It shows:

GS-012j
9 GB file average copy time: 10.83 seconds
GS-012k

9 GB file copy average throughput 852.5 MB/s

GS-012l

9 GB file copy average throughput 6,820.1 Gbps


Conclusion and important points to note:

  • Script ran in serial, creating 1 VM on 1 LUN, and after that’s done moving on to the next VM on the same LUN, then moving on to the next LUN.
  • Each LUN is configured as an IOPS (2+1) LUN. So, every write process is writing to 3 disks out of the array 24 total disks (whereas a read process reads from 2 disks in the LUN). Additional throughput is likely to be achieved by testing scenarios where we’re writing to all 8 LUNs simultaneously hitting 18 of the array disks at the same time.  
  • Network bandwidth utilization is at about 68.2% capacity of the 10 Gbps Ethernet used in this test. for the next test (in parallel) I will use NIC teams to provide 20 Gbps Ethernet bandwidth
  • Storage nodes’ CPU utilization was at around 50% in this test, which is not a bottleneck.
  • This test is essentially a disk copy test and not a Hyper-V virtual machine performance test. Hyper-V testing with Gridstore will be shown in a future post.
  • Using the formula IOPS = BytesPerSec / TransferSizeInBytes
    LUNs are formatted as 64 KB blocks
    Average IOPS = (852.5*1024)/64 = 13.64k IOPS
Advertisements

3 responses

  1. Pingback: Using Powershell to create 64 Hyper-V Virtual Machines in parallel on Gridstore array | Sam's Corner

  2. zen

    Hi – why wouldnt you use $j -le $NumberofVMs rather than $j -lt $NumberofVMs+$VMFirstNumber – they will both equal 8.

    July 3, 2014 at 6:56 pm

    • Hi Zen,
      If you use $j -le $NumberofVMs you’ll end up repeating the VM names as you loop from one $LUN to the next.
      If you use $j -lt $NumberofVMs+$VMFirstNumber, the VM number will increment from one $LUN to the next
      For example, this code:

      $OuterLoop = 5; $InnerLoop = 4
      For ($Outer=0; $Outer -lt $OuterLoop; $Outer++) {
      For ($Inner=0; $Inner -lt $InnerLoop; $Inner++) {
      Write-Output “Outer = $Outer, Inner = $Inner”
      }
      }

      will have this output:
      Outer = 0, Inner = 0
      Outer = 0, Inner = 1
      Outer = 0, Inner = 2
      Outer = 0, Inner = 3
      Outer = 1, Inner = 0
      Outer = 1, Inner = 1
      Outer = 1, Inner = 2
      Outer = 1, Inner = 3
      Outer = 2, Inner = 0
      Outer = 2, Inner = 1
      Outer = 2, Inner = 2
      Outer = 2, Inner = 3
      Outer = 3, Inner = 0
      Outer = 3, Inner = 1
      Outer = 3, Inner = 2
      Outer = 3, Inner = 3
      Outer = 4, Inner = 0
      Outer = 4, Inner = 1
      Outer = 4, Inner = 2
      Outer = 4, Inner = 3
      If $Inner variable is being used as part of the VM name we’ll have duplicates..
      On the other hand, this code:

      $OuterLoop = 5
      $InnerLoop = 4
      $Start = 0
      For ($Outer=0; $Outer -lt $OuterLoop; $Outer++) {
      For ($Inner=$Start; $Inner -lt $Start+$InnerLoop; $Inner++) {
      Write-Output “Outer = $Outer, Inner = $Inner”
      }
      $temp = $InnerLoop
      $Start += $temp
      }

      Will have this output:
      Outer = 0, Inner = 0
      Outer = 0, Inner = 1
      Outer = 0, Inner = 2
      Outer = 0, Inner = 3
      Outer = 1, Inner = 4
      Outer = 1, Inner = 5
      Outer = 1, Inner = 6
      Outer = 1, Inner = 7
      Outer = 2, Inner = 8
      Outer = 2, Inner = 9
      Outer = 2, Inner = 10
      Outer = 2, Inner = 11
      Outer = 3, Inner = 12
      Outer = 3, Inner = 13
      Outer = 3, Inner = 14
      Outer = 3, Inner = 15
      Outer = 4, Inner = 16
      Outer = 4, Inner = 17
      Outer = 4, Inner = 18
      Outer = 4, Inner = 19
      The $Inner variable is incrementing without duplication. This is useful if it’s being used as part of the VM name..

      July 3, 2014 at 8:04 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s