编程知识 cdmana.com

Jitter Android performance optimization series: Java memory optimization tiktok

{"type":"doc","content":[{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Memory is one of the most important resources for computer programs , Need to achieve reasonable resource allocation and recycling in the process of operation , Unreasonable memory consumption makes the user's application run stuck 、ANR、 Black screen , Again, it causes user applications to occur OOM(out of memory) collapse . Tiktok is a widely used product , Need to maintain excellent fluency and stability on a variety of machine resources , Memory optimization is a link that must be paid attention to ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" This paper starts from the tiktok. Java OOM Starting from the governance practice of memory optimization , Try to share with you about the tiktok team. Java Some thoughts on memory optimization , Including tool construction 、 Optimization methodology ."}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" Tiktok Java OOM background "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Before we specifically manage the jitter memory, we comb tiktok and relative collapse of the whole memory index. , It is found that the proportion is very high . in addition , Memory related indicators surged again to a record high during the Spring Festival last year , So overall, the memory problem is quite serious , Must carry on the special treatment to it . Tremble is tiktok. 、 Tool construction and a two month dedicated memory governance will be overall Java OOM Optimized by 100% 80."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":"Java OOM Top Stack attribution "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Tiktok Java Before optimizing the memory management, we first report the stack exceptions reported by the platform to the current OOM Make attribution , It is mainly divided into the following categories :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.infoq.cn\/resource\/image\/5a\/01\/5a79793e1ed1cfe35d8be12a29d1ac01.png","alt":null,"title":"","style":[{"key":"width","value":"75%"},{"key":"bordertype","value":"none"}],"href":"","fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":" chart 1. OOM classification "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" among "},{"type":"codeinline","content":[{"type":"text","text":"pthread_create"}]},{"type":"text","text":" Problems account for about one percent of the total 50,Java Heap memory overrun is percent 40 many , The rest is a small amount fd Quantity overrun . among "},{"type":"codeinline","content":[{"type":"text","text":"pthread_create"}]},{"type":"text","text":" and fd The quantity is insufficient native Memory constraints Java Layer collapse , We also made targeted optimization for this part of the memory problem , It mainly includes :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"bulletedlist","content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Thread convergence 、 monitor "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Automatic repair of thread stack leak "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"FD Leakage monitoring "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Virtual memory monitoring 、 Optimize "}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" Tiktok 64 Bit special "}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" After governance "},{"type":"codeinline","content":[{"type":"text","text":"pthread_create"}]},{"type":"text","text":" The problem is reduced to 0.02‰ following , In this regard, governance practice will be tiktok in the next. Native Memory management practice in detail , Please look forward . This article focuses on Java Heap memory management ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":2},"content":[{"type":"text","text":" Heap memory management ideas "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" from Java Classification of heap memory overruns , There are mainly two kinds of problems :"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"heading","attrs":{"align":null,"level":3},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"1. Heap memory single allocation too large \/ Multiple allocation accumulation is too large ."}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224085724522B.html

Scroll to Top