In 4D Server Preferences, topic Database, subtopic Data Management, there is a section where you can set application memory and database cache size. There are two main configurations, Forced and Adaptive cache settings.
1) The Forced cache setting is set when the checkbox "Calculation of adaptive cache" is not checked. Only one option is available to set, which manually sets the 4D Server database cache size. The database cache is set to this size regardless of the machine resources available.
2) The Adaptive setting (the above checkbox is checked) has a more versatile behavior. Memory allocation is calculated dynamically and respects the limits you set.
a) Physical Memory to be reserved - This is the amount of memory you wish to leave available to the system and all other applications on the machine. 4D will be limited from accessing this amount of physical memory.
b) Percentage of available memory used for the cache - Take all physical RAM on your system, subtract the amount of memory in the "reserved" setting, and then multiply by the percentage you place in this settting, and that is the the calculation of how much memory is set for your database cache.
c) "Maximum Size" is an absolute limit on the maximum database cache size. If the above calculation exceeds the Maximum Size, the cache size will be set to this limit.
d) "Minimum Size" is the smallest the cache can get when there are at least enough memory resources to reach the minimum. The cache can be smaller than this size if there is not enough available memory.
How the cache is calculated:
The database cache calculation begins by subtracting the "Physical memory to be reserved" from the physical memory installed on the system. The "Percentage of available memory" is applied to that difference. If the resulting amount of memory does not exceed the maximum or minimum "Size" limits, then the database cache will be set to the calculated size. If the result exceeds a "Size" limit, it will be set equal to the value of that size limit. The "current cache", also found in the "Database Cache Settings" section, reports the calculated amount for the running instance of 4D, and the "Cache on Restart" is the value that 4D will use in its next running instance (when you shutdown and restart 4D).
- For example, you have 1 GB (1024 MB) of physical RAM on your machine. You set 256 MB to be reserved for the system. So 4D has access to 768MB of physical RAM. Then you set the percentage of available memory used for the cache to 80%. 4D uses the percentage to calculate (1024 - 256)*0.80 for an estimated cache size of 614 MB. Lets say your the maximum cache size to 512MB and the minimum cache size to 100MB. The actual database cache size will be 512MB RAM because the original calculation exceeded the maximum limit that you set.