The virtual portion of shared memory for the database server includes the following components:
The SHMVIRTSIZE configuration parameter in the database server configuration file provides the initial size of the virtual portion. As the need for additional space in the virtual portion arises, the database server adds shared memory in increments that the SHMADD configuration parameter specifies, up to a limit on the total shared memory allocated to the database server, which the SHMTOTAL parameter specifies.
The size of the virtual portion depends primarily on the types of applications and queries that you are running. Depending on your application, an initial estimate for the virtual portion might be as low as 100 kilobytes per user or as high as 500 kilobytes per user, plus an additional 4 megabytes if you intend to use data distributions. For guidelines on creating data distributions, see the discussion of UPDATE STATISTICS in Creating Data Distributions.
The basic algorithm for estimating an initial size of the virtual portion of shared memory is as follows:
shmvirtsize = fixed overhead + shared structures + (mncs * private structures) + other buffers
fixed overhead = global pool + thread pool after booting
Use the onstat -g mem command to obtain the pool sizes allocated to sessions. Subtract the value in the freesize field from the value in the totalsize to obtain the number of bytes allocated per session.
The thread pool after booting variable is partially dependent on the number of virtual processors.
shared structures = AIO vectors + sort memory + dbspace backup buffers + data-dictionary cache size + size of user-defined routine cache + histogram pool + STMT_CACHE_SIZE (SQL statement cache) + other pools (See onstat display.)
Table 4 lists the location of more information on estimating the size of these shared structures in memory.
Shared-Memory Structure | More Information |
---|---|
Sort memory | Estimating Memory Needed for Sorting |
Data-dictionary cache | Data-Dictionary Configuration |
Data-distribution cache (histogram pool) | Data-Distribution Configuration |
User-defined routine (UDR) cache | UDR Cache |
SQL statement cache | Enabling the SQL Statement Cache
SQL Statement Cache |
Other pools | To see how much memory is allocated to the different pools, use the onstat -g mem command. |
mncs = number of poll threads * number connections per poll thread
The value for number of poll threads is the value that you specify in the second field of the NETTYPE configuration parameter.
The value for number of connections per poll thread is the value that you specify in the third field of the NETTYPE configuration parameter.
You can also obtain an estimate of the maximum number of concurrent sessions when you execute the onstat -u command during peak processing. The last line of the onstat -u output contains the maximum number of concurrent user threads.
private structures = stack + heap + session control-block structures
For more information on the onstat -g stm option, see Session Memory.
mncs * private structures