BUFFERS Option

Sets and subsets contain key entries that are organized in tables. When a particular key entry is required, the table that contains it is read in a buffer in the DBS. These buffers are shared by all users of the structure. A table, after being used, is kept in memory until its memory space is needed for another table. If a subsequent request for an entry in that table occurs, no physical I/O is required. Similarly, updated entries are not immediately written out; rather, the table is marked to indicate that it contains a changed entry. This allows many entries to be changed before any physical I/O is done. In general, increasing the number of buffers decreases the number of physical I/O operations performed.

The BUFFERS option controls the number of buffers the system allocates for each set or subset plus the number of additional buffers the system allocates and deallocates for each program that invokes the structure. The default values for buffer assignments are as follows:

  • One system buffer

  • One random buffer

  • Zero serial buffers

The BUFFERS option is a dynamic database parameter that can be changed through the Visible DBS facility. The maximum number of system buffers allowed is 1048575 plus an additional 254 for each random and serial user. To avoid using excessive memory, take care when setting buffers for sectioned structures. The number of buffers available for the structure is the number of buffers specified, multiplied by the number of sections in the structure.

When the aggregate of all buffers for all users exceeds the ALLOWEDCORE value, overlaying of buffers starts.

Structure BUFFER specifications are ignored when the OVERLAYGOAL parameter is not the number 0, except when any of the following conditions occur:

  • A structure is being accessed randomly and there are not buffer specifications, in which case a maximum of 512 buffers are used.

  • A structure is being accessed randomly and there are buffer specifications, in which case:

  • If the calculated value of SYSTEM BUFFERS + RANDOM BUFFERS PER USER is less than 512, a maximum of 512 buffers are used.

  • If the calculated value of SYSTEM BUFFERS + RANDOM BUFFERS PER USER is greater than 512, the calculated value is used for the maximum number of buffers.

  • An EXTENDED structure is being accessed serially and readahead is activated, in which case the serial buffer specification is used.

  • A non-EXTENDED structure is being accessed serially and readahead is activated, in which case 2 serial buffers are used.

ALLOWEDCORE is the ultimate limiting factor for any or all structures. Regardless of the 512 value or calculated value for SYSTEM BUFFERS + RANDOM BUFFERS PER USER for any individual structure, when ALLOWEDCORE is reached, OVERLAYs will begin and a new buffer allocation will be restricted.

Serial optimization (readahead) can be activated by specifying serial buffers greater than or equal to 2, and can be deactivated by setting serial buffers to less than 2. Readahead enables the Accessroutines to read blocks before they are needed. This action reduces the time required to access set or subset entries serially by decreasing the buffer wait time. When records are accessed serially through a set or a subset, the next set or subset table is retrieved, which causes a decrease in total elapsed time.

The Accessroutines detects whether a program is accessing a structure randomly or serially. When a structure is being accessed serially and two or more serial buffers are specified, the Accessroutines allocates the appropriate number or serial buffers for the program; otherwise, the specified number of random buffers is allocated.

If a program oscillates between serial and random access, the Accessroutines detects this and make it increasingly more difficult for the program to change modes. This prevents spurious readaheads and avoids buffer allocation and deallocation.