Calculation of adaptive cache: When this option is checked, management of the memory cache is done dynamically by the system — respecting limits that you set. This allows configuration of a high performance memory cache adapted to most configurations. The size of the memory cache is then calculated dynamically depending on set parameters. The values offered by default correspond to standard 4D usage.
Memory to be reserved for other applications and for the system: Portion of the RAM memory to reserve for the System and other applications. This value is increased for optimization when other applications are running on the same machine as 4D.
Percentage of available memory used for cache: Percentage of the remaining memory allocated to the cache by default. To obtain the size allocated by default to the cache, simply perform the following calculation: (Physical memory – Physical memory to be reserved) X Percentage of the memory used for the cache. In the adaptive mode, the size of the memory cache varies dynamically depending on the needs of the application and the system. You can set limits using the following two options:
Maximum Size: Maximum amount of memory that can be used by the cache. With a 32-bit version of 4D and 4D Server, this value is limited internally to 2000 MB (2 GB) for performance reasons. With a 64-bit version of 4D Server, this value is virtually unlimited.
Minimum Size: Minimum amount of memory that must be reserved for the cache. This value cannot be less than 4 MB.
Setting limits is particularly useful for databases that are distributed on machines for which you do not know the memory configuration a priori. In this case, the limits set let you guarantee a minimum performance in all cases. The following diagram illustrates this behavior: Exemple de calcul de la mémoire cache : Physical memory to reserve = 256 MB Percentage of the available memory used for the cache = 50% Maximum size = 1 GB Minimum size = 128 MB
Examples of configurations in adaptive mode The following examples illustrate the advantages of having an adaptive cache in various software and memory configurations.
Computer with 768 MB of RAM running a single 4D Server. In this case, it is worthwhile to allocate it with the maximum memory cache:
Physical memory to reserve = 256 MB.
Percentage of the available memory used for the cache = 100% since there is only one 4D Server application.
Minimum size = 10 MB and Maximum size = 1GB (in this configuration, these values are insignificant).
Same configuration as before but with three 4D Server applications running on the computer. You want to grant an equal cache for each application. You simply need to set the “Percentage of the available memory used for the cache” to 33% for each server. --> Default cache size for each application: (768 - 256) x 33% = 170 MB
Creation of an executable application intended for wide distribution using multiple configurations. After testing, it is found that the application operates at its best with a cache of between 20 and 100 MB.
Physical memory to reserve = 256 MB.
Percentage of the available memory used for the cache = 50% so as to leave memory available for any other applications.
Minimum size = 20 MB and Maximum size = 100 MB.
--> On a machine with 256 MB of RAM, 4D uses the minimum cache = 20 MB --> On a machine with 1 GB of RAM, 4D uses the maximum cache = 100 MB --> On a machine with 384 MB of RAM, 4D uses (384 - 256) x 50% = 64 MB
Calculation of adaptive cache not checked: this mode, you set the size of the memory cache for the database yourself. 4D then displays an entry area that allows setting the memory cache to use as well as information related to the physical memory (RAM available on the machine), the current cache and cache after restart (taking your changes into account).
The size of the memory cache that you enter will be reserved for the 4D database, regardless of the state of machine resources. This setting can be used in certain specific configurations, or when the database is designed to be used on dissimilar systems in terms of memory. In most cases, the adaptive cache offers better performance.
Keep the cache in physical memory for 4D Server and 4D Volume Desktop This advanced option can be used to “force” the cache to be kept in the physical memory (RAM) of the machine when the database is executed by 4D Volume Desktop or 4D Server. By default the cache can be flushed in part or entirely in the virtual memory of the machine when necessary (the virtual memory is an area set aside on the hard disk). Since this mechanism can, in certain cases, noticeably alter the performance of applications deployed with 4D Server or 4D Volume Desktop, you can check this option in order for the cache to be kept permanently in physical memory. Of course, the machine configuration (size of RAM, number of applications running simultaneously, etc.) must be compatible with this principle. Note: This option does not affect the operation of applications run with the 4D application.
Flush Data Buffers every … Seconds/Minutes: Specifies the time period between each automatic saving of the data cache, i.e., its writing to disk. 4D saves the data placed in the cache at regular intervals. You can specify any time interval between 1 second and 500 minutes. By default, 4D saves your data every 20 seconds. The application also saves your data to disk each time you change to another environment or exit the application. When you anticipate heavy data entry, consider setting a short time interval between saves. In case of a power failure, you will only lose the data entered since the previous save (if the database is running without a log file). If there is a noticeable slowing down of the database each time the cache is flushed, you need to adjust the frequency. This slowness means that a huge amount of records is being saved. A shorter period between saves would therefore be more efficient since each save would involve fewer records and hence be faster. By default, 4D displays a small window when the cache is flushed. If you do not want this visual reminder, you can uncheck the Flushing progress option on the Interface page .