In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly analyzes the relevant knowledge points about the improvement of memory release in Go, 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 take a look, and follow the editor to learn more about the improvement of memory release in Go.
For a long time, go's runtime used MADV_DONTNEED on Linux when freeing memory to return to the kernel, which, although inefficient, caused the number of RSS (resident set size resident memory sets) to decline rapidly. However, this is specifically optimized in go 1.12, where runtime uses a more efficient MADV_FREE instead of the previous MADV_DONTNEED when freeing memory.
The advantage of this is that the memory allocation latency after a GC is improved, and runtime will be more active in returning the freed memory to the operating system to deal with the problem that large chunks of memory allocation cannot reuse existing heap space. However, there is also a side effect: RSS will not drop immediately, but will not be delayed until the system has memory pressure. It is important to note that MADV_FREE requires a kernel of 4.5 or above, otherwise runtime will continue to use the original MADV_DONTNEED approach.
For example, I recently encountered this problem:
There is not much difference in the number of requests for several services. It is obvious that the memory release of 25 (kernel 4.14, and the others are all 3.10 kernels) looks slow, but the HEAP occupancy display is normal:
By the way, the most eye-catching feature of the kernel is eBPF, which can complete packet filtering, call stack tracking, time-consuming statistics, hot spot analysis and other advanced functions through a bytecode virtual machine built into the kernel. It is a sharp tool for performance analysis of Linux systems.
Of course, go 1.12 also provides a GODEBUG=madvdontneed=1 parameter to force runtime to continue to use MADV_DONTNEED:runtime: provide way to disable MADV_FREE in order to avoid problems with automated tests like this that rely on judging the size of the MADV_DONTNEED:runtime. But obviously under normal circumstances, we should all give priority to using MADV_FREE.
What go is suitable for go is the abbreviation of golang, while golang can do server-side development, and golang is very suitable for log processing, data packaging, virtual machine processing, database agent and other work. In the aspect of network programming, it is also widely used in web applications, API applications and other fields.
About "how the improvement of memory release in Go" is introduced 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.