Prior to releasing a Service Manager implementation for production use, I like to perform some load testing to see how it is performing. During the development phase of a Service Manager deployment it is easy to forget about performance testing. While you are in there working on your own everything is running smooth. Then you move into production and notice you seem to have some performance issues and bottle necks. In order to simulate the load that a production Service Manager environment may experience, I have created a PowerShell script that creates random incidents.
Using this script I am able to test the Service Manager environment while it is under a load. While the script is running I will manually enter and update incidents in the console to see how it performs. On top of that I will use from SQL scripts to watch the delay time for the workflows. These scripts were written by Travis Wright and can be found in his blog Troubleshooting Workflow Performance and Delays (bit.ly/14vKH42). His script SubscriptionStatus.sql can be used during this simulated load to see if you have any workflow that could cause performance issues for you.
To run the script just need to enter the number of incidents you want to create and the time delay (in seconds) between creating them. Once you enter this information, just execute the script.
1 |
<span class="lnum"> 17: </span><span class="rem"># Enter the number of incidents to create</span> |
1 |
<span class="lnum"> 18: </span>$IncCount = 25 |
1 |
<span class="lnum"> 19: </span><span class="rem"># Enter the delay between incident creation in seconds</span> |
1 |
<span class="lnum"> 20: </span>$delay = 10 |
The script will create an incident with the title “Load Test Number” and the description “Test please ignore.” It will set a random Classification Category, Urgency, Impact, Support Group, and Incident Source based on the values in your environment.
This script requires that the computer executing it has SMLets installed.
You can either copy the full script text below or click here to download a copy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
<span class="rem"><hr> # #############################################################################</span> <span class="rem"># File: SCSM_Load_Test.ps1</span> <span class="rem"># </span> <span class="rem"># Author: Matthew Dowst, Catapult Systems</span> <span class="rem"># Date: 07/02/2013</span> <span class="rem"># </span> <span class="rem"># Purpose: This script will create multiple test incidents in Service Manager</span> <span class="rem"># based on the criteria supplied.</span> <span class="rem">#</span> <span class="rem"># Requirements: SMLets must be installed on the computer executing the script </span> <span class="rem">#</span> <span class="rem"># Version History</span> <span class="rem"># 1.0 - 07/02/2013 - Initial Version</span> <span class="rem">#</span> <span class="rem"># #############################################################################</span> <span class="rem"># Enter the number of incidents to create</span> $IncCount = 25 <span class="rem"># Enter the delay between incident creation in seconds</span> $delay = 10 <span class="rem">###################################################</span> <span class="rem"># #</span> <span class="rem"># DO NOT MAKE ANY CHANGES BELOW THIS LINE #</span> <span class="rem"># #</span> <span class="rem">###################################################</span> <span class="rem"># Import SMLets</span> import-module SMLets <span class="rem"># Display Start Time</span> $StartTime = get-date Write-Host <span class="str">"Started"</span> Write-Host $StartTime Write-Host <span class="str">"-------------------`n"</span> Write-Host <span class="str">"Created Incident ID"</span> Write-Host <span class="str">"-------------------"</span> $i =1 <span class="kwrd">while</span> ($i <span class="preproc">-le</span> $IncCount) { <span class="rem"># Get Random Properties</span> $Class = Get-SCSMChildEnumeration -Enumeration (Get-SCSMEnumeration -name IncidentClassificationEnum$) | Get-Random $Urgency = Get-SCSMChildEnumeration -Enumeration (Get-SCSMEnumeration -name System.WorkItem.TroubleTicket.UrgencyEnum$) | Get-Random $Impact = Get-SCSMChildEnumeration -Enumeration (Get-SCSMEnumeration -name System.WorkItem.TroubleTicket.ImpactEnum$) | Get-Random $TierQueue = Get-SCSMChildEnumeration -Enumeration (Get-SCSMEnumeration -name IncidentTierQueuesEnum$) | Get-Random $Source = Get-SCSMChildEnumeration -Enumeration (Get-SCSMEnumeration -name IncidentSourceEnum$) | Get-Random <span class="rem"># Create Test Incidents</span> $incidentclass = get-scsmclass -name system.workitem.incident$ New-SCSMOBject -Class $incidentclass -PropertyHashtable (@{ID=<span class="str">"IR{0}"</span>; Title = <span class="str">"Load Test $i"</span>; Urgency = $Urgency.name;` Impact = $Impact.name; Classification = $Class.name; TierQueue = $TierQueue.name; Source = $Source.name;` Description = <span class="str">"Test please ignore"</span>; Status = <span class="str">"IncidentStatusEnum.Active"</span>}) <span class="rem"># Display New Incident</span> $Inc = Get-SCSMIncident -Title <span class="str">"Load Test $i"</span> -CreatedAfter $StartTime Write-Host $Inc.ID <span class="str">" - "</span> $Inc.Title <span class="rem"># Pause before creating next incident</span> Start-Sleep -s $delay $i +=1 } <span class="rem"># Display End Time</span> Write-Host <span class="str">"-------------------`n"</span> $EndTime = get-date Write-Host <span class="str">"Finished"</span> Write-Host $EndTime <span class="rem">#End of Script</span> |