Professional Documents
Culture Documents
May 2010
Table of contents
Introduction ....................................................................................................................... 3 Reviewing settings and test results ................................................................................. 3
Settings for testing ..............................................................................................................................................................................................3 Test results for finite-capacity job scheduling...........................................................................................................................................5 Test results for infinite-capacity operation scheduling ..........................................................................................................................6
Introduction
This document provides an overview of the level of performance you can expect from Master Planning in Microsoft Dynamics AX 2009. It is designed for technical consultants and functional consultants who have some understanding of the code base. You can use this document to: Understand the helper framework so that partners can modify it effectively without affecting concurrency. Explain performance-related user parameters. Troubleshoot performance issues.
Specifications
The following hardware and software specifications are for example only and are not recommended. This scenario purposely uses a lower-end hardware setup to measure scaling performance. Database Server: HP ProLiant DL385 G1 Processor: 4 x 2.6 GHz AMD Memory: 4 GB Disk Drives: Disks: 7 x 146.8 GB @ 10K RPM Disks: 1 x 36.4 GB @ 15K RPM Disks: 2 x 73.4 GB @ 15K RPM Network: 2 x Broadcom NetXtreme Gigabit Ethernet Database Software Settings/Operating System: Microsoft Windows Server 2003, Enterprise Edition Microsoft SQL Server 2005 Service Pack 2 Data Volume: SA6400 controller Array: A Disks: 7 x 146.8 GB @ 10K RPM Log Volume: SA 6i controller (embedded) Array: B
3 MICROSOFT DYNAMICS AX: MASTER PLANNING PERFORMANCE
Disks: 1 x 36.4GB @ 15K RPM TempDB Volume: SA 6i controller (embedded) Array: A Disks: 2 x 73.4GB @ 15K RPM
Application Object Server (AOS): Model (SJR2A081) Intel x86 4 x 3.5 GHz Memory: 4 GB Network: 2 x Intel PRO/1000 MT Dual Port Network Connection (Ethernet 802.3) Application Object Server (AOS) Software Settings: Microsoft Windows Server 2003, Standard Edition
Volume
Because master plan runs are dependent on a multitude of parameters, this example does not include a complete list pertaining to volume. However, this example does include details about the number of planned production orders, which will give you an approximate idea about expected performance.
Update phase
Customers who are running Microsoft Dynamics AX 3.x may find the update phase timing on the low side. This is because Master Planning in Microsoft Dynamics AX has three main code paths for the Update phase, including: A. Master plan run without filter and freezing time fence B. Master plan run without filter, but with freezing time fence C. Master plan run with filter In Microsoft Dynamics AX 3.x, code path A is optimized. Beginning with Microsoft Dynamics AX version 4.x, path B is also optimized. It is recommended that the nightly master plan run is done without filter. If you choose to run master plan with filter, the Update phase time on your system will not correlate with the following figures for finite- and infinite-capacity job scheduling. Note: The trial runs were done without filter and without freezing time fence.
Coverage phase
If you run master plan with finite-capacity job scheduling, you will see performance gains even on a single-threaded run. For the finite-capacity job scheduling test run results below, it would have taken approximately 24 hours to complete the coverage phase. This reduction in timing is due to multiple performance initiatives. Some of these initiatives need user interaction in terms of proper setup. For more information, see the chapter titled Using finite capacity.
Futures phase
With Microsoft Dynamics AX 2009, you can expect a significant decrease in futures timing even on single-threaded run, as compared to previous versions of Microsoft Dynamics AX.
4 MICROSOFT DYNAMICS AX: MASTER PLANNING PERFORMANCE
In previous versions, all planned production orders were rescheduled during futures, regardless of whether they were delayed. In Microsoft Dynamics AX 2009, a subset of delayed planned orders is rescheduled during futures, as shown in the following graphic. (Red denotes planned orders that are delayed.)
MAIN THREAD
HELPER THREAD
Threads 1..n
Get next list number
Figure 2. Simplified graphical representation of the parallelism framework As shown in the Fetch items routine process, blocking the ReqProcess record has the potential of placing a significant constraint on scaling. However, it is important to note the following: A. Blocking is done once per list, so the number of blocks is very small. For example, if there are 10,000 items divided into 500 lists, then the blocking is done only 500 times instead of 10,000 times (i.e. the number of individual items). B. Each list contains a number of items that in total will take different times to manipulate. This in turn means that the number of threads trying to fetch a list number at the same time will decrease. Because of these conditions, the list size plays an important role in alleviating the lock contention on ReqProcess record. As shown in the following figure, you can set a parameter while starting a run and set the list size while starting the master plan run.
Figure 3. Item distribution factors in Master scheduling The formula for calculating list size is as follows: List size = Max of (Item distribution factor, 1) * Max of (Number of helpers, 1) Although it may be appealing to set the Item distribution factor to a large value, this methodology is problematic because the average time to process requirement transactions will vary across items. This can be the result of multiple factors. For example, the number of requirements per item will vary, or in the case of finite capacity, there is a significant bottleneck for certain items, and so on. If a majority of long-running items get assigned to a single thread, then there are some threads that will finish faster. These threads will have to stay idle until the rest of the threads finish processing. This will hinder parallelism and result in unpredictable master plan run times.
Bottleneck scheduling
Every work center has a checkbox that you can select to indicate whether the work center is a bottleneck resource. In addition, the new Bottleneck capacity time fence feature has been introduced on ReqPlan. It is recommended that you carefully examine the routes and mark only appropriate work centers as bottleneck resources. You can also set the finite-capacity time fence to a low value and assign the previous finite-capacity time fence value to the Bottleneck capacity time fence. The combination of [primary work center finite + secondary work center infinite] will provide much better accuracy and performance than [primary work center infinite + secondary work center finite]. Finite in this context indicates a work center that is scheduled with finite capacity due to a finitecapacity time fence or Bottleneck capacity time fence. This performance behavior is not new to Microsoft Dynamics AX 2009; it occurs because conflicts on the primary work center are resolved before moving on the secondary work centers. In cases where the primary work center is scheduled with infinite capacity and the secondary work center is scheduled with finite capacity, the logic goes through additional code loops, and there is a chance that max number of conflicts parameters will be reached quickly. This is especially true when the secondary work center has a large number of conflicts. Note: It is outside the scope of this white paper to discuss the importance of scheduling planned orders only on the basis of bottlenecks. If this feature is used correctly, you should experience improvement in planning results accuracy along with better performance.
Capacity scheduled
Additional features
There are a number of additional performance enhancements introduced in the code that do not require any user setup. For example, a feasible scheduling date is now kept in memory, which is effective for items that have a large number of production orders (e.g. due to minimum order size set to a relatively small number). When an item changes direction from backward scheduling to forward scheduling, logic stores the information in memory and first-pass backward scheduling (as shown in Figure 4) is omitted for all subsequent planned production orders.
Select an item
Select a dimension ttsbegin Process transaction for the item dimension ttscommit
Figure 5. Item dimension locking If two concurrent threads are trying to select the same record for update, then one of the threads will have to wait. This results in a significant decrease in parallelism. To help ensure that this situation does not occur, it is recommended that you use generic code.
You will need to decide how to address this issue using modified code. For example, lets say you have an integer field in the ItemGroup table that gets increased or decreased with the number of requirement transactions that are generated for items falling into that group. This is clearly a problem because concurrent threads may end up updating the same item group record and lead to lock contention. Another type of problem occurs when you have updated a record and need the updated value of this record to be instantly visible to all other threads. If you use the transaction scope used by Master Planning in Microsoft Dynamics AX to update such values, the other threads will not have visibility to the new value until an item dimension is completely processed. To alleviate blocking, you can try the following options: A. Use a user connection to update the record. However, it is important to note that user connections can lead to severe degradation in performance if used frequently. B. Create a delta table that will store the modified value; at the end of the master plan run, use this delta table to summarize the changes. C. Use the ReqProcessItemDimList table with generic code. Although this table has multiple inserts, we have not deployed any blocking or user connection. It is possible to get duplicate values in this table, but they have no adverse effect on master planning because they are inserted into a set before use, thus eliminating duplicates. In addition, you should review the blocking strategy used in the generic code. This is convenient when you need to update a record that is common to all running threads. To view an example, refer to the ReqProcessItemList InsertIfNotExistsOrCheckUpdateLevel code table.
NO
NO
YES
YE S
Create a new user connection: 1) User connection ttsbegin 2) Insert Record 3) User connection ttscommit
return
Troubleshooting
It is important to note that there is a limit on scaling. As you increase the number of threads and the run time approaches the limit, the scaling should taper off. The parallelism framework is not effective if your single-thread master plan run concludes too quickly (e.g. 1520 minutes). In this case, it is not recommended to use helpers. However, an item distribution factor still should be set; the recommended setting is 100. It is also important to note that all items under a single list are held in memory. Therefore, if you set this value to a large number (e.g. equal to number of items), it may slow the processing time. Furthermore, if you set the value to zero, then each list will have a single item (refer to the formula for calculating list size in the chapter, Understanding the parallelism framework). In this case, the logic will perform a large number of updates on the ReqProcessList record. If your master plan run does not scale, you can perform the following troubleshooting steps: 1. If you are using finite capacity, complete a run using infinite capacity to confirm whether the plan is scaling. 2. 3. Alter the list size. Reduce the number of threads running on a single AOS, and try using an additional AOS. Note: When using an additional AOS, it is important to set the Maximum batch threads (AdminSetup-Server configuration) correctly. Failure to do so will result in running either too many or too few threads on an AOS. 4. 5. 6. Check blocking at the database level. If you are using finite capacity, then blocking on the ProdParameters record is expected. Review the Master planning/inquiries/processes/unfinished scheduling processes form. If you have customized the code, ensure that the ReqCalcScheduleItemTable.Run() method is not inside a transaction scope. For example, the following sample code will result in blocking: ttsbegin; ReqCalcScheduleItemTable.Run(); ttscommit;
7.
Review the item process time by selecting the Track item process duration checkbox in the Master scheduling dialog box.
Figure 7. View item process duration in Master scheduling dialog box The trace records are stored in the reqProcessItemTrace record and provide details on how much time each item is taking per phase. You will have to export these records to a spreadsheet to perform the analysis. Remember to sort the records on ProcessId, ThreadId, Sort fields to get an accurate picture. By using this trace information, you can: Find out how many items were processed by individual helpers. This should reveal whether there is a hardware bottleneck. Determine which items are taking the longest time, and investigate whether you need to change the item setup (such as revising the maximum order quantity). Find out the time stamp of the last item processed per helper. For example, if all helpers finished processing coverage level zero at 1:00 A.M., but one finished processing coverage level zero at 2:00 A.M., then you need to reduce your list size. Note: Because this table fills up quickly, it is important to delete all records from this table after your analysis is complete.
8.
Figure 8. Number of retries executed The value of these fields is expected to be zero under normal circumstances. If either value is not zero, it signifies that you have some code issues. Admin/setup/system/Concurrency Model Configuration has a Log all UPDATE conflict exceptions checkbox. When this checkbox is selected, all statements that caused Optimistic concurrency control (OCC) conflicts are recorded in the Event Log. To determine which part of the code is causing retries as a result of updating conflicts, you can select this checkbox. (You may need to restart AOS).
Conclusion
With out-of-the-box support for parallelism, Master Planning in Microsoft Dynamics AX 2009 offers greater control and flexibility for scaling. If you encounter difficulties with scaling, there are a number of troubleshooting techniques to try, including switching your master plan run from finite capacity to infinite capacity and using trace records to determine how long items are taking during each phase. For more information about Master Planning in Microsoft Dynamics AX and Supply Chain Management in Microsoft Dynamics AX, visit www.microsoft.com/dynamics/en/us/products/axsupply-chain.aspx.
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, this document should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO THE INFORMATION IN THIS DOCUMENT. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property. 2010 Microsoft Corporation. All rights reserved. Microsoft, Microsoft Dynamics, the Microsoft Dynamics Logo, SQL Server, and Windows Server are either registered trademarks or trademarks of Microsoft Corporation, FRx Software Corporation, or Microsoft Business Solutions ApS in the United States and/or other.