Object caching

Object caching is used in Dynamics AX to improve performance and reduce overall resource usage in a 3-tier application architecture.

Introduction
The purpose of the object caching is store a local copy of the AOT objects which have been used by the client, so that in the future they do not need to be re-read from the AOS. This is done by use of a local cache file.

Caching file
The cached objects are stored in a persistent file on the client's local file system. One file is created for each user logging in to a particular AOS, whilst logged in to a particular Windows account on the client machine. If a Terminal Server is used, the file will be located on the Terminal Server itself and not the computer used to connect to the Terminal Server.

Filename
The file is named using the following convention:

Version 3.0

ax_AOSNAME@AOSMACHINENAME_USERID.aoc

Version 4.0

ax_AOSNAME@AOSMACHINENAME_USERID.auc

where AOSNAME is the name of the AOS instance, AOSMACHINENAME is the computer name of the server running the AOS, and USERID is the Dynamics AX user Id.

If you are operating in a clustered environment, then the cache file will be named differently:

ax(CLUSTERNAME)USERID.aoc

where CLUSTERNAME is the name of the AOS cluster, and USERID is the Dynamics AX user Id.

Version 2009 ax_{GUID}.auc example: ax_{76F5BA3B-AD98-4E5F-A1EE-D58C24370BDC}.auc

The GUID is unique for each installation and is stored in the SysSQMSettings table.

Location
The location of the file depends on your operating system. Under Windows XP the file will be located under your Local Settings\Application Data folder. Usually, this is as follows:

C:\Documents and Settings\%USERNAME%\Local Settings\Application Data

Under Windows 7 and Windows Vista the file will be located under: %USERPROFILE%\AppData\Local

where %USERPROFILE% is the Windows user profile location.

As the cache file is marked as 'Hidden' you should enable showing of hidden files in Windows if you wish to find the file.

Caching mechanism
In simple terms, whenever you run the client and it finds a cache file present, it will load the elements of the cache file into memory.

Whenever the client needs to use a certain object, the client will first see if it has a local copy. If so, then it will ask the AOS for the current version number of that element, and compare with the version number of the local object. If they match, then the local object will be used. Otherwise (or if the object didn't exist in the local cache), the client will request the entire object from the AOS. At client shutdown, the local cache file will be re-written with all objects in memory.

Preloading the cache
To improve initial performance on a installation using slow remote connections, it is possible to distribute a master cache file which contains an initial set of cached elements. One client should be connected to the AOS and all relevant forms, reports etc loaded. This will ensure that they are put into the local cache file. The cache file from that session should then be renamed to master.aoc and can be installed locally on each remote machine.

The master.aoc file should be installed in the \log directory of the Dynamics AX client installation to work correctly.

(Version 3 only) It is also possible to have the master cache file distributed automatically when the client is initially installed. This is particularly useful for installations utilising the Axapta Web deployment concept. The master.aoc file should be put into the same directory as the setup.exe file. In a web deployment environment, this means putting the master.aoc file into the AxSetup folder created for the Web Deployment Utility. This will result in it being copied automatically to the correct location on the client to be used on startup.