While I was working with Biztalk server 2000 and 2002 over the period 2000 - 2004, I always wished having a tool that allowed me to stress test my production platform without writing custom code and components.
Hopefully, Microsoft made available a free tool, essentially command line tool, LoadGen to stress test Biztalk server applications. The first version was released back in 2006 for Biztalk server 2004, then in November last year a new version LoadGen 2007 came out.
There were several reasons behind this new release, the first version was not so popular, didn't get a lot of praise from the community. Secondly, Biztalk 2006 and Biztalk 2006 R2 brought a raft of new features, especially WCF adapters and RFID capabilities.
The tool is simple to use but documentation are not very straight forward and I struggled a little bit and googled before achieving the first load test. In this article, I will describe a very basic scenario for using LoadGen 2007. First you need to download the tool at Microsoft BizTalk LoadGen 2007 Tool and install it.
The tool itself mainly consists of an executable called LoadGenConsole.exe which consumes an xml configuration file to simulate a load test. The scenario is based on one of the examples that comes with Microsoft® BizTalk® Server 2004 Unleashed book written by Scott Woodgate, chapter 9, Sample Orchestration Solution.
The process accepts a purchase order, check the customer's credit line, and approve the order if the cost is covered by the credit line. If approved, it sends a message to manufacturing to schedule the order (simulated by sending the order to a physical directory). Regardless of the credit decision, it also passes a message back to the customer indicating the status of the order.
Credit check is done by calling a second orchestration wich calls a .Net component.
As indicated in the book, although this is a greatly simplified view of an actual purchasing chain, it demonstrates a number of the techniques and capabilities of Biztalk server orchestration, here is a snapshot of the orchestration.

Microsft Loadgen 2007 comes with several configuration templates which can be customized according to your needs. To stress test our scenario, first of all we need to create a configuration file. I chose to customize the FileToFileG.xml from ConfigFiles\consoleConfigFiles and named it FileToFileLG_MessageCreator.xml, snapshot hereunder,

the important tags to mention are :
<NumThreadsPerSection> : specifies how many concurrent threads will run
<LotSizePerInterval> : specifies how many files will be sent to the destination port in each lot
<StopMode> : specifies the default stop conditions for the overall tasks. In my configuration, I want LoadGen 2007 to send 4000 file but to stop after 1 hour in any case.
<Transport> : depends on which protocol you are using in your adapter. In our case it is a file adapter. LoadGen supports a bunch of protocols such as several WCF protocols, SOAP, HTTP.....
Then we have a section element which describes the tasks to be carried by LoadGen. It is possible to point LoadGen to a directory where a sample file resides which will be always submitted during the load test which I can call “Static message”, or provide a template with some parameters so each single message submitted to LoadGen will have different values. We can call this dynamic messages. I will show later how to configure a Message generator component configuration.
For this you should create a template based on the sample artifact consumed by the orchestration. You indicate the full path to this template in the tag "Section/SrcFilePath". Of course, we need to provide the destination directory, monitored by our process, where the task send the generated documents. The tag is "Section/Parameters/DtsFilepath" which is POIn.
Here is a snapshot for this template. As you can see, it is a sample purchase order file needed to be received by the orchestration.

Another important tag in the section element is the MessageCreator element. We specify several parameters,
<Mode> : specifies bahvior (Synchronous or Asynchronous), for more details please read LoadGen documentation.
<SleepInterval> : specifies in in milliseconds the time period that LoadGen waits before generating the next bunch of messages
<TemplateFilePath> : the file to be handed to the message creator component identifed in the <assembly>. As you can see in the following snapshot,

In the message creator template we define the types and values for each field we want to be replaced with in our sample file as shown below. We create a custom <Field> tag for each corresponding field in our sample template.
Values for each field will be generated by LoadGen 2007 according to parameters as initial value, size (min and max), do we allow duplicates or not and the type in the field element.
However, we can also force a range of values for a field instead of being automatically generated which is the case for the custID field in our scenario. For the field custID, I decided that the messages should use a range of values. I created a data file called CustData.txt where I entered some fictitious customer accounts I want my messages to have. The data are separated by a pipe. Then useed the tag <InputFilepath> for the field element to indicate to LoadGen where is the range of data. Here is how the data file look like

Once all those files are configures, you can run the load test by launching from the command line as follows
C:\Program Files\LoadGen\Bins>LoadGenConsole "E:\Projects\FileToFileLG_MessageCreator.xml"
You should see a screen indicating the progress of the test and the end. The first thing to note here is the rate displayed on the screen which a very good first indicator.

My Biztalk 2006 R2 is running inside a virtual machine on a physical 1 quad-proc server with 4G of RAM. The average of sending messages is 428 messages per second.
Now we should have 4000 file generated in our POout directory
It is very interesting to watch/record appropriate performance counters while the load test is running.
You can check another article which inspired me to write this article, a step by step tutorial about LoadGen 2007 and WCF at http://connectedthoughts.wordpress.com/2007/11/05/loadgen-2007-and-a-simple-biztalk-wcf-test/,
other links to some usefull articles about LoadGen 2007 :
WCF stress testing using BizTalk Server LoadGen
Finally, I would like to mention that snapshots have been realized with a very cool tool called Cropper, written by Brian Scott and I should say it is a lightweight wonderfull utility.