Showing posts with label biztalk. Show all posts
Showing posts with label biztalk. Show all posts

Friday, May 23, 2014

BizTalk Atomic Update for Side-by-Side Orchestration Deployment

Deploying orchestration side-by-side, you have to unenlist the old version and start the new version. To minimize the down time, the process should be done in atomic way so that the old orchestration would not pick the new messages while the new orchestration instances will be activated by the new messages.

BizTalk exposes the .Net API to manage the orchestrations. The following script demonstrates how to use PowerShell to invoke the API so that unenlisting and starting the orchestrations could be done atomically.

To use the script, update $connectionString and the expressions in $unenlisting and $starting variables so that they could match the assembly qualified names of the orchestrations. The script also takes one argument "test" or "trial" so that you could test out whether the expressions are correct.
### Settings of the script ###
$test = $FALSE
If ($args.Count -gt 0) {
    $test = ($args[0] -eq "test") -or ($args[0] -eq "trial")
}
$connectionString = "SERVER=.;DATABASE=BizTalkMgmtDb;Integrated Security=SSPI"
$unenlisting = `
    @( `
      '^Test.*' `
    )
$starting = `
    @( `
      '.*SubOrchestration.*' `
    )

### Initialize BizTalk catalog explorer ###
add-type -assemblyName "Microsoft.BizTalk.ExplorerOM, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
$catalog = New-Object -TypeName Microsoft.BizTalk.ExplorerOM.BtsCatalogExplorer
$catalog.ConnectionString = $connectionString

### Matching orchestration's assembly qualified name with the regular expressions in $unenlisting and $starting array ###
If ($test) {
    Write-Host "TEST MODE" -foregroundcolor white
    Write-Host
}
Try
{
    $catalog.Applications | ForEach-Object {
        $_.Orchestrations | ForEach-Object {
            $target = $_
### -like is the wildcard operator
### -match is the regular expression operator

#            $unenlisting | Where-Object {($target.AssemblyQualifiedName -like $_) -and ($target.Status -ne [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus]::Unenlisted)} | ForEach-Object {
            $unenlisting | Where-Object {($target.AssemblyQualifiedName -match $_) -and ($target.Status -ne [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus]::Unenlisted)} | ForEach-Object {
                Write-Host "Unenlisting" $target.FullName $target.BtsAssembly.Version "..." -foregroundcolor yellow
                $target.Status = [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus]::Unenlisted
            }
#            $starting | Where-Object {($target.AssemblyQualifiedName -like $_) -and ($target.Status -ne [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus]::Started)} | ForEach-Object {
            $starting | Where-Object {($target.AssemblyQualifiedName -match $_) -and ($target.Status -ne [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus]::Started)} | ForEach-Object {
                Write-Host "Starting   " $target.FullName $target.BtsAssembly.Version "..." -foregroundcolor green
                $target.Status = [Microsoft.BizTalk.ExplorerOM.OrchestrationStatus]::Started
            }
        }
    }
    Write-Host
    If ($test) {
        $catalog.DiscardChanges()
        Write-Host "Changes rolled-back for test mode" -foregroundcolor white
    }
    Else {
        $catalog.SaveChanges()
        Write-Host "Changes committed" -foregroundcolor white
    }
}
Catch {
    $catalog.DiscardChanges()
    Write-Host "Changes rolled-back" -foregroundcolor red
    Write-Host $Error cyan
}
Write-Host 

Wednesday, March 27, 2013

Troubleshooting Slow BizTalk Admin Console

Since SQL Server is the backend storage of BizTalk, performance of SQL Server affects the rest of the BizTalk components. When the BizTalk Admin Console is running slowly
  • Check the sizes of BizTalk databases
  • Check the connectivity to the SQL Server
    • Open a connection with SQL Server Management Studio see if it behaves the same
    • Check for network connectivity
    • Try out different protocol configurations
      • Operation guys may comes in and update the SQL's port number to something rather than the default 1433 port leaving your BizTalk server untouched. The SQL client on the BizTalk server falls back to use Named Pipe after the TCP timeout (depends on the priority of protocol).
  • Try set the Recovery Mode of all BizTalk databases from Full to Simple
    • Not recommended in production environment
    • You should know the implication. If you do not, please read MSDN.

Saturday, June 16, 2012

Time-outs

IIS Management Console

  • Application Pool
    • Advanced Settings
      • Idle Time-out
        One way to conserve system resources is to configure idle time-out settings for the worker processes in an application pool. When these settings are configured, a worker process will shut down after a specified period of inactivity. The default value for idle time-out is 20 minutes.

  • Web Site
    • Advanced Settings
      • Connection Limits
        • Connection Time-out
          Specifies the time (in seconds) that IIS waits before it disconnects a connection that is considered inactive. Connections can be considered inactive for the following reasons:
          • The HTTP.sys Timer_ConnectionIdle timer expired. The connection expired and remains idle.
          • The HTTP.sys Timer_EntityBody timer expired. The connection expired before the request entity body arrived. When it is clear that a request has an entity body, the HTTP API turns on the Timer_EntityBody timer. Initially, the limit of this timer is set to the connectionTimeout value. Each time another data indication is received on this request, the HTTP API resets the timer to give the connection more minutes as specified in the connectionTimeout attribute.
          • The HTTP.sys Timer_AppPool timer expired. The connection expired because a request waited too long in an application pool queue for a server application to dequeue and process it. This time-out duration is connectionTimeout.
          The default value is 00:02:00 (two minutes).
    • Features View
      • Configuration Editor
        • Section = system.web/httpRuntime
          • executionTimeout
            Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.

            This time-out applies only if the debug attribute in the compilation element is False. Therefore, if the debug attribute is True, you do not have to set this attribute to a large value in order to avoid application shutdown while you are debugging.

            The default is 110 seconds.

Service Configuration Editor (system.serviceModel)

  • Bindings 
    • closeTimeout
      A TimeSpan value that specifies the interval of time provided for a close operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.
    • openTimeout

      A TimeSpan value that specifies the interval of time provided for an open operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.
    • receiveTimeout
      A TimeSpan value that specifies the interval of time provided for a receive operation to complete. This value should be greater than or equal to Zero. The default is 00:10:00.
    • sendTimeout
      A TimeSpan value that specifies the interval of time provided for a send operation to complete. This value should be greater than or equal to Zero. The default is 00:01:00.

 BizTalk Server Administration Console

  • BizTalk Group
    •  Platform Settings
      • Hosts
        • Settings
          • General
            • Response Time [see also]
              Specify the default timeout for request response messages.
              When an adapter submits a request-request message, it needs to specify the time-out of the request message on the IBTTransportBatch.SubmitRequestMessage Method (COM) API. A response message will be delivered to the adapter only within this time-out period. After the time-out expires, a negative acknowledgment (NACK) will be delivered to the adapter instead of the response message. If the adapter does not specify a time-out value, the engine uses the default value of 20 minutes.
      • Applications
        • [Application]
          • Send Ports/Receive Locations
            • [Send Port/Receive Location]
              • Properties
                • Type = Any WCF Adapter > Configure...
                  • Binding