Loading...
 

Database cache

Database cache

To speed up access to the database, each client computer has its own database cache. This cache is a memory area managed by ObjectStore's cache manager (this is the ObjectStore Cache Manager service).

The size of the cache is defined when ClassiX® is started. It is not possible to reduce or enlarge the cache during operation. The cache shares the RAM (i.e. the physically available memory) with the operating system and the other programs running on the computer at that time. The challenge is to find the "happy medium":

  • On the one hand, the cache should be as large as possible so that as much data from the database as possible is kept on the local computer.
  • On the other hand, only as much memory should be branched off for the cache that other programs, and even ClassiX® itself, still have enough memory to work with. Otherwise, Windows will swapp out memory, and all efforts to speed up the system were in vain.

If OS_CACHE_SIZE is set, this determines how large the cache should be. It is to be noted that the size is indicated in bytes.

If OS_CACHE_SIZE is not set and ClassiX is started via a remote desktop connection, it is assumed that ClassiX is running on a terminal server and has to share the cache with other clients. Therefore the environment variable CX_TS_CACHE_SIZE is used, which sets the cache.

Otherwise the formula

Cache size = (Free physical memory - reserve) * CX_CACHE_SIZE_FACTOR

for use.

With CX_NO_TS, the regular cache size is used instead of CX_TS_CACHE_SIZE when starting ClassiX via remote desktop. This makes sense especially when working from the home office if you are not really working on a terminal server, because the default value for CX_TS_CACHE_SIZE is only 64MB, which is too little for a single workstation computer and would only slow down the ClassiX system.

Parameters Description Standard Unit Test function
OS_CACHE_SIZE Sets the cache size to a fixed value. The formula does not apply. (8 MB) bytes -
CX_TS_CACHE_SIZE If ClassiX® runs on a terminal server, the formula does not apply. Instead, the cache is set to a fixed size. 64 MBytes GetTerminalServerCacheSize
CX_NO_TSThis uses the regular cache size instead of CX_TS_CACHE_SIZE when starting ClassiX via remote desktop.not set, set to 1 to activate-
CX_RESERVED_FOR_APPS Corresponds to the "Reserve" parameter in the formula.
The parameter controls how much memory is left to other programs and ClassiX® itself. ClassiX® itself requires about 32 MBytes (hence the default value).
32 MBytes GetMemoryReservedForApps
CX_CACHE_SIZE_FACTOR Corresponds to the parameter "cache factor" in the formula.
The parameter controls how much of the free memory, minus the above reserve, should be used for the cache. The value 100 means that everything should be reserved for the cache, 0 means no cache (or 8 MBytes, see below).
25 % GetCacheSizeFactor

The minimum cache size is always 8 MBytes, even if the formula calculates a smaller value.

Example

The following environment variables are set:

  • CX_TS_CACHE_SIZE=64
  • CX_RESERVED_FOR_APPS=48
  • CX_CACHE_SIZE_FACTOR=75

When ClassiX® is started on a Terminal Server, a flat 64 MBytes are reserved for the cache.

Otherwise, a certain amount of free physical memory is reserved for the cache. On a computer with e.g. 280 MBytes free physical memory (see task manager) the result is (280 MB - 48 MB) * 75% = 174 MB. This leaves approx. 74 MB free memory for other programs (280 MB - 174 MB cache - 32 MB ClassiX® = 74 MB). If other programs are started in the further course of the program (this includes controls such as Word or Excel!), they share the remaining memory. The same applies to ClassiX® itself, e.g. if large amounts of transient objects are generated in large runs.

In order to check how big the cache is finally, the cache size can be queried by the object manager with the function GetCacheSize(). Alternatively, logging can be activated via the environment variable CX_REPORT_STARTUP. ClassiX® logs how the size is calculated.