In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly analyzes the relevant knowledge of what is the difference between Cache and Buffer, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "what's the difference between Cache and Buffer".
Cache and Buffer are two different concepts. To put it simply, Cache is to accelerate "read", while buffer is to buffer "write". The former solves the problem of reading and saves the data read from the disk, while the latter solves the problem of writing and saves the data to be written to disk. In many cases, there is no strict distinction between these two nouns, and the mixed type of reading and writing is often called buffer cache, which is uniformly called cache in the following discussion of this article.
Log buffer in Oracle solves the problem of redo writing, while data buffer cache solves the problem of reading and writing data block. For Oracle, if IO is not hit by SGA, physical IO,Oracle does not care about the type of underlying storage. It may be a storage system, local disk, RAID 10, RAID 5, file system, bare device, or ASM. In short, Oracle calls the underlying storage system a storage subsystem.
In storage systems, cache is almost ubiquitous (in later discussion, we collectively call it cache), file systems have cache, storage cache,RAID controller has cache, and disk has cache. In order to improve performance, a write operation of Oracle is likely to be written on the storage cache and it will be returned. If there is a problem with the storage system, how can Oracle ensure data consistency.
The most important feature of Oracle database is Write ahead logging. Before data block is written, redo log must be written first. When commit is transacted, redo log must be written at the same time. In order to ensure data consistency, Oracle uses direct IO,Direct IO for redo log, which skips the cache layer of the file system on OS. However, OS cannot manage the storage layer, and although it skips the cache of the file system, it is still possible to write on the stored cache.
General storage has cache. In order to improve performance, the write operation is returned to OS when the write operation is completed on cache. We call this write operation write back. In order to ensure that the contents of the cache will not be lost when the power is off, the storage is protected by batteries. These batteries can be stored for a certain period of time after power off to ensure that the data in the cache is brushed to disk and will not be lost. Unlike the UPS, the battery can last for a short time, usually less than 30 minutes, as long as the data in the cache is written. Storage can disable write cache, and all write operations must be written to disk before returning. We call this kind of write operation write throuogh. When storage finds that some parts are abnormal, storage automatically shuts down write cache, which degrades write performance.
Raid card also has cache, usually 256m, which is also protected by battery. unlike storage, this battery does not guarantee that data can be written to disk, but provides power to cache to protect data from loss, which usually lasts for several days. There are also some raid cards with flash cache, after power off, you can write the contents of cache to flash cache to ensure that the data is not lost. If your database is not stored, but on the local hard disk of an ordinary PC, be sure to make sure that the raid card in the host has a battery. Many hardware providers do not configure batteries by default. Of course, the cache on the raid card can also be turned off.
Cache on disk, usually 16M-64M, many storage manufacturers have made it clear that cache on disk in storage is disabled, which is understandable. In order to ensure data reliability, while the storage itself provides a very large cache, comparatively speaking, cache on disk is no longer so important. The SCSI instruction has a parameter of FUA (Force Unit Access). When you set this parameter, the write operation must be completed on the disk before it can be returned, which is equivalent to disabling the write cache of the disk. Although the data has not been verified, I personally think that once the disk is connected to the RAID controller, writing cache will be disabled, which is also for the sake of data reliability. I believe storage manufacturers should consider this issue.
At this point, we can see that a physical IO of Oracle is written to disk after a series of cache. Although cache can improve performance, it should also consider the problem of power-off protection. The consistency of data is guaranteed by Oracle database, operating system and storage subsystem.
About "what is the difference between Cache and Buffer" here, more related content can be searched for previous articles, hope to help you answer questions, please support the website!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.