36
Microsoft Dynamics AX Technical Conference February 3–5, 2014 Bellevue, WA

* Checklist provided in the end

Embed Size (px)

Citation preview

Microsoft Dynamics AX Technical ConferenceFebruary 3–5, 2014Bellevue, WA

Help!MRP is slow.Mehmet C. YurdalSoftware Development Engineer II

IntroductionWe are excited to share Microsoft Dynamics AX 2012 R3 with you…• This presentation contains Microsoft confidential information• Dynamics AX 2012 R3 is pre-release software and subject to change• Microsoft provides no license, express or implied, in this presentation• Please review and respect the disclaimer included in all printed

and electronically distributed materials

Introduction

• MRP engine is very generic, made to support multiple industries and business processes

• Performance and runtime are not the same • Many things can be done before an

escalation• It is a trial and error game• Your needs can change, so can the

performance

Agenda

* Checklist provided in the end

Out of the box

Tools

Code

Out of the box

Data composition and how to use MRPMRP horizon

Make good use of the static and dynamic plans

Aggregation of records where possibleE.g. how do you process orders?

Avoiding explosion of recordsE.g. maximum order quantity

Understanding the design E.g. not using dimensions properly?

Purple Bike

Orange Bike

Purple Shirt

Orange Shirt

Purple Bike

Purple Shirt

Orange Bike

Orange Shirt

Parameters

Use of cache parameterThree settings minimum/medium/maximum

Find your own optimal value

MRP time fencesTry to understand and use them well

If you don’t know what it does, don’t put a high value

Try and save on some of the work if you can

Time fences continued

Multi threading in MRP: Helpers

The optimal number of helpersVery dependent on the data composition, can go either way

• More helpers & smaller bundles: Could avoid waiting for the weakest links

• Less helpers & bigger bundles: Could avoid waiting for DB locking

Infant mortality issue with helpers99 helpers 8 running, timed out threads are replaced by new ones

More suggestionsHardware setup

Are you using adequate hardware resources?Latency in connecting to the DB?

Use more AOS servers, parallelize the MRPDedicated AOS batch server for MRPWhen setting up multiple AOSs use the server configuration >performance optimization tab to define how AOS's work together

Heavy routines E.g. Inventory closingOther batch processesAnything in the OS

Hotfixes are your friends!

Probably you are not the first one mbs.microsoft.com/partnersourcembs.microsoft.com/customersource

* Apply and try, but always in test environment first

Troubleshooting the code…

Things to look at• Indexes• Query counts• Caching• Loops• Locking and deadlocks• Table level validations• SQL query plans

Indexing• Clustered indexes• Non-clustered indexes• Having the proper indexes is crucial, but

depends on data composition• Make double sure you are hitting index

keys• In rare cases using indexes might be slower

than whole table scan*• *Industry analysis say only about 1% of the cases

Purple Bike

Orange Bike

Purple Shirt

Orange Shirt

Purple Bike

Purple Shirt

Orange Bike

Orange Shirt

SQL Query analysis• Query count vs. the query execution time• Sometimes having two queries is not a bad

idea• Can you cache and avoid the round trip?• insert_recordset, update_recordset are also your

friends• Table level/AOS validations • Wait times due to table/page/row level

locking• Keep transaction scopes as small as

possible (ttsbegin…ttscommit)

SQL query execution plans

• How do we get the query execution plan?• SQL Query optimizer might not always be

optimal• Make sure that the statistics & plans are

up to date• Data composition plays an important part• Constructing predefined plans & plan

guides

* Keep in mind it can be hard to maintain query execution plans

Tools

Tracing & Profiling

What kind of tools can be used? Dynamics AX Trace ParserPerformance Analyzer (Dynamics Perf)SQL Server ProfilerPerformance Monitor

One needs to know when to trace & when to profile

Demo

Performance Analyzer

Performance Analyzer Demo

• Dynamics Perf, how to get it up and

running?

• A quick MRP run & data collection example

• What are we seeing here?

• Light foot print, a separate database

Performance Analyzer: Indicators• EXECUTION_COUNT • TOTAL_ELAPSED_TIME (A)• TOTAL_WORKER_TIME (B)• TOTAL_WAIT (A – B)• ELAPSED_PERCENTAGE and WORKER_PERCENTAGE

• AVG_LOGICAL_READS • AVG_PHYSICAL_READS

Performance Analyzer: A real example

Demo

SQL Profiler

SQL Profiler

Useful eventsBlocked process reportLock: EscalationLock: Deadlock/Deadlock chain/Deadlock graphSort/hash warningsData/log file auto-growth

Profiling templates

Use the SQL profiler in parallel with

Dynamics Perf* Expect potential performance impact

Demo

Performance Monitor

Performance Monitor

• Where to find? How to run?

• Lots of extra counters added by SQL server

• Add your own data collectors/counters

• You can schedule regular runs for all three

tools.

• Use in parallel with the SQL profiler &

Dynamics Perf

Next step: Escalation…

Escalation to MS: Good to know

• When to escalate?• What to escalate?• How to escalate?• What to provide? • What to be ready to provide?• Why can it take long?

ChecklistHow is MRP being used?

How often, how big, how complex, not intended usage of related data?

Is my Hardware adequate?RAM, latency, scaling etc.

ParametersAre your parameters setup correctly?

HelpersAre they used at all? How many & is it optimal? Multiple AOS's, dedicated AOS instance, SQL server in a different box?

HotfixesWhich ones are applied, can I find a hotfix already addressing my issue? Always apply in test environment first(Goes without saying)

Time to get to tracing/profilingTrace parser on smaller data, Dynamics Perf, SQL server profiler, Performance Monitor, and others

Try & FixIndexes, Query optimization and loops, caching, Locks & deadlocks, Query plans/plan guides

Escalation to MicrosoftPrepare as much as possible, have an environment handy, CSS/SE, Core team 

Useful links• Dynamics AX manufacturing team blog http

://blogs.msdn.com/b/axmfg/• Performance analyzer (Dynamics Perf) http://

archive.msdn.microsoft.com/DynamicsPerf• Partner source

mbs.microsoft.com/partnersource• Customer source

mbs.microsoft.com/customersource• More Information on query execution plan statistics

http://msdn.microsoft.com/en-us/library/ms190397.aspx

• More information on plan guides http://technet.microsoft.com/en-us/library/ms190417.aspx

Q&A

Agenda addition for Ask the ExpertsWe’ve added another “Ask the Experts” session and changed a room assignment for tomorrow. See the updated schedule below. This information is posted in the mobile event app.Wednesday, February 5, 8:30-10:00

ASK401 Ask the Experts – Service Industries Evergreen A

ASK402 Ask the Experts – Microsoft Dynamics AX application (supply chain, payroll, human resources)

Cedar B

ASK403 Ask the Experts – Manufacturing Regency E

ASK404 Ask the Experts – Retail Grand Ballroom

ASK405 Ask the Experts – Microsoft Dynamics AX components (lifecycle services, Azure, upgrade, update experience)

Evergreen E

ASK405B

Ask the Experts – Microsoft Dynamics AX components (performance, architecture, development)

Evergreen G

ASK406 Ask the Experts – Financials and Public Sector Evergreen I

ASK407 Ask the Experts – BI, Reporting and Corporate Performance Management

Regency A

THANK YOU for attending! Your feedback is extremely important, please complete an evaluation using one of the following options:

• On the fly from the mobile event app• Communications Kiosks located in the Evergreen Foyer, Grand

Ballroom Foyer and Regency Foyer

• Via the Dynamics AX Technical Conference website: www.microsoft.com/dynamics/axtechconference

DisclaimerThis presentation contains Microsoft Confidential Information. Microsoft may use any suggestions, comments, or other feedback that you provide for any purpose without obligation. This presentation is provided for informational and training purposes only. It represents Microsoft’s view as of the presentation date. Microsoft cannot guarantee the accuracy of any information after the presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted as a commitment on Microsoft’s part. This presentation is provided “as-is”.

Microsoft Dynamics AX 2012 R3 is pre-release software under development. All dates, features, and descriptions specified are preliminary, are based on current expectations, and are subject to change at any time without notice.

Sample code included in this presentation is made available AS IS.  THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF ANY SAMPLE CODE REMAINS WITH THE USER.

MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. NO LICENSE (EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE) TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS PRESENTATION.

© 2014 Microsoft Corporation. All rights reserved.

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows 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.