Instrumenting BizTalk Server Applications Using Custom Performance Counters
by Agustín Mántaras
In software development, instrumentation refers to the ability of an application to monitor business processes, diagnose issues by revealing debugging information, and expose performance indicators.
BizTalk Server exposes such information for the product itself by leveraging in technologies such as performance counters, traces, and event log. BizTalk Server can enable some trace mechanisms related to your solutions exposing data and events through the tracking feature, but when it comes to custom code, you have to provide instrumentation on your own.
Although there are several techniques for this objective, like writing traces into Event Trace for Windows and BAM, it might come in handy to expose custom performance counters at the following BizTalk server areas:
- Custom pipeline components.
- Custom components.
The majority of performance counters in BizTalk Server are at host level. This is because the engine uses the host concept at low level to create all of the database infrastructure necessary to receive, process, and send messages.
But what about specific orchestration or pipeline information?
If you have BizTalk Server experience, you might think, “Hey, wait a minute. There are orchestration performance counters." While this is true, those are at host level, and you will not get any information for a specific orchestration (of course, if that host is dedicated to run only that orchestration, then yes.)
So, what is this all about?
You could create custom performance counters to expose internal information such as: the number of errors, the duration times of areas of the orchestration or pipelines, the duration of a web service call, and the overall duration of the service instance.
For instance, imagine that you want to capture the number of received and sent messages by an orchestration. You could create the following performance counters:
- #Received Messages
- #Sent Messages
The capture below shows you an implementation of this technique:
Whenever this orchestration gets instantiated by the XLANG engine, counter data will be populated with the number of messages received or sent.
Later, if you analyze the gathered performance data using Performance Monitor, you can easily get that information graphically:
Or, event create alerts using a monitoring tool like BizTalk 360 or Microsoft System Center Operation Manager.
There is a walkthrough of how to use this technique in my book BizTalk Server 2016: Performance Tuning and Optimization.
About the Author
Agustín Mántaras is a Premier Field Engineer- EMEA (Europe, the Middle East and Africa) Technology manager for BizTalk Server and IIS at Microsoft-GULF. He has been working with Microsoft on BizTalk server since 2008. Prior to this he has worked with other organizations as a consultant and analyst. Agustín is also certified from Microsoft Certification in MCP and MCTS BizTalk Server 2006.
This article was contributed by Agustín Mántaras, author of BizTalk Server 2016: Performance Tuning and Optimization.