You use table buffering to improve performance when accessing the data records contained in the table. The table buffers reside locally on each application server in the system. The data of buffered tables can be accessed directly from the buffer of the application server. This avoids the time-consuming process of accessing the database. In the following figure you can see how a table buffer communicates with the database.
Buffering is particularly important in client/server environments, as it takes considerably longer to access a table with the network than it does to access a table that is buffered locally. Depending on the network load, this factor can lie between 10 and 100.
The difference in performance is somewhat less marked in central systems (systems with only one application server) than in local ones (systems with several application servers). However, even in central systems, a reduction in process changes and increased sophistication of the buffering over that provided by the database system have a noticeable effect on performance.
Filling the Buffers
If a program accesses the data of a buffered table, the database interface determines whether this data is in the buffer of the application server. If this is the case, the data is read directly from the buffer. If the data is not in the buffer of the application server, the system reads it from the database and loads it into the buffer. The next access to this data can then use the buffer.
The buffering type determines which records are loaded into the buffer during an access. This is explained in the following figure.
Synchronization of the Local Buffers
In most cases, a buffered table is read on all application servers and held in the buffer there. If a program changes the data contained in the table on an application server, the database interface notes this in the log table. The buffers still have the old status on all the other application servers, so that the programs might read obsolete data.
A synchronization mechanism runs at a fixed time interval, for example every 1-2 minutes. The system reads the log table and invalidates the buffer contents that were changed by other servers. In the next access, the system reads the data of invalidated tables directly from the database and updates it in the buffer. For more information, see Local Buffer Synchronization .
If more space is required in the buffer due to new data, the system displaces the data that has not been accessed for the longest time. The system displaces the data asynchronously at certain times that are defined dynamically by the buffer accesses.
The system displaces the data only if at this time the free space in the buffer is less than a given value, or if the access quality is not good enough.
Resetting the Table Buffers
You can reset the table buffers on the corresponding application servers by entering $TAB in the command field. The system invalidates all the data in the buffer.
Use this command only if inconsistencies occur in the buffer. It can take several hours to fill the buffers in large systems. Performance is considerably reduced during this time.