I would like to take a moment to write about the benefit of Load Testing your BizTalk solutions before they go live and provide a very simple walkthrough of a Load Test. Often the true performance characteristics of your BizTalk environment will not be revealed until the moment that it has been set under real-world workload. It can be a traumatic experience for your team to discover once you have gone live that you have a serious bottleneck problem. Wouldn't it be nice to have a tool that would allow you to easily place some serious load on your solution before you go live?
Luckily the Microsoft BizTalk Product Group has already built a solution to help us out. They have created a much underappreciated tool called innocuously enough LoadGen 2007. This can be downloaded for free here.
Let's run through installing and setting up a very simple Load Test, shall we? Bear in mind for this example we are just trying to set up an environment where we can create some serious load, it doesn't have to be fancy just as long as it works. This test was done using Microsoft BizTalk 2006 R2 and LoadGen 2007.
Part 1, Install LoadGen: Once installed you should have folder structure as follows,
- Under the LoadGen 2007 install directory you should find a Bins, ConfigFiles and Docs folder.
- Bins folder contains the DLL's that you will use for your tests (depending upon which adapters you are using in your BizTalk solution)
- ConfigFiles contains XML templates to help you set up some tests
- Docs contains a number of samples/examples
Part 2, Search for file "FileToFileLG.xml", found within folder %ProgramFiles%\LoadGen2007\ConfigFiles\ConsoleConfigFiles. This is the file that we will use to drive out tests for this example. From a command prompt we call the LoadGenConsole.exe and feed it an XML file containing our test configuration. I have edited this file (shown below) to run my test using the FileDrop locations configured for my test BizTalk application. I have used the EAI tutorial found on MSDN to test with (see part 3 hereunder). Don't panic over the number of configurable items in your initial test, remember we just want to set up a simple Load Test.
Part 3, We need a BizTalk Solution: (actually you could set up the load test without even having a BizTalk solution running. The point of this exercise is to pump a bunch of files into a folder to simulate a 'load'). A running BizTalk solution is nice to have though because you can see the files being picked up and delivered to their destinations. In order to keep things simple I used an AEI BizTalk tutorial found on MSDN, The EAI tutorial can be found here. This tutorial is nice for our purposes as it uses only the File Adapter (more info on adapters found here). The solution has 1 receive endpoint and 2 send endpoints as well as an very simple orchestration. The configuration is as follows:
In my test case:
Receive port is configured to pick up on: C:\FileDrop\IN
Send port #1 is configured to drop into: C:\FileDrop\ERPOut
Send port #2 is configured to drop into: C:\FileDrop\Declined
Notice how these file paths can be found in FileToFileLG.xml as described in Part 2 above.
Also important is the Orchestration that we will be testing with our load generator: This Orchestration has a single Distinguished field (Quantity) that will be used to in a Decide Shape to determine whether a request message will be send to the 'ERP' or moved to a Decline folder. This is just basically an IF/Else statement (IF Quantity <= 500 send message to 'ERP' ELSE transform a decline message and send to Decline).
Part 4, Create XML Request files. In order to test you will need to create some XML files. The name must be the same used in the SrcFilePath element within the LoadGen configuration file.
Request Message: expected accepted request due to Quantity <= 500
This message is called: EAIRequest001.xml
Request Message: expected decline request due to Quantity > 500
This message is called: EAIRequest501.xml
|<ns0:Request xmlns:ns0="http://EAISchemas.Request"> |
|<ns0:Request xmlns:ns0="http://EAISchemas.Request"> |
Part 5, running the command prompt: fire up a command prompt! I chose to move my context to the Bin folder where my LoadGenConsole.exe was located and copied my FileToFileLG.xml file there as well. The syntax is simple [LoadGenConsole.exe <xml file to load>]. That's all there is to it.
Part 6, View the results. If everything went well you have just set X number (dependant upon NumFiles element) of files (EAIRequest001.xml & EAIRequest501.xnl) to the folder c:\Temp\IN. You should find X number of EAIRequest001 files in C:\FileDrop\ERPOut & X number of EAIRequest501 files C:\FileDrop\Declined (of course the names have most likely been changed possibly with a GUID depending upon how you have configured your endpoints in BizTalk)
Part 7, Identify and fix your bottlenecks. Once you have found your Maximum Sustainable Throughput (basically how many messages you can pump through the system in an hour) you can start to tweak your system to improve performance. You need to ensure that you are monitoring the correct Performance Counters and it is essential that your system is cleaned up before every run of the test.
Please notice in the LoadGen Bin folder that there are a number of DLL's there including those for SQL, MSMQ and SOAP. You can load test virtually any solution with these tools. If you were to use BizUnit then you could build a library of iterative business cases that would drive your load generation. (www.codeplex.com/bizunit).
I hope that this was informative.