Please enable JavaScript.

Principles of Database Buffer Management (Interface and Operations of a DB…

Principles of Database Buffer Management

Interface and Operations of a DB Buffer Manager

The buffer manager is considered a component within the DBMS with well-defined interfaces to other components

Logical References

Note every logical reference leads to a physical reference, but every physical reference is preceded by a logical reference.

Description: Each request for a page. A logical reference can be issued by a single transaction. In that case it is independent of buffer size. Global logical references, characterizing the concurrent execution of multiple transactions are indirectly influenced by the size of the buffer.

For each logical reference the buffer manager performs the following...

Search the buffer and locate the page

The requested page is fixed in the buffer by marking its buffer control block

The fact that the page has been referenced is recorded (since reference history important for replacement algorithms)

If page not in buffer, use a buffer allocation strategy to determine the set of candidate pages. A page replacement algorithm decides which of the buffer pages to replace. If page marked for replacement has been modified, it needs ot be written to disk.

The address of the buffer frame containing the requested page is passed to the calling DBMS componenet as a return parameter

Logical Page Reference String

Description: The sequence of logical references to database pages recorded as a sequence of page numbers. It describes the reference behavior of the DBMS, independent of the buffer size and replacement algorithm of the buffer manager.

Logical reference behavior determined by...

The types of transactions constituting the DBMS load(retrieval/update, direct/sequential access)

The transaction mix (number and type of parallel transactions)

The access path structures provided by the DBMS and its undeerlying data model, in the form selected in the internal database schema.

Physical References

Description: Accesses to DB pages on disk. Those accesses are some of the most expensive operations within a DBMS

In contrast to logical references, physical references are strongly influenced by the size of the database buffer and the page replacement algorithm of the buffer manager.

Since physical references are expensive, the optimization of the page replacement algorithm is very important for the overall performance of the DBMS.

Searching the Buffer

A search is done whenever a logical reference to a DB page occurs

Search Methods

Direct Search

Checks the page headers of all pages in the buffer sequentially. In a buffer of size N, on average N/2 pages will be searched in case of success and N in case of a fault.

Not good when running under a virtual memory operating system. In that case a table search technique will reduce page fault rate.

Translation Table

Uses the page number as a displacement within the table. Hence the table must provide D entries for a database containing D pages. Restricted only to very small databases.

Unsorted Table

Requires N/2 accesses on the average for a page found in the buffer.

Chained Table

Update is less costly than on a compact table, since no entries have to be moved

The chaining sequence can be used to represent additional information, like replacement information for an LRU algorithm

Sorted Table

Sorted Table

Requires N/2 accesses on the average for a page found in the buffer.

Number of accesses for an unsuccessful sequential search is reduced from N to N/2.

Involves a much higher overhead when a table entry is inserted or deleted

Possibility to reduce search to log2N accesses via balanced binary tree or by maintaining an inde to the sorted table

Hash Table

The hash algorithm transforms a page number into a displacement within the page table, where the entry describing the page and its current position in the buffer can be found.

With an appropriately sized hash table, the number n of entries searched per logical reference can be 1 < n < 1.2

Replacement Algorithms for the Database Buffer

If a logical reference to the buffer fails, a page in the buffer must be selected for replacement to make room for the requested page.

The algorithms described here can be combined with buffer allocation algorithms

Replacement needed in connection with...

global allocation - within the entire buffer

static allocation - within the respective partition

dynamic allocation - in the set of eligible pages i.e. pages currently not contained in the working set of any transaction/page type

Fetching Pages

Replacement algorithms can be classified into...

Prepaging Algorithms

Fetch not only the requested page, but also m additional pages that are physically close to the requested page, thus saving access time.

Fetch only the requested page when there is a page fault. High importance for practical applications.

Systematic Description of Replacement Algorithms

Classification Methods

Exclusive use of only one of those criteria can not guarantee an optimal replacement decision when there is locality of reference

age since the first reference to the page or since the last reference to the page

all references or only the most recent reference to the page

Description

Description

Applicable algorithms replace the buffer page having the lowest probability of reference. They rely on the characteristics of the past reference string to predict future reference bahavior.

The age and the references of a buffer page can be applied as suitable criteria to predict future reference behavior. Age is measured by using logical references as units of time.

Algorithms Overview

Algorithms Overview

FIFO

The age of a page since the first reference is the only decision criterion for page replacement. Hence the algorithm is only appropriate for sequential access behavior.

LRU

The replacement decision is made based on which page is referenced and by the age of each buffer page since its most recent reference.

FIX Mechanism

2 more items...

CLOCK(also called Second Change)

Attempts to simulate LRU behavior by means of a simpler implementation. It is a modification of the FIFO mechanism.

Use Bit

1 more item...

Workflow

2 more items...

LFU(least frequently used)

LFU(least frequently used)

2 more items...

GCLOCK

GCLOCK

5 more items...

LRD(least reference density)

LRD(V1)

1 more item...

LRD(V2)

1 more item...

Buffer Allocation for Concurrent Transactions

The buffer allocation algorithm of the buffer management component distributes the available buffer frames among the concurrent database transactions. It is closely related to the page replacement algorithm.

Locality of the Reference Behavior

Locality of the Reference Behavior

The most important properpty of a reference string in terms of storage allocation and page replacement algorithms.