BizTalk DevOps: How to take control of your environment – Disable Tracking Settings in BizTalk Server Environment

Posted: November 3, 2014 in BizTalk, PowerShell
Tags: , , , , ,

Probably this will be the first post of a series about “How to take control of your environment”, especially how to take back the control of your environment from the mistakes of developers. And don’t get me wrong I am mainly a developer but I also play the role of the administrator and sometimes I also make mistakes… especially this one that I will talk about.

Who are careful to disable the tracking options for all the artifacts before publish the solution in production environment?

Well I sometimes forget to disable tracks event in orchestration: orchestration start and end, Message send and receive and Shape start and end; and sometimes we actually don’t need to track all this information, they will be there because someone forgot to disable it. Most important this information is only useful for orchestration debugger purpose when things are failing and we always can at any time turn it on for a specific application or orchestration, we don’t need that options active for all the applications.

What’s the implications of these settings being active in production?

“Document tracking can impact performance throughout BizTalk, not just Orchestration. For Orchestration, you should realize that Orchestration Event Tracking is on by default. This is useful during development and testing since Orchestration Events are required for Orchestration Debugger. However, if you do not intend to debug an Orchestration directly in production, you should turn Orchestration Event Tracking off. Orchestration Events are eventually moved to DTA_DEBUGTRACE table in BizTalkDTADB by TDDS. We have seen slow read/writes to this table once it gets large (several hundred thousand rows). What is considered large may vary due to your SQL Server hardware. In the end, if TDDS cannot move data efficiently into BizTalkDTADB, data is accumulated in BizTalkMsgBoxDB. Large MsgBoxDB can cause all of your hosts to slow down, and eventually lead to throttling.“ by Everett Yang (see: Thoughts on Orchestration Performance)

So as BizTalk Server processes more and more data on your system, the BizTalk Tracking (BizTalkDTADb) database may continue to grow in size that can causing poor disk performance.

Should I disable global tracking option?

By default, global tracking is enabled when you install BizTalk Server and if you are having performance issues in your environment that are momentarily addressed by purging the BizTalk tracking database, you may consider turning off global tracking, again momentarily, so that BizTalk stop collecting tracking information. You can accomplish that by modifying the group-level settings:

  • In the BizTalk Server Administration Console, expand BizTalk Server Administration, right-click BizTalk Group, and then click Settings.
  • In the BizTalk Settings Dashboard dialog box, on the Group page, do the following:
    • Disable “Enable group level tracking” option

BizTalk-Settings-Dashboard-Enable-group-level-tracking

However I advise you to do this only cases of emergency when you are having performance issues in production environment otherwise you should left this option enable at all time, why? Because turning off global tracking disables the tracking interceptors for the entire BizTalk Server group, which means, BizTalk Server will not track any events in its tracking tables. And sometimes we need to enable tracking for some artifacts.

So what’s the alternative?

The alternative is to configure for each application in each artifact: orchestrations, schemas, ports … the correct tracking settings. However this is a thankless and unpleasant task, because we have to go into all artifacts, especially in schemas, in order to configure them properly.

The first option to easily accomplish this task is to:

  • Go to the BizTalk Administration Console and Select “All Artifacts”
  • Select “Orchestrations” option and then select all the orchestrations available
  • Click “Tracking…” option in the right panel under “Selected Items” panel

BizTalk-Administration-Console-All-Artifacts-tracking

By configuring the tracking options this will apply for all the selected orchestrations with only one operation. This will works fine for all the artifacts… except schemas! Because in schemas you will need to go one by one.

The second option is using PowerShell script to accomplish this task, you could also do it with C# code but I think that PowerShell is a more familiar language for the administrators or sys admins.

How can I automate this task?

Windows PowerShell is a Windows command-line shell designed especially for system administrators and can be used by BizTalk administrators to help them in automating tasks.

This is a simple script to disable all tracking settings for all the artifacts in your BizTalk Server Environment:

# Disable tracking settings in orchestrations    
$Application.orchestrations | 
%{ $_.Tracking = [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::None }

# Disable tracking settings in Send ports       
$disablePortsTracking = New-Object Microsoft.BizTalk.ExplorerOM.TrackingTypes
$Application.SendPorts | 
%{ $_.Tracking = $disablePortsTracking }

# Disable tracking settings in Receive ports
$Application.ReceivePorts | 
%{ $_.Tracking = $disablePortsTracking }

# Disable tracking settings in pipelines        
$Application.Pipelines | 
%{ $_.Tracking = [Microsoft.BizTalk.ExplorerOM.PipelineTrackingTypes]::None }

# Disable tracking settings in Schemas
$Application.schemas | 
	?{ $_ -ne $null } |
	?{ $_.type -eq "document" } |
	%{ $_.AlwaysTrackAllProperties = $false }

The script can be found and download on Microsoft TechNet Gallery:
BizTalk DevOps: How to Disable Tracking Settings in BizTalk Server Environment (5.7 kB)
Microsoft TechNet Gallery

Comments
  1. steveculshaw says:

    Excellent blog post … looking forward to the rest of the series

  2. Matt Corr says:

    Excellent Article Sandro! I do have a question though, if you wanted to enable the ports rather than disable them what would the Track flag be for Send and Receive Ports? (Say you have deployed to a test environment and want to turn on tracking en-mass to help with debugging)?

    I did some digging and found for enabling tracking you could set the tracking flags to (in Powershell):

    $OrchestrationTracking = [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::OrchestrationEvents -bor [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::InboundMessageBody -bor [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::MessageSendReceive -bor [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::OutboundMessageBody -bor
    [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::ServiceStartEnd -bor [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::TrackPropertiesForIncomingMessages -bor
    [Microsoft.BizTalk.ExplorerOM.OrchestrationTrackingTypes]::TrackPropertiesForOutgoingMessages

    $PipelineTracking = [Microsoft.BizTalk.ExplorerOM.PipelineTrackingTypes]::InboundMessageBody -bor
    [Microsoft.BizTalk.ExplorerOM.PipelineTrackingTypes]::OutboundMessageBody -bor
    [Microsoft.BizTalk.ExplorerOM.PipelineTrackingTypes]::MessageSendReceive -bor
    [Microsoft.BizTalk.ExplorerOM.PipelineTrackingTypes]::ServiceStartEnd

    $SchemaTracking = $true

    But I am having issues determining how to have all the tracking options ticked for Send and Receive Ports?

    $SendPortTracking =
    [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::BeforeSendPipeline -bor
    [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::AfterSendPipeline -bor [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::TrackPropertiesBeforeSendPipeline -bor [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::TrackPropertiesAfterSendPipeline

    $ReceivePortTracking =
    [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::BeforeReceivePipeline -bor
    [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::AfterReceivePipeline -bor
    [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::TrackPropertiesBeforeReceivePipeline -bor
    [Microsoft.BizTalk.ExplorerOM.TrackingTypes]::TrackPropertiesAfterReceivePipeline

    Are you able to shed some light into this?

  3. I am looking for a database query to determine the status of the tracking events of a particular pipeline.
    I have found The status of the Before Pipeline and After Pipeline in the table BizTalkMgmtDb.dbo.StaticTrackingInfo.
    But where can i find the status of the tracking events?
    I only have database rights to query and no rights to execute procedures for powershell scripts so i hope to dind a database query

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s