In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What is the difference between Cache and Buffer in mysql? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
The differences between mysql Cache and Buffer are:
The core function of Buffer is to cushion and mitigate shocks. For example, you have to write 100 hard drives per second, which has a great impact on the system, wasting a lot of time dealing with starting and ending writing. Save it temporarily with a buffer and write to the hard disk every 10 seconds, the impact on the system is very small, the writing efficiency is high, and life is good. Greatly mitigated the impact.
The core role of Cache is to speed up access. For example, when you have finished a very complicated calculation, next time you want to use the result, put the result in a place where it is easy to get, and you don't have to do it next time. Speed up the speed of data access.
So, if you pay attention to the storage system, you will find that the read-write buffer / cache name of the hard disk is different, called write-buffer and read-cache. It is obvious that there is a difference between the two.
Of course, most of the time, macroscopically speaking, the two may be mixed. For example, in fact, many people use memcached for both reading and writing. Many times the same is true of Non-SQL databases. Strictly speaking, L2 and L3 Cache in CPU are both read and write-because you can't simply define whether CPU uses them to read or write. Hard disk is also a typical example, buffer and cache are in the same space, is it buffer or cache?
But think about it carefully, do you think cache can be used as buffer? Of course, as long as you can control the cache phase-out logic, there will be no problem.
What about using buffer as cache? It seems that under very special circumstances, it is also possible to determine the order of visits. Just think about it-does buffer need to be stored randomly by definition? You don't usually need it. But cache must. So most of the time cache can be used instead of buffer, otherwise it is more limited. This is also the key difference between cache and buffer technically.
Supplement 1:
Don't misunderstand that Buffer is used to write and Cache is used to read. Can I use Buffer to read? Of course, for example, when you want to process reads in batches rather than whatever you have to do, you can read buffer. Of course, you can also use cache to write, such as when your writing is highly random. What scene to use Buffer and what scene to use Cache should be decided according to the specific needs of the scene.
Supplement 2:
Don't misunderstand that Cache or Buffer must be memory or something on high-speed media. As long as it is relatively high speed. I can completely store Cache on the hard disk, for example, some games will create a precompiled shader (age of exposure) at run time, which is essentially a kind of cache, which exists on a slow hard drive because it is still faster to read the hard drive than to recompile. The same goes for Buffer. For example, the NTFS file system has its own Logging Buffer, which even explicitly refuses to be placed in any volatile cache.
The answer to the question about what is the difference between Cache and Buffer in mysql is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.