4D v16.3

Database/Memory page

Home

 
4D v16.3
Database/Memory page

Database/Memory page  


 

 

You use the settings on this tab to configure the cache memory for the database.

  • 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 for technical reasons (2 GB on Windows and 1.5 GB on Mac). With a 64-bit version of 4D, 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:
    Example for calculating cache memory:
    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).
      --> Default cache size: (768 - 256) x 100% = 512 MB
    • 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.
  • Flush Cache 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. You can also call the FLUSH CACHE command to trigger the flush at any moment.
    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 .



See also 

Database/Data storage page

 
PROPERTIES 

Product: 4D
Theme: Database Settings

 
HISTORY 

New
Modified: 4D v16

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)