最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

[转]Walk through major features of Microsoft Dynamics AX 2012 Trace Parser

AX 2012 William 4151浏览 0评论

原文地址:http://blogs.msdn.com/b/axperf/archive/2011/08/15/walk-through-major-features-of-microsoft-dynamics-ax-2012.aspx
http://blogs.msdn.com/b/axperf/archive/2011/09/06/walk-through-the-major-features-in-microsoft-dynamics-ax-2012-trace-parser-part-2.aspx

Microsoft Dynamics AX 2012 Trace Parser is a performance analyzer that helps users discover and resolve performance problems in customized Microsoft Dynamics AX systems. Unlike its previous versions, Trace Parser is now a component within the Microsoft Dynamics AX 2012 release.

Trace Parser provides user interfaces to import, process and render ETW tracing events that produced by Microsoft Dynamics AX. User can then analyze tracing events to identify performance bottlenecks such as long-running X++ methods, slow SQL queries and frequently called RPCs.  Features in Trace Parser help users determine the root causes of performance problems.

This blog series will walk through the major features of Trace Parser.

Install and set up Trace Parser

Trace Parser can be installed using the Microsoft Dynamics AX 2012 setup program.  Note that Trace Parser requires .Net Business Connector. In order to run Trace Parser, you also need access to a SQL Server 2008 instance (Enterprise or Developer edition) with admin permission. Using a local SQL server instance is recommended. You don’t need to use the same SQL instance where the AX DB is installed.

The first time you start Trace Parser, you will be prompted to set up Trace Parser database. You need to let Trace Parser create a new database for you. Do not select an existing database. Fill in server name and type a database name that doesn’t exist, and then click the “Register” button:

A message box “The specified database does not exist. Would you like to create it?” is displayed.  Click“Yes” to create and register a new database.

The “Select Trace” window pops up. You can click the Cancel button to dismiss the window for now. Note the status bar at bottom displays the registered database name now:

Collect and import trace

 

Collect Trace

Start Microsoft Dynamics AX 2012 client and switch to Development Workspace. Open the Tracing cockpit (in the Tools menu) form:

By default, the “Bind Parameters” and “Xpp Parameters Info” events are unchecked. This is to avoid capturing confidential information which could be exposed through the parameters of X++ methods and SQL queries. Always ask your customer or IT Admin whether it’s OK to collect these information. If you have cleared the legal and privacy concerns, we recommend you check the options to collect more useful information.

To collect trace:

  • Click “Start trace”, specify a trace file name.  Event tracing is now enabled in AX.
  • “Replay” the scenario that you are investigating in AX client. Once done, click the “Stop trace” button in Tracing Cockpit. A trace file is now created.
  • You may now click the “Open trace” button to launch a new Trace Parser instance and imports the trace automatically. For the purpose of this walk-through, click the “Close” button to finish this step.

Tips and tricks:

  • We recommend choosing “small” scenarios to produce small but relevant trace files.
  • We recommend “warming up” your system before collecting the trace. This will generate less noise such as metadata reads.
  • If possible, collect traces on a machine that runs AOS because traces collected on such machine contain tracing events from both server and client sessions. A helpful feature in Trace Parser, “Drill into sessions” (explained later), works only if a trace contains both server and client sessions.

 

Import trace

 

In Trace Parser, click the menu item “File -> Import trace” and then specify the trace file that was created in the previous step. Trace Parser now starts importing the trace, and it may take up to minutes to finish, depending on the file size.

After importing is finished, Trace Parser displays the overview of the imported trace. The overview gives users quick ideas about the “hot spots” in the trace by showing the top-most expensive X++ method calls and SQL statements across all sessions.

Analyze traces

Open Traces

Once a trace file is imported, it is automatically opened in Trace Parser. Alternatively, users can click the “File -> Open trace” menu item to bring up the “Select trace” dialog to open an imported trace.

Select session

Click the Session drop-down combo box to bring up session list:

The example above shows three server sessions (the sessions under “Ax32Serv.exe”) and one client session (the session under Ax32.exe).   Note that server session (Session #3) is correspondent to the client session (Session #3), and that forms a “session pair”.   In many cases the “session pairs” are the main analysis targets since they capture the full footprints of certain scenarios.

Only server sessions contain database calls (SQL events).

Overview, Call Tree, X++/RPC report and SQL Report

Overview

After a session is selected, Overview page displays the topmost expensive X++ or SQL calls in the session (User can check the “Show summary across all sessions” checkbox to display the overview of the trace across all sessions).

Call Tree

Call Tree organizes and renders tracing events in a tree-like UI control. The events are organized as a list of “call stacks” in chronological order:

Relatively “expensive” calls are emphasized with different colors (the red line in the screenshot above, for example).  For example, if a method call foo() takes up 70% time of its parent method bar(), foo() will be highlighted with deep red. The more percentage it take up, the deeper the color. In our previous example, if another method foo2() takes up another 20% time of parent method bar(), foo2() will have a lighter red color than foo() has.

The Context area displays information about the currently selected event.  For X++ method calls, source code is displayed (if an AOS connection is available), and if “Xpp Parameters Info” events are available, the call arguments are displayed as a comment line before the source code. For SQL events, full SQL statement is displayed. If “Bind Parameters” events are available, query parameters are displayed in the SQL statements.

X++/RPC report

X++/RPC report displays information about X++ and RPC events in a sortable data grid. It has two sub-views:Aggregate and non-Aggregate.  Aggregate view shows summary information of X++/RPC events grouped by names, and non-Aggregate view displays the detailed information of single X++/RPC event. Toggle the “Show Aggregate” check box to switch between two views.

Name Filter is used to search for particular X++/RPC events by name, and it supports use of wildcard.  Typing “*::write*”, for example, will list all X++ method names that contain a substring “::write”.

Call Stack displays call path from top-most caller to the currently selected X++/RPC method. As X++/RPC can be called from multiple paths, the call stack navigator is used to navigate through all the calling paths.

Clicking on the “Jump to Call Tree” button switches the current view to Call Tree and displays the selected X++/RPC method:

The Code text area displays the source code of the select X++ event. If “Xpp Parameters Info” events are collected in the trace, the first line is always the call arguments of the X++ method.

SQL report

SQL report is very similar to X++/RPC report; SQL report displays SQL events in a sortable data grid.

By default, “Show Statements” is checked, which means the “Name” columns contains the full SQL statements. If “Show Table” is checked, the “Name” column displays table name only.

More about navigation

The “Jump to Call Tree” button in X++/RPC report and SQL report navigate users from X++/RPC or SQL report to Call Tree.  There are more navigation features in Trace Parser that help users navigating between different views or sessions.

Drill through sessions

Server and clients tracing events are logged in different sessions, and Trace Parser can open one session at a time.  Feature “Drill through sessions” helps to connect events in client and server sessions (the “session pair”). Note this feature is available only if a trace contains both client and server sessions.

Look at a typical scenario: “Method_C” in client invokes an RPC; Server receives the RPC, and then the RPC invokes “Method_S” in server:

If a user is looking at a RPC event in the client session, and he likes to follow through to the server session to check the details of the RPC, he can use the “Drill through to server session” command to open the server session and locate the corresponding RPC.

Similarly, user can “jump” to client session from server session using the “Drill through to client session” command.

To Drill through session:

In Call Tree, select and right click a RPC node, click the “Drill into [Server | Client] session” menu item:

Trace Parser will open the sever or client session and search for the corresponding RPC:

Navigate from Call Tree to X++/RPC or SQL report

In Call Tree, right-click a node to bring up the context menu:

(If the node is a SQL event node, the context menu will display “Jump to SQL Non-Aggregate” view”.)

Click “Jump to X++ Non-Aggregate view”. The current view is switched to X++/RPC report’s “Non-Aggregate view” (the “Show Aggregate” is unchecked) with the Name Filter set to the event name:

For SQL event in Call Tree, “Jump to SQL Non-Aggregate” view brings user to the Non-Aggregate view of SQL report, with the Name Filter set to the SQL statement.

Quick navigation from Aggregate to Non-Aggregate view.

In both RPC/X++ and SQL report when “Show Aggregate” is checked, right clicking on any row in the main data grid or the call stack brings up a context menu:

Click the “Jump to Non-Aggregate” menu item. The “Show Aggregate”” is switched off and the Name Filter is set with the selected event name:

Search in Call Tree

User can search for event node by name in the Call Tree. Press Ctrl + F to bring up the “Find” window, type a name string and click “Find Next”:

转载请注明:ww12345678 的部落格 | AX Helper » [转]Walk through major features of Microsoft Dynamics AX 2012 Trace Parser

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址