The last variable in the load testing scenario is the actual creation of your stress tests using a Web tester.  DP downloads from clients can be initiated via Server Message Block (SMB) or HTTP but the default is to use HTTP in ConfigMgr 2007.  The next variable to understand is the use of HTTP versus HTTP/S which is certificate-based authentication.  The latter is used when ConfigMgr 2007 sites are running in Native Mode.  Thus, today’s post will focus on creating your test load against the DP using Visual Studio Team System for Testers (VSTS) but I will then add the step to create a secure-based load test using CertPicker.

Build your Web Test

The first step is to build your Web test in VSTS.  This is a rather straight-forward process as you can use the wizard to create a simple set of Web tests – the fun begins after you start customizing it for the ConfigMgr DPs.

The steps are rather simple:

  1. Open Visual Studio Team System
  2. Depending on your language selection when installing VSTS, you will see under it a option that says ‘Test’ and the only selection is ‘Test Project’
  3. Select the properties such as where to store the solution\project files and click New
  4. The default after this creation is to show a Text file saved in your project that reads:
  5. You should now click Test in the context menu, and select New Test
  6. In the New Test, Add New Test, select Web Test and give the test a name (e.g. StressUSADP.StressDP)
  7. This should open a new Internet Explorer browser that launches the recorder
  8. For simplicity, I would always hit our DP’s home page using http://{servername}/ and close the recorder (you will figure out why later)
  9. After you have hit the page, go back to Visual Studio and you should see a option to ‘Stop Recording’
  10. Click Stop Recording

You should have a Generic Web test showing a single URL request listed as the only Web request.


Generate Code for Web Test

The interesting thing is that if you are running your Configuration Manager 2007 hierarchy in Mixed-Mode then you don’t need to do this step.  This is only for native mode implementations where you need to utilize the CertPicker I shared in Part I of this series.  This step is only for Native Mode environments where DPs are protected by Mutual Authentication using client & server certificates.

To take advantage of CertPicker, the following are the steps needed to effectively connect to to the DP:

  1. Load a certificate to use for the request
  2. Load the URL for this request and append the Cert Auth to use to connect to the DP
  3. Increase the WebTest response payload (more on this later)
  4. Make a HTTP/S request to the DP using a valid URL to content and the certificate loaded in Step 1
  5. Remove the certificate upon successful utilization of the certificate

I wrote the scenarios & specs around this procedure and am happy to share with anyone who is interested in more detail ;-)

In short, we need to generate the Web test code and we need to alter it to support our CertPicker code.

To generate the code, do the following:

  1. In Visual Studio, load the Web test generated in Section 1 of this post by double-clicking in the Solution Explorer
  2. Right-click on the Web test root, and select Generate Code…give your Web test a unique name for coded (e.g. StressDPCoded)


File Sizes are the key – Pick various Web Test(s) of various file sizes

This might seem like a lot of work but it is well worth it in the end when you can verify how many downloads your DPs can support.  This is useful data to have when planning your scale-out plans.

The next step is to build a master list of URLs that cross various package sizes.  This is important because you should focus on checking the performance of a lot of small packages, medium-size packages, and large and part of the Load test will allow you to control this which is really helpful.  For our example, we used 3 packages – 100 Mb (small), 500 Mb (medium), and 1 Gb (large) and built the appropriate file list in a single file.

We had a file that we would name for the ConfigMgr Package Id such as MD000032 and it was a simple text file and had the following type data in it:$/md10005c/Core.exe$/md10005c/mif.xml$/md10005c/mif.xsd$/md10005c/MS_ForefrontClientSecurity_1.5.1941.9.xml$/md10005c/SoftwareInstall.exe$/md10005c/swischema.xsd$/md10005c/bits/Scripts/Detect_forefront.vbs$/md10005c/bits/Scripts/RegKeyValue.vbs$/md10005c/bits/Scripts/SetRunOnce.vbs$/md10005c/bits/Scripts/UninstallLU.vbs$/md10005c/bits/Scripts/Uninstall_Anti-Spyware_Products.vbs$/md10005c/bits/Scripts/Uninstall_eTrust_AV.vbs$/md10005c/bits/Scripts/Uninstall_forefront.vbs$/md10005c/bits/Scripts/Uninstall_McAfee_AV.vbs$/md10005c/bits/Scripts/Uninstall_Sophos_AV.vbs$/md10005c/bits/Scripts/Uninstall_Symantec_AV.vbs$/md10005c/bits/Scripts/Uninstall_Trend_AV.vbs$/md10005c/bits/Source/Install Bits/DMSDefault.reg$/md10005c/bits/Source/Install Bits/eula.rtf$/md10005c/bits/Source/Install Bits/FCSInstall.exe$/md10005c/bits/Source/Install Bits/FCSInstall.ini$/md10005c/bits/Source/Install Bits/mp_ambits.msi$/md10005c/bits/Source/Install Bits/mp_ambits.Mst$/md10005c/bits/Source/Install Bits/WindowsXP-KB914882-x86-ENU.exe$/md10005c/lib/CommonSwift.dll$/md10005c/lib/DetectionLogic.dll$/md10005c/lib/DialogPrep.vbs$/md10005c/lib/ISMIF32.dll$/md10005c/lib/ISMIFCOM.dll$/md10005c/lib/msscript.ocx$/md10005c/lib/msxml3.dll$/md10005c/lib/msxml3a.dll$/md10005c/lib/msxml3r.dll$/md10005c/lib/RICHTX32.OCX$/md10005c/lib/standards.vbs

The next step is to add this file (and any others) to the project using the following steps:

  1. Right-click on the project name (e.g. StressUSDP)
  2. Click Add, Existing Item
  3. Locate the text file with the URLs in it and select it

Add CertPicker Code to your Coded Web Test

The last step before you are ready to create your Load Test is to add your CertPicker reference and then add the code to support it so that prior to making the HTTP/S request to the DP you generate a trusted certificate to the Local Machine store.  This is how to accomplish this:

Add Reference to CertPicker:
  1. Open your Generated Web Test file name (e.g. StressDPUS_Coded)
  2. Right-click on your Web Test Project name, Click Add Reference
  3. image
  4. Click the Browse button
  5. Locate the compiled Assembly from Part I and select it
  6. image
Add Code to use CertPicker in WebTest:
  1. Open your Web Test coded filed from Solution Explorer 
  2. Add a reference for CertPicker using CAdCertPicker & System.Security.Cryptography.x509Certificates

The major piece of code added to the WebTestRequest interface that we add does the following:

  1. Opens the text file with the URLs listed for the package
  2. Creates loop that installs random certificate from path using CertPicker
  3. Adds CCM-specific headers for CCMClientGUID, Timestamp, and Signature
  4. Removes certificate(s)

For reference, I’m including a full look into the complete Webtest file used for a single package so that you can use it as a reference. Here is sp,e sample code from one of our tests:

Code Snippet
  1. namespace AccessDPBits1
  2. {
  3.     using System;
  4.     using System.Collections.Generic;
  5.     using System.Text;
  6.     using Microsoft.VisualStudio.TestTools.WebTesting;
  7.     using Microsoft.VisualStudio.TestTools.WebTesting.Rules;
  8.     using System.Security.Cryptography.X509Certificates;
  9.     using CAdCertPicker;
  10.     using System.IO;
  11.     public class AccessDP : WebTest
  12.     {
  13.         public AccessDP()
  14.         {
  15.             this.PreAuthenticate = false;
  16.         }
  17.         public override IEnumerator<WebTestRequest> GetRequestEnumerator()
  18.         {
  19.             // Initialize validation rules that apply to all requests in the WebTest
  20.             if ((this.Context.ValidationLevel >= Microsoft.VisualStudio.TestTools.WebTesting.ValidationLevel.Low))
  21.             {
  22.                 ValidateResponseUrl validationRule1 = new ValidateResponseUrl();
  23.                 this.ValidateResponse += new EventHandler<ValidationEventArgs>(validationRule1.Validate);
  24.             }
  25.             // Setup URL for accessing the Package as if made from BITS
  26.             string[] URLs = File.ReadAllLines(@"D:\StressHavana\VSTS\StressDP\StressDP\MD10005C.txt");
  27.             foreach (string URL in URLs)
  28.             {
  29.                 X509Certificate2 cert = CertPicker.InstallRandomCertificate(@"d:\Certs", "ObjGen", StoreLocation.LocalMachine);
  30.                 WebTestRequest httpRequest3 = new WebTestRequest(URL);
  31.                 httpRequest3.ClientCertificates.Add(cert);
  32.                 httpRequest3.FollowRedirects = true;
  33.                 httpRequest3.Headers.Add(new WebTestRequestHeader("CCMClientID", "{GUID FOR CCM CLIENT}"));
  34.                 httpRequest3.Headers.Add(new WebTestRequestHeader("CCMClientIDSignature", "{CCM CLIENT ID SIGNATURE}"));
  35.                 httpRequest3.Headers.Add(new WebTestRequestHeader("CCMClientTimestampSignature", "{CCM CLIENT ID TIMESTAMP}"));
  36.                 //  Remove certificate after Request is completed
  37.                 CertPicker.RemoveCertificate(cert);
  38.                 yield return httpRequest3;
  39.             }
  40.             //  Change the ResponseBodyCaptureLimit
  41.             this.ResponseBodyCaptureLimit = 150000000;
  43.         }
  44.     }
  45. \

The only piece of information that you will need to obtain (from logs) is the CCMClientId, CCMClientIDSignature, and the CCMClientTimestampSignature.

The DP does not check that the ClientId matches the signature nor the certificate (the MP does since it is signing policy) and these three headers need to be added to each request to make BITS happy.

You can test any or all of your Web tests using Visual Studio’s Run functionality to test that you have everything configured correctly for the test.  To run the test, click the following in the toolbar:


Let’s knock some DPs over … Putting it all together with Load Test

The last step is the most interesting as you finally get to see everything in action.  This is a Load test that is made up of a series of Web Tests.  In our case, we would make multiple Web Tests that would equal various packages and we would rinse & repeat these steps in a single Load test and modify parameters accordingly.  This is an easy way to get some load against your DPs and see how they do.

For those old NT administrators, it is like permissions – create your Global Group (Load Test), Create your Local Group (Web Test), Add your users to the Local Group (Create the package URLs mini-file), Add your Local Group to the Global Group (Add the Web Tests to the Load Test).  Sorry… couldn’t resist!

I will close the loop tomorrow with a post that shows you how to use the Load test to run against your DPs.  Stay tuned…

Digg This