Minimize TCO SCALE UP on AOS Data handling efficiency.

35
March 18-21, 2013 New Orleans

Transcript of Minimize TCO SCALE UP on AOS Data handling efficiency.

Page 1: Minimize TCO SCALE UP on AOS Data handling efficiency.

March 18-21, 2013New Orleans

Page 2: Minimize TCO SCALE UP on AOS Data handling efficiency.

Tips and tricks for optimizing performance in Microsoft Dynamics® AX 2012 Gana SadasivamChristian WolfMicrosoft

DDAX04

Page 3: Minimize TCO SCALE UP on AOS Data handling efficiency.

Session objectives

Performance story

Tuning methodology

What’s new in Microsoft Dynamics AX 2012 R2 and its effect on performance

Benchmarks

Tips and tricks

Page 4: Minimize TCO SCALE UP on AOS Data handling efficiency.

Performance/scalability roadmap

• Database scalability – scale up to large hardware

• Enable Microsoft® SQL Server® 2005 performance

• Scale out architecture for application servers

• Extensive caching and reliability changes

• Optimistic Concurrency Control

Microsoft Dynamics AX 4.0

• Scale UP on the application server

• Focus on parallelism and minimizing batch window

• SQL Server 2008 adoption

• Extensive scale work on integrations

• Scale work on EP• Chattiness reductions

Microsoft Dynamics AX 2009

• Increase application efficiency

• Maximize usage of SQL Server 2008/2008 R2 features

• Core functions are parallelism enabled

• Run X++ in IL• Data caching

reengineered• Service enablement of

expensive ERP processes

• Improved Trace Parser and tracing experience

Microsoft Dynamics AX 2012

Page 5: Minimize TCO SCALE UP on AOS Data handling efficiency.

Performance principles for Microsoft Dynamics AX 2012

Minimize TCO

Asynchronous processing

Optimal client/server calls

Parallel processing

SCALE UP on AOS

Large box awareness

WCF server

Run X++ in IL

Data handling efficiency

Why hit SQL if it is in cache?

Take advantage of SQL Server 2008

Data filtering through XDS

Page 6: Minimize TCO SCALE UP on AOS Data handling efficiency.

Performance tuning methodology

Usage profile definition

Trace collection

Trace analysis and findings

RemediationOptional

benchmark execution

Page 7: Minimize TCO SCALE UP on AOS Data handling efficiency.

Sizing benchmarkHow Microsoft Dynamics AX scales

Day-in-the-life benchmark5000 concurrent users, 1 million transaction lines per hour

Microsoft Hyper-V®Comparison physical to virtual hardware

Enterprise portalUser concurrency

High-volume inventory5 million transaction lines processed

RetailMicrosoft Dynamics AX 2012 R2 benchmark white paper about to be released

Benchmarks

Page 8: Minimize TCO SCALE UP on AOS Data handling efficiency.

Sizing benchmarkMicrosoft Dynamics AX 2012 R2

Database

Batch Server

Agent1 Agent2 Agent3

Controller

EP Server

AOS2

SO TrendPO Trend

ExpenseTimeSheet

Batch Invoice SOAIF Inbound Batch Create SO

WorkFlow Approve Expense and TimeSheet

AOS1

Total concurrent users: 400 600 800

Order 2 2ash 160 240 320

Procurement 80 120 160

Expense reports 80 120 160

Timesheet 80 120 160

Batch sales order invoicing (batch scheduled 25k SO) 4 threads 8 threads 16 threads

AIF inbound (pre created 500k messages) 4 threads 8 threads 16 threads

SQL Server CPU usage 12.20% 19.30% 27.00%

AOS 1 CPU usage 26.70% 46.00% 61.40%

AOS 2 (for EP only) CPU usage 2.37% 6.22% 9.20%

EP(IIS) Server CPU usage 42.20% 67.80% 85.00%

Batch AOS CPU usage 30.20% 54.80% 77.10%

All servers are 16 Cores, 16 G Box with Windows® 2008R2

SQL Server is 48 Cores, 32 G Box with SQL Server 2012 installed

Page 9: Minimize TCO SCALE UP on AOS Data handling efficiency.

Sizing benchmarkNumber of SO created 3534 5310 7107Sales Order Header (s) 0.18 0.20 0.21Sales Order Line (s) 0.42 0.47 0.48Sales Order Pick (s) 0.80 0.87 0.93Sales Order Pack (s) 0.94 1.02 1.34

Sales Order Invoice (s) 1.34 1.53 1.76

       

Number of PO created 1565 2390 3122Purchase Order Header (s) 0.15 0.17 0.17Purchase Order Line (s) 0.33 0.37 0.40Purchase Order Confirmation (s) 0.72 0.77 0.82Purchase Order Packing Slip (s) 1.43 1.58 1.98Purchase Order ReceiptsList (s) 0.41 0.45 0.48Purchase Order Invoice (s) 4.00 4.48 5.13       Number of Expense Report Created 736 1080 1364Expense Scenario Total Response Time (s) 11.44 15.84 31.70       Number of TimeSheet Created 650 957 1224TimeSheet Scenario Total Response Time (s) 14.49 20.55 39.28       Batch Invoiced SOs Throughput (per hour) 8264 13399 16650       AIF Inbound Batch Created SOs Throughput (per hour) 28890 47849 67812

Page 10: Minimize TCO SCALE UP on AOS Data handling efficiency.

Microsoft Dynamics AX 2012 performance features

• Utilize SQL temp tables• Included columns on

indexes• Full text index support• Computed column

support• Sync support for fill

factors, temp DB sort, ONLINE, compression

Database scalability

• SysGlobalObjectCache (SGOC)

• Compile X++ into IL• Ad Hoc mode• SC/sc hierarchy caching• Join caching• Remove auto RecVersion

update• Date effective caching• Configurable caching

limits in SysGlobalConfiguration

• Light Weight Session Pooling

AOS Scale up/out• Async ledger updates• MRP scheduling

engine rewrite• Many batch jobs

parallelized - BOF • IL enablement for perf

critical components• Many core entities

(GAB, financial dimensions) using SysGlobalObjectCache

• Number sequence enhancements

Application

Page 11: Minimize TCO SCALE UP on AOS Data handling efficiency.

Performance features continued

Defer loading of reference data source

Declarative Display Method caching

Hide fact boxes/preview panes

Client Async loading of Cues Velocity as session state store Managed metadata cache Automatic Ad Hoc mode for

ListPage No postback on Enum lookup

Enterprise portal

Page 12: Minimize TCO SCALE UP on AOS Data handling efficiency.

What’s new in Microsoft Dynamics AX 2012 R2Partitioning

Separate model DB

Improvements in CU4 and Microsoft Dynamics AX 2012 R2Handling of big purchase ordersFaster Dimension Balance updateInventory closingNumber Sequences(R2)Tables per type (SCsc tables denormalized) (R2)Customer aging, Accrued purchase and Trial balance reportsGlobal and private address bookExtensible data security improvementsTracing in CIL enabled

Page 13: Minimize TCO SCALE UP on AOS Data handling efficiency.

Beyond Microsoft Dynamics AX 2012 R2

Optimizations in progress:Dimension frameworkDimension statement reportLarge set of data provider class reportsFinancial statementMitigating parameter sniffing

Page 14: Minimize TCO SCALE UP on AOS Data handling efficiency.

Tracing and trace parserTracing

Using standard Windows Crimson traceTracing Cockpit in Development WorkspacePerfmon data collectorxClassTrace to control tracing in X++ codeMax File Size for circular loggingTrace from multiple processes in one file

Trace parserOverview page with top X++ and SQLCall tree viewFilter/Search X++ and SQLJump to call stack

New in CU4 and R2Enabled Tracing of MSILCreate sub trace(R2)Advanced Trace comparison

Upcoming: Online version refresh

Page 15: Minimize TCO SCALE UP on AOS Data handling efficiency.

demoTracing / Trace parser

Page 16: Minimize TCO SCALE UP on AOS Data handling efficiency.

Excessive Chattiness is usually caused by:• Code running on wrong tier.• Objects from other tier getting passed around thru references• Display methods

Pay attention to:• ServerEvalFunc• ServerNext• ServerSetLoopDependency

RPC

Page 17: Minimize TCO SCALE UP on AOS Data handling efficiency.

Run the business logic in the right tier

Logic on the client: Server static method:

Problem: A server object is created on the client and all business logic like queries and more server call are executed on the client.

Solution: Create a server static method with parameters to run all the business logic on the server, and all this static method from the client.

Page 18: Minimize TCO SCALE UP on AOS Data handling efficiency.

Instantiate and use the object in the correct tier

Object instantiated on client is passed to the server:

Pack client object and unpack on the server:

Problem: A client object is instantiated and passed to a server static method (by reference).

Solution: Implement the pack/unpack pattern to pass the object by value and re-instantiate the object on the server.

Page 19: Minimize TCO SCALE UP on AOS Data handling efficiency.

Avoid passing around objects from different tier

The ServerSetClassLoopDependencies is an RPC that is executed every time that you store a server object as a member variable of a client object.

Example 1 Example 2

Use Displaymethod caching where applicable.

Page 20: Minimize TCO SCALE UP on AOS Data handling efficiency.

Microsoft Dynamics AX 2009

Client Client

Session cache Session cache

Microsoft Dynamics AX 2012

Client Client

Real global cache on server

Class SysGlobal

Cache

Class SysGlobal

ObjectCache

Class SysGlobal

Cache

Perf Patterns: SysGlobalObjectCache

Session cacheSession cache

Page 21: Minimize TCO SCALE UP on AOS Data handling efficiency.

SGOC sample: DimensionCachepublic static void insertValue(DimensionCacheScope _scope, container _key, container _value){ SysGlobalObjectCache c = classfactory.globalObjectCache(); c.insert(DimensionCache::getCacheScopeStr(_scope), _key, _value);}public static container getValue(DimensionCacheScope _scope, container _key){ SysGlobalObjectCache c = classfactory.globalObjectCache(); return c.find(DimensionCache::getCacheScopeStr(_scope), _key);}private static str getCacheScopeStr(DimensionCacheScope _scope){ return 'DimensionCache_' + int2str(_scope);}

Page 22: Minimize TCO SCALE UP on AOS Data handling efficiency.

Before Microsoft Dynamics AX 2012 R2: SCsc Hierarchy and join caching

Inner join

Outer join

Page 23: Minimize TCO SCALE UP on AOS Data handling efficiency.

Perf Patterns: Object mode vs. Ad Hoc mode

Object mode Inner joins parent tables all the way to the root, and outer joins all child tables to

the leaf.

If you only need a few fields, specify the field list to trigger Ad Hoc modeRoot table will always be inner joined.Access to unselected fields will throw exception.

How to use Ad Hoc mode In Select statement and query, specify field list. On modeled Query, turn Dynamic fields to No. On FormDataSource, turn OnlyFetchActive to Yes.

Page 24: Minimize TCO SCALE UP on AOS Data handling efficiency.

Perf Pattern: InMemory vs. TempDB temp table

TempDB temp table is created on SQL Server TempDB

TempDB temp table can join with permanent tables efficiently

Insert into TempDB temp table cause a AOS-SQL roundtripMake sure to use insert recordset to populate.Make sure to populate TempDB from AOS, not from Client.

Samples:SubledgerJournalizer::loadSubledgerJournalTmpDetail

Page 25: Minimize TCO SCALE UP on AOS Data handling efficiency.

DB

AOS

RPC Services

X++

Pcode

Interpreter

X++

IL Code(DLL)

.Net Runtime

SNAC

RunAs()Batch JobsServices

Perf Pattern: intermediate language

Page 26: Minimize TCO SCALE UP on AOS Data handling efficiency.

Run X++ in IL

RunAs:Easiest way to utilize ILMinimal restructuring of X++ codeUse runClassMethodIL or runTableMethodILCaveat: RunAs will run in a new session

Transaction scopeSession cache does not

Samples:DimensionDefaultingService::serverCreateLedgerDimension

Feature details:Compile X++ into IL, full or incremental compile after X++ compilationTransparent to X++ developerSupports Batch, Service, and RunAs sessions; no Client supportBusiness logics run faster

Compiled runtime (IL) vs. interpreted runtime (X++ interpreter) What about SQL queries and kernel class invocations?

Use .NET Garbage CollectionScale up on AOS (Server GC vs. Client GC)

Page 27: Minimize TCO SCALE UP on AOS Data handling efficiency.

SysOperation frameworkUse AOS Services to run business logic

Services run in IL

No way to call back to client, so no chattiness

Automatic generate dialog based on data contract

Choose execution mode – no need to change code!Synchronous

Asynchronous

Reliable async

Batch

Samples: SalesFormLetter

Async ledger updates

Page 28: Minimize TCO SCALE UP on AOS Data handling efficiency.

SQL Server Admin formIncluded columns for indexClient performance optionsServer configurationDeclarative display method caching

New performance configurations

Page 29: Minimize TCO SCALE UP on AOS Data handling efficiency.

Top 10 tips from the session1. Know your systems workload.

2. Microsoft Dynamics AX2012 R2 and CU4 includes performance improvements in 8 areas.

3. Use SGOC for sharing business objects among server sessions.

4. Use Ad Hoc mode to simplify queries and mitigate SCsc hierarchy impact.

5. Use TempDB temp table to efficiently join with permanent tables.

6. Use RunAs sessions to quickly turn your X++ logic into IL code.

7. Use Business Operations Framework to transform Runbase classes, enjoy IL and Async modes.

8. Run business logic in parallel whenever possible.

9. Use new admin configuration settings to improve performance.

10. Always take a trace of your code and use TraceParser to analyze perf issues.

Page 30: Minimize TCO SCALE UP on AOS Data handling efficiency.

Top 10 tuning tips• Appropriate caching for every table• If index is unique, mark it as unique• Enable Numbersequence caching wherever possible• Normalize BLOB usage• Use Display method caching where appropriate.• Avoid code in update/insert/delete methods thereby disabling set based

processing• Is OCC enabled for your customizations• High performing list pages: Set fetch active only, Set firstfast, Reduce

order by• Ad hoc mode

• In Select statement and query, specify field list• On modeled Query, turn Dynamic fields to No• On FormDataSource, turn OnlyFetchActive to Yes

• Use static report design wherever applicable

Page 31: Minimize TCO SCALE UP on AOS Data handling efficiency.

Top 10 X++ code tuning tips• Use set based operations

• insert_recordset , update_recordset and delete_from• Aggregate instead of iterate

• Don’t loop for check if used• SQL TempDB (Microsoft Dynamics AX 2012)• Con2buf / buf2con (Microsoft Dynamics AX 2012)• Bundle calls from client to server• No join on in memory TempDB• Use Parallel processing wherever possible, Parallelism top picking vs.

bundling• Utilize SysGlobalCache and SysGlobalObjectCache (Microsoft

Dynamics AX 2012)• Avoid using PESSIMISTICLOCK in your code• Every call which does not need to be in a loop

should moved out

Page 32: Minimize TCO SCALE UP on AOS Data handling efficiency.

Top 10 SQL tuning tips• Ensure correct configuration (http://blogs.msdn.com/axperf)• Find and resolve Parameter sniffing• Have a clustered index on every table, overall ensure all your queries

are index supported• Don’t create indexes directly on SQL• If index keys are a leading subset of another index, index can

probably be dropped• In Microsoft Dynamics AX 2012 use included columns to your

advantage• Evaluate compression to reduce IO footprint• Use Archiving (IDMF) to keep your data small• Resolve hidden scans• Support sortation with correct indexing

Page 33: Minimize TCO SCALE UP on AOS Data handling efficiency.

Want more information? Visit us!

Financial ManagementConsolidation, eliminations & budgeting. 

Managing Customer ReturnsSales ordering process including managing returned items.

RetailDesigning till layouts and pushing changes to store terminals. 

SecurityImporting active directory users, role creations & user role assignments. 

WorkflowSetup of workflows illustrated through an HR business process.

Data MigrationMigrating data into Dynamics AX 2012.

Solution Architecture ManufacturingPublic SectorRetailServices Industries

Focus rooms Microsoft product technologies showcase

Learn with hands-on experience

Innovate your solutions Get inspired

Bing Maps for EnterpriseMicrosoft ProjectMicrosoft SQL ServerMicrosoft Dynamics AX

Performance LabMicrosoft Technical Adoption

Program (TAP)Email us for a timeslot at:[email protected]

Instructor led labs

Page 34: Minimize TCO SCALE UP on AOS Data handling efficiency.

Next stepsKey actions, resources and Convergence-related sessions/activities

Submit your session evaluation through our mobile event app or by logging into My Convergence on your PC.

Review and relive session recordings and PowerPoint files inside My Convergence.

The Convergence Experience Center has free technical support, Convergence theater presentations, demonstrations and the social experience, featuring the Media Wall and live social feeds.

Use the #MSDynAX and #conv13 hashtags

Scan this tag to get points for participating in this session.

Access Explore Socialize

Did you know that it takes just 5 minutes to help improve Microsoft Dynamics AX documentation? Take the survey at http://t.co/mvBzFNzi.

Survey

Page 35: Minimize TCO SCALE UP on AOS Data handling efficiency.

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.