2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
References:
①Use mtrace to track JVM off-heap memory leaks
②A case study on high Java memory usage
Get the memory leak location (see reference ① for detailed commands)
Use jna to enable mtrace in Java code to track memory allocation
Use the mtrace command to analyze the log file and obtain the memory leak call point
arthas checks the call stack of the memory leak call point (you can use the call point address directly without the function name)
Get the memory leak content (see reference ② for detailed commands)
When stress testing a service offline, when the QPS is high, the memory occupied by the nio.directbuffer area of the machine will increase suddenly, causing OOM in the container.
Using the above troubleshooting ideas, we finally located that our RPC framework generated a large amount of data in the directbuffer area. In fact, when the QPS is high, the number of selector threads is small and the consumption capacity is insufficient, resulting in a backlog of request and response data in the directbuffer area.