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 > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to understand Transparent Hugepages? in view of this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
People who have used many kinds of databases will encounter a problem. Transparent Hugepages is mentioned as disabled, turn off. Why should we turn off the transparent hugepage?
Transparent giant page is a special Chinese definition term for transparenet. For LINUX kernel, page is equivalent to an in-memory unit (in fact, for most databases, too). By default, it is 2048KB, but of course some are not.
Transparent Huge pages allows you to reserve relevant resources for frequently accessed data. Opening it does improve system performance and keep data stuck in linux memory.
There is a recommendation in LINUX (not a database server) to set the memory within 3 to 8 to transparenet huge page. Because some LINIUX applications can not use transparenet huge page. The compression function of THP is included in the Linux kernel. The compression operation is resource-intensive and has an impact on the overall system performance.
So the question goes back to a basement level, why there is HP THP, things like this, most applications and OS run in virtual memory, virtual memory, virtual memory is the mapping of physical memory, equivalent to address translation, CPU is accessed through cpu's memory management unit referred to as mmu, and natural MMU also has its own cache to cache frequently visited pages. This cache is called Translation lookside buffer (TLB), but actually the amount of memory accessed by CPU is increasing.
After that, it will lead to a decrease in the visit rate, or hit rate, and there are two ways to solve it.
1 increase the size of the TLB (it's not easy, it's a hardware problem)
2 expand the unit of each addressing, that is, the previous page 4KB, then we will change a page into 1MB, so the efficiency of access will not be improved. So there are things like HP THP.
Then such a problem gives rise to new problems. Try to access more memory at a time, but there are also fragments of memory, and it is not necessarily a complete continuous space. If you can not meet the requirements of HP THP, the system will swap out the pages. After such a period of compression, there will be a noun called latency spikes, which will seriously affect the time and performance of access.
The main reason why some databases want to disable THP is that most of these databases access memory in a decentralized way, rather than accessing consecutive pages, and this access mode will cause fragmentation of memory. The page visited is neither massive nor continuous. And when you apply for 4KB memory when THP is not enabled, LINUX will allocate the corresponding memory to the application, but if THP is enabled at the system level, then similar to database memory application, even if the requested value is 4KB, the allocation will be greater than 4KB such as 2MB to allocate, so that the database application for memory will also have problems, and related losses.
It is worth noting that most databases will recommend that you close THP, including MYSQL POSTGRESQL ORACLE and other databases are also recommended to shut down THP.
But one of the settings in PostgreSQL comes from PG9.4, Huge Page and has three parameters ON OFF TRY, the default is try, there are enough large pages in the kernel, PostgreSQL will try to use large pages, if not, do not use it. Force the use of large pages, and PostgreSQL will not be able to start if the kernel is not large enough. HugePages can improve system performance by significantly reducing the number of page table entries in memory page tables, and explicit instructions are required for applications to use HugePages. Changing the application in this way is sometimes possible, sometimes not, and requires redesign at the system management level. Therefore, the transparent giant page (THP) technology is introduced. If enabled, it may allocate large pages to the application without actually "knowing" it; therefore, transparency.
Guess this is one of the reasons why PG supports HP and recommends shutting down THP.
The answer to the question about how to understand Transparent Hugepages is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.