29
Ricardo Torre Product Strategist – BizTalk360 BizTalk Performance Deepdive

Uk user group biz talk performance deepdive

Embed Size (px)

DESCRIPTION

Presentation used by Ricardo Torre for the UK Connected Systems User Group

Citation preview

Page 1: Uk user group   biz talk performance deepdive

Ricardo TorreProduct Strategist – BizTalk360

BizTalk Performance Deepdive

Page 2: Uk user group   biz talk performance deepdive

Understand architectural, design, and development patterns to improve BizTalk Server performance

Answer BizTalk performance related questions

Session Objectives and Takeaways

Page 3: Uk user group   biz talk performance deepdive

And a few other things

Development Optimizations

Optimize what?

Agenda

How to performance test, collect and analyse?

Architecture Optimizations

Page 4: Uk user group   biz talk performance deepdive

Optimize what?

Look at your architecture and identify optimization targets• BizTalk Applications• BizTalk Server• SQL Server• IIS Server• Windows Servers

Page 5: Uk user group   biz talk performance deepdive

How should I start?

Develop your applications with performance in mindDefine your testing strategy, tools and goalsCollect your baselineIdentify your current bottleneckChange somethingTestAnalyse

Page 6: Uk user group   biz talk performance deepdive

Use Visual Studio Load testing

Analyse during testing

Don’t be happy until you find a physical bottleneck

Page 7: Uk user group   biz talk performance deepdive

Development Optimizations

Adhere to BizTalk way of doing thingsDon’t work against it

Page 8: Uk user group   biz talk performance deepdive

Pipeline components

• Stream-based approach to pipeline components• Take advantage of BizTalk’s Streams

(Microsoft.BizTalk.Stream.dll)• VirtualStream and Event Streams• XPathMutatorStream• NamespaceTranslatorStream and XmlTranslatorStream

• Use PassThruReceive and PassThruTransmit pipelines whenever possible

• Promote items to the message context only if you need them for:• Message Routing (Orchestrations, Send Ports)• Demotion of message context properties (Send Ports)

• Instrument your source code to make your components simple to debug

• Avoid ordered delivery and transaction support whenever possible

Page 9: Uk user group   biz talk performance deepdive

Orchestrations

Tune the orchestration dehydration settings per the BizTalk Operations / Performance GuidesEliminate persistence points when possibleKeep orchestration state as small as possibleEliminate unnecessary context properties and distinguished fields

Page 10: Uk user group   biz talk performance deepdive

Use BizTalk Server 2013

XslTransform vs XslCompiledTransformA separate .NET class is generated for each transformation map.In most cases, the XslCompiledTransform class significantly outperforms the XslTransform class in terms of performance.Caveat with XslCompiledTransform: because the XSLT is compiled to MSIL, the first time the transform is run there is a performance hit, but subsequent executions are much faster.XslCompiledTransform class is the best choice in a "Load once, Cache, and Transform many times" scenario as the initial cost for map-compilation is highly compensated by the fact that subsequent calls are much faster.

Page 11: Uk user group   biz talk performance deepdive

BizTalk map (XslTransform) Test Case

1. One-Way FILE Receive Location receives a new CalculatorRequest xml document from the IN folder2. The Message Agent submits the incoming message to the MessageBox (BizTalkMsgBoxDb)3. The inbound request starts a new instance of the DefaultStaticLoop orchestration4. The orchestration executes a loop (1000 iterations) in which it uses a Transform Shape to apply a map to the inbound CalculatorRequest message (80KB)

Page 12: Uk user group   biz talk performance deepdive

XslCompiledTransform Test Case

1. One-Way FILE Receive Location receives a new CalculatorRequest xml document from the IN folder2. The Message Agent submits the incoming message to the MessageBox (BizTalkMsgBoxDb) 3. The inbound request starts a new instance of the CustomDynamicLoop orchestration4. The orchestration executes a loop (1000 iterations) in which it uses the XslCompiledTransformHelper static class to apply a map to the inbound CalculatorRequest message (80KB)

Page 13: Uk user group   biz talk performance deepdive

Test Results

BizTalk map (XslTransform) Test Case• Total Elapsed Time = ~57.3 seconds • Average Elapsed Time/Transformation = ~57 ms

XslCompiledTransform Test Case • Total Elapsed Time = ~3.6 seconds• Average Elapsed Time/Transformation = ~3.6 ms

Page 14: Uk user group   biz talk performance deepdive

Architecture Optimizations

Work with SME for each product in the stack

Optimize your architecture:• BizTalk Configuration Best practices• SQL Server/Disk Subsystem• IIS

Page 15: Uk user group   biz talk performance deepdive

Take the easy wins first

Apply all the BizTalk best practices

You will find the biggest performance improvements by removing logical bottlenecks

Be happy when you are CPU, IO or Memory bound

Page 16: Uk user group   biz talk performance deepdive

SQL Servers

The most common problem with SQL Server instances with BizTalk is PFS Contention

Don’t be afraid of using Multiple Message Boxes in a single SQL Instance

Invest on a good SAN

Page 17: Uk user group   biz talk performance deepdive

Multiple files and filegroups for the BizTalk MsgBoxDb

Primary (default file group)

Misc Data Misc IndexesPredicate

DataPredicate Indexes

Message Data

Message Indexes

For more information:BizTalk Server MessageBox Database Filegroups SQL Script

Page 18: Uk user group   biz talk performance deepdive

‘text in row’ in the MessageBox

Causes text, ntext, and image fields to be stored “in-row” instead of on a separate page in the tableMight be beneficial to enable this on the following tables in the MessageBox:• Parts• Spool• DynamicStateInfo_HostName

EXEC sp_tableoption N'Parts', 'text in row', '4000'

Page 19: Uk user group   biz talk performance deepdive

IIS Optimizations

Use Webgarden for IIS scalability

You can also tune the internal IIS engine for very specific

Page 20: Uk user group   biz talk performance deepdive

“UK Retailer” Compare Message Flow

Page 21: Uk user group   biz talk performance deepdive

“UK Retailer” Compare Hardware

Page 22: Uk user group   biz talk performance deepdive

2 BizTalk Servers: • 0.5 Business Transactions / second• 6.3 seconds avg. latency (5 sec wait time)

4 BizTalk Servers: • 0.69 Business Transactions / second• 11.2 seconds avg. latency

BUT…

“UK Retailer” Compare Results

Page 23: Uk user group   biz talk performance deepdive

Throughput will not increase, but we are not CPU or I/O bound… Why?

Page 24: Uk user group   biz talk performance deepdive

When a new row is inserted into an index, SQL Server will use the following algorithm to execute the modification: 1.Record a log entry that row has been modified. 2.Traverse the B-tree to locate the correct page to hold the new record. 3.“Latch” (lock) the page with PAGELATCH_EX, preventing others from modifying it. 4.Add the row to the page and, if needed, mark the page as dirty. 5.“Unlatch” the page

Eventually this can lead to “latch convoys” in highly concurrent workloads

Background – what is latch

Page 25: Uk user group   biz talk performance deepdive

Session ID Latch Type Database

Schema Object Name Index Name

Wait Type

241PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 109

273PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 63

348PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 63

177PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 62

302PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 62

311PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 62

108PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 47

110PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 47

122PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 47

166PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 47

234PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 47

300PAGELATCH_EX

BizTalkMsgBoxDb dbo

TrackingData_0_1

PK_TrackingData_0_1 47

294PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 46

107PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 31

111PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 31

121PAGELATCH_EX

BizTalkMsgBoxDb dbo Spool IX_Spool 31

Latch Convoy On Spool table

Page 26: Uk user group   biz talk performance deepdive

Contention on Small Number of Pages in Heavily Accessed Tables(Select, Update, Delete, Insert all running concurrently on multiple threads)

High rate of Insert/Select/Update/Delete access patterns against very small tables We have observed latch contention in MessageBox schema on 16 Cores and aboveThis problem is now being reported by production deployments, waits 100+msImpact: Latch waits > 50-100ms+Observed waits on internal SQL Structure• ACCESS_METHODS_HOBT_VIRTUAL_ROOT

WorkaroundMinimize load on MessageBox • App design to avoid persistence points• Use inline sends if necessary

Multi-MessageBox may alleviate this problem somewhat

BizTalk Workload Characteristics

Page 27: Uk user group   biz talk performance deepdive

Resources

Visual Studio Load TestingOrchestration ProfilerBizTalk Performance Optimization GuideBizTalk Benchmark Wizard

Page 28: Uk user group   biz talk performance deepdive

Q & A

Page 29: Uk user group   biz talk performance deepdive