KHP
KHP

Reputation: 13

Dynamics AX 2012 Formdatasource::executeQuery calls a lot more methods on specific remote servers

All the AX clients are accessed through RDS.

We received a ticket a few weeks ago that a certain application had bad performance. We were looking in to it but could not reproduce the problem. After some testing around, it seemed that the problem only occurs on 2 specific remote desktops, and not on the others.

Then we started tracing the application on both servers with the Tracing cockpit and I noticed that on the slow-server, the executeQuery calls a lot more of the same methods as the fast-server, in particular, SysQueryRun::next and QueryBuildDataSource::findRange

So I decided to setup a very simple testform with the same basic logic as the application with issues, and this seems reproducible, albeit a lot less calls than the actual application.

The logic used on the form is very simple. In the active of the header-formdatasource, we call the detail-formdatasource executeQuery and apply the filters to the detail-table.

On the fast-server:

Trace-faster-server

On the slow-server:

Trace-slower-server

What could be the reason this happens? It certainly has an impact.

I tried the following things:

Upvotes: 0

Views: 455

Answers (2)

Alex Kwitny
Alex Kwitny

Reputation: 11564

Check that all servers and clients have the same Kernel builds by going to Help>About.

Alternatively, you can check the user log (\Menus\SystemAdministration\Inquiries\Users\User log), and on the general tab it shows the different build #'s for the logins. I typically personalize that form and move it to the grid. That way I can just scroll up/down and look for client mismatches.

Upvotes: 0

Alex Kwitny
Alex Kwitny

Reputation: 11564

I've seen similar issues happen when the AUC/KTI cache files get corrupted. They're safe to delete and get rebuilt every time a new client is opened.

I wrote a little PowerShell script that you can run on the affected server(s) and it will delete the files for you. It also will do a "simulate" delete so you can see what will be deleted if you want beforehand.

You need to make sure the users are not logged into AX on the server or the delete will fail on some files because they'll be locked. If that happens, it's no big deal...just kick the user(s) out of AX and rerun the script until everything is deleted correctly.

Write-Host "For the server $($env:COMPUTERNAME), this script will delete AX user application specific cache files. This is different than 'Usage Data' which will not be affected." -ForegroundColor Green
Write-Host "Specifically it removes *.AUC/*.KTI files from each user's %LOCALAPPDATA% directory and the files located in '%LOCALAPPDATA%\Microsoft\Dynamics Ax' for each user." -ForegroundColor Green
Write-Host "It will also save a transcript to the desktop." -ForegroundColor Green
while(-not (($choice= (Read-Host "Do you want to continue? (No will simulate, but not delete) [Y/N]")) -match "^[YNyn]{1}$")){ "Y or N ?"}
$DoDelete = ($true, $false)[!($choice -eq 'Y')]

Start-Transcript -Path (Join-Path ([Environment]::GetFolderPath("Desktop")) "UserCacheDelTranscript.log") -Append

if (!$DoDelete)
{
    Write-Host "Simulating delete..."
}

Get-ChildItem -Path "C:\Users" -Directory | ForEach-Object {
    $DelPath = "$($_.FullName)\AppData\Local\*"

    if (Test-Path $DelPath) {
        # Remove *.auc/*.kti files
        Get-ChildItem -Include *.auc, *.kti -Path $DelPath | ForEach-Object {
            Write-Output ("Deleting '{0}'" -f $_.FullName)
            if ($DoDelete) {
                Remove-Item $_
            }
        }
    }

    # Remove other misc cache files
    $DelPath = "$($_.FullName)\AppData\Local\Microsoft\Dynamics Ax"
    if (Test-Path $DelPath) {
        Get-ChildItem -Path $DelPath | % {
            Write-Output ("Deleting '{0}'" -f $_.FullName)

            if ($DoDelete) {
                Remove-Item -Path $_.FullName -Recurse -Confirm:$false
            }
        }
    }
}

Stop-Transcript

Upvotes: 0

Related Questions