Configuration Parameters That Affect Memory Allocation

When setting the SAP ASE memory configuration, use sp_configure to specify each memory requirement with an absolute value. Also specify the size of the procedure and default data caches with absolute values.

There are three configuration parameters that affect the way in which memory is allocated: max memory, allocate shared memory, and dynamic allocation on demand.

max memory

max memory allows you to establish a maximum setting for the amount of memory you can allocate to SAP ASE. Setting max memory to a slightly larger value than necessary provides extra memory that is utilized when SAP ASE memory needs increase.

When you increase the value for max memory, sp_configure sets max memory to the value you specify. However, memory allocation might happen later in time. The way SAP ASE allocates the memory specified by max memory depends on how you configure allocate max shared memory and dynamic allocation on demand.

When you upgrade, if the value for max memory is insufficient, SAP ASE automatically increases the value for max memory. The newer version of SAP ASE may require more memory because the size of internal data structures has increased.

allocate max shared memory

allocate max shared memory allows you to either allocate all the memory specified by max memory at start-up or to allocate only the memory required by the total logical memory specification during start-up.

On some platforms, if the number of shared memory segments allocated to an application is more than an optimal, platform-specific number, you may see some performance degradation. If this occurs, set max memory to the maximum amount available for SAP ASE. Set allocate max shared memory to 1 and restart the server. This ensures that all the memory for max memory is allocated by SAP ASE at start-up, using the smallest number of segments.

For example, if you set allocate max shared memory to 0 (the default) and max memory to 500MB, but the server configuration requires only 100MB of memory at start-up, SAP ASE allocates the remaining 400MB only when it requires the additional memory. However, if you set allocate max shared memory to 1, SAP ASE allocates the entire 500MB when it starts.

If allocate max shared memory is set to 0 and you increase max memory, the actual memory allocation happens when it is needed. If allocate max shared memory is set to 1and you increase max memory, SAP ASE attempts to allocate memory immediately. If the allocation fails, SAP ASE writes messages to the error log.

The advantage of allocating all memory at start-up is that there is no performance degradation while the server readjusts for additional memory. However, if you do not properly predict memory growth, and max memory is set to a large value, you may be wasting physical memory. Since you cannot dynamically decrease memory configuration parameters, it is important that you also consider other memory requirements.

dynamic allocation on demand

dynamic allocation on demand allows you to determine whether your memory resources are allocated as soon as they are requested, or only as they are needed. Setting dynamic allocation on demand to 1 allocates memory changes as needed, and setting it to 0 allocates the configured memory when you make changes to the memory configuration.

For example, if you set dynamic allocation on demand to 1, and change number of user connections to 1024, the total logical memory is 1024 multiplied by the amount of memory per user. If the amount of memory per user is 112K, the memory for user connections is 112MB (1024 x 112).

This is the maximum amount of memory that the number of user connections configuration parameter is allowed to use. However, if only 500 users are connected to the server, the amount of total physical memory used by the number of user connections parameter is 56MB (500 x 112).

If dynamic allocation on demand is 0, when you change number of user connections to 1024, all user connection resources are configured immediately.

Optimally, organize SAP ASE memory so that the amount of total physical memory is smaller than the amount of total logical memory, which is smaller than the max memory. This can be achieved, in part, by setting dynamic allocation on demand to 1, and setting allocate max shared memory to 0.

Related concepts
Configuring Memory