Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the difference between buffer cache and buffer in Ask Hoegh

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about the difference between buffer cache and buffer in Ask Hoegh. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Q:

The SGA of the Oracle database contains components such as db block buffer cache and redo buffer, so it also belongs to memory, is there any difference between buffer cache and buffer?

A: first, let's compare the concepts and functions of db block buffer cache and redo buffer.

Buffer cache, whose Chinese name is buffer cache. According to oracle officials, a buffer cache is an area of memory that contains many blocks of data, which are mainly copies of the contents of blocks in a data file.

Because the buffer cache sits between the physical file system and the block device driver, when the physical file system needs to read data from the block device, it first attempts to read it from the buffer cache. If hit, the kernel no longer has to access slow block devices. Otherwise, if the hit fails, that is, the data is not in the buffer cache, the kernel reads the corresponding data block from the block device and caches it in the buffer cache for the next access.

Similarly, when the physical file system needs to write data to the block device, it also writes the data to the appropriate buffer and marks the buffer as dirty, and then at some point in the future, the data in the buffer cache is actually written back to the block device, or the buffer is discarded directly. As a result, the frequency of disk write operations is reduced.

Redo buffer, also known as Redo Log Buffer, is a cache in SGA that stores database modification information. This information is stored in the redo entry (Redo Entry), which contains the necessary information to reorganize or redo the database due to modifications made by INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP. If necessary, redo entries can be used for database recovery. The redo entry is copied by the Oracle database process from the user's memory to Redo Log Buffer. Redo entries are connected continuously in memory. The background process LGWR is responsible for writing the information in Redo Log Buffer to the active redo log file (Redo Log File) or filegroup on disk. The parameter LOG_BUFFER determines the size of the Redo Log Buffer.

Next, let's compare the concepts of buffer and cache.

Cache (cache) is to save the read data, if the re-read hit (to find the needed data), do not read the hard disk, if not hit the hard disk. The data is organized according to the reading frequency, the most frequently read content is placed in the most easily found position, and the content that is no longer read is arranged back and forth until it is deleted.

Buffers is designed according to the read and write of the disk, which centralizes the decentralized write operations to reduce disk fragmentation and repeated search of the hard disk, so as to improve system performance. Linux has a daemon that periodically empties the buffers (that is, writes to disk), or you can manually empty the buffers with the sync command.

Both are data in RAM. To put it simply, buffer is about to be written to disk, while cache is read from disk.

From the comparison of the above two sets of concepts, it is not difficult to understand the difference between buffer cache and buffer.

The above is the difference between buffer cache and buffer in Ask Hoegh shared by Xiaobian. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report