If the more obvious checks fail to yield a result, you can use the database tracing cockpit. This has two tasks: recording a trace database and interpreting the results. This process is done in two parts: configuring the trace and executing it.
Tracing is done as part of a coordinated effort with other performance monitors and the user who is experiencing the problem. Since this will affect the system's performance, we need to select a window when this is done so that the user can perform the specific tasks in question.
You will need to have the Trace Parser installed, which is done from the Dynamics AX setup. This should be done on your local PC, and you need to be the local administrator of your PC. Moreover, you should have your account mapped to the system administrator security role within AX.
You should also have access to a SQL Server other than the one used by Dynamics AX.
Carry out the following steps:
MyTraceDatabase
.The reason why the Xpp and Bind parameters are disabled by default is that they may reveal information (that is, actual data) as it is passed between the AX and SQL Servers. This could include sensitive information, for instance salary details. You should, therefore, obtain approval for this before proceeding.
If the trace fails to start, check the following:
You should perform the trace after the system has been in use for a period of time, so as to simulate normal use and avoid having your results skewed by investigating the issues related to the system starting up. The system will behave slower than normal as it takes time to initialize and cache. Always follow this advice, unless the issue is specifically that a task is slow the first time it is performed after system startup.
The trace is performed by the server monitoring the AX code and SQL activity and producing a file that you can import into Trace Parser.
The ETL (Event Trace Log) file can then be imported into the Trace parser (which is done for you by clicking on Open trace). The reason we created the database before starting the trace is so that we can simply click on Open trace and import the file.
By undertaking a full performance test, we analyzed the server counters for the AX and SQL Servers and also performed an AX trace with the tracing cockpit.
Each one, in isolation, will not always provide us with the reason for a performance problem, and even with all these tools being run together, it will not always make the reason obvious. Users can experience performance problems even when all the servers seem to be idling.
Now, we have the following information in hand:
With this, we can correlate the information in order to determine the cause. The cause can be hardware resource, indexing, statistics, code, or a combination.
Low resource utilization, while you are experiencing a performance problem, is also a clue; the resource in question must be waiting for something else.
The most likely causes of performance issues within an SQL Server are:
If a counter indicates high usage for the AX server, it is either badly written code or the server is underpowered. Adding a second AOS may not solve the issue, as code is not load balanced. If this is caused by a batch task running on an AX Server to which users connect, you should consider installing a dedicated AOS for batch tasks (which is the best practice anyway).
One of the main reasons to enable Bind parameters was to take the SQL statement into SQL Management Studio in order to determine its execution plan.
Do not try and use the DELETE
or UPDATE
statements. Even though we don't need to execute the statement in order to gain the execution plan, we will have to use the live database to gain an accurate plan. Not only is there very little we can do to improve the UPDATE
statements, but also there is the risk that we could execute the statement by mistake.
The SELECT
statements are safer, and while checking the resultant execution plan, we are looking primarily for:
As a lower priority, we are looking for index use and the corresponding bookmark lookups. It is ideal to always use clustered index seeks and, less ideally, index seeks. Table or clustered index scans are bad and indicate incorrect indexing on the table or out-of-date data statistics.
18.190.160.63