Home | Previous Page | Next Page   Disk, Memory, and Process Management > Shared Memory > Virtual Portion of Shared Memory >

Management of the Virtual Portion of Shared Memory

The database server uses memory pools to track memory allocations that are similar in type and size. Keeping related memory allocations in a pool helps to reduce memory fragmentation. It also enables the database server to free a large allocation of memory at one time, as opposed to freeing each piece that makes up the pool.

All sessions have one or more memory pools. When the database server needs memory, it looks first in the specified pool. If insufficient memory is available in a pool to satisfy a request, the database server adds memory from the system pool. If the database server cannot find enough memory in the system pool, it dynamically allocates more segments to the virtual portion.

The database server allocates virtual shared memory for each of its subsystems (session pools, stacks, heaps, control blocks, system catalog, SPL routine caches, SQL statement cache, sort pools, and message buffers) from pools that track free space through a linked list. When the database server allocates a portion of memory, it first searches the pool free-list for a fragment of sufficient size. If it finds none, it brings new blocks into the pool from the virtual portion. When memory is freed, it goes back to the pool as a free fragment and remains there until the pool is destroyed. When the database server starts a session for a client application, for example, it allocates memory for the session pool. When the session terminates, the database server returns the allocated memory as free fragments.

Size of the Virtual Portion of Shared Memory

To specify the initial size of the virtual shared-memory portion, set the SHMVIRTSIZE parameter in the ONCONFIG file. To specify the size of segments that are added later to the virtual shared memory, set the SHMADD or EXTSHMADD configuration parameter.

To specify the amount of memory available for PDQ queries, set the DS_TOTAL_MEMORY parameter.

If you want to increase the amount of memory that is available for a query that is not a PDQ query and the PDQ priority is set to 0 (zero), you can change the amount using any of the following options:

For example, if you use the onmode utility, specify a value as shown in the following example:

onmode -wf DS_NONPDQ_QUERY_MEM=500

The minimum value for DS_NONPDQ_QUERY_MEM is 128 kilobytes. The maximum supported value is 25 percent of the value of DS_TOTAL_MEMORY.

For more information on the SHMVIRTSIZE, SHMADD, EXTSHMADD, DS_TOTAL_MEMORY, DS_TOTAL_SIZE, and DS_NONPDQ_QUERY_MEM configuration parameters, see the IBM Informix Dynamic Server Performance Guide and the IBM Informix Dynamic Server Administrator's Reference. Also see Adding a Segment to the Virtual Portion of Shared Memory.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]