Friday, July 4, 2008

The Advantage Cache System

With the release of Advantage 8.1 a new cache system was introduced. This cache system is used for storing query results in memory instead of on disk whenever possible. This provides a performance benefit since static cursors can be stored in memory eliminating the overhead of creating a file on disk. The greatest performance gain is seen with small static cursors.

Index pages are also stored in the cache system providing performance improvements for all index operations. This includes seeks, filters, reads and writes (ADT only). Index writes for the proprietary ADT file format are cached improving the index update speed. The major benefits of the cache system are:

  • Improved seek performance
  • Improved filter performance
  • Improved index writes for ADT/ADI files
  • Improved processing of SQL where clause(s)
  • Improved static cursor performance

As you might expect there is a limit on how much memory the cache system will use. The default is to use half of the available system memory at startup, however, on a 32-bit system the default maximum is 256MB. The default can be overridden by using the MAX_CACHE_MEMORY configuration entry. If a value is specified this value will be used. You can disable the cache system by setting MAX_CACHE_MEMORY to 0.

The amount of memory that Advantage uses is also determined by the number of Advantage Extended Procedures (AEPs) which are loaded by the system. Regardless of how much RAM your system has installed there is only a specific amount of address space available to the server. Any AEP containers which are loaded use up a portion of this address space. Moving to a 64-bit version of Advantage provides more address space but your AEPs will have to be re-compiled as 64-bit dlls or objects.

Another option for using AEPs which require a lot of memory is to build them as a separate process. You can use Events(Notifications) to invoke a process run by a separate application. This application will have its own address space and will not consume any of the servers address space. The application can be set to listen for an event on the server which is fired by a trigger. When the event is fired the application will then perform the necessary operation(s). You can accomplish the same type of operation with this out-of-process application as you did with your in-process AEP.

If you are experiencing any problems with the cache system you should upgrade to the latest version of Advantage, currently 8.1.0.26 or 9.0.0.1. You should verify that your configuration parameters are set to reasonable and required levels. Review the amount of memory your AEPs are using and consider moving them to an out-of-process application.

Although there is a way to allow a 32-bit application to address up to 3GB of RAM, this is not always a good solution. The /3GB switch can have unintended consequences on your 32-bit system. If you have a server with several AEPs, large tables and indexes which is heavily used, consider using a 64-bit operating system with Advantage 9.0 and newer.

In most cases the Advantage cache system will provide performance improvements without any additional configuration. However, you can configure the system using the MAX_CACHE_MEMORY configuration entry. If your system is consuming vast amounts of ram (>2GB) consider moving to 64-bit.

No comments: