How Tencent Boosted Java Heap Scanning 2‑8× with Parallel GC Optimizations
In 2020 Tencent's KonaJDK team enhanced Java memory analysis by parallelizing jmap heap scans across multiple garbage collectors, achieving 2‑8× speedups, adding gzipped heap dump support, and contributing dozens of patches and commits to the OpenJDK community.
Background and Motivation
In 2020, with the release of JDK 15, Tencent became the first Chinese vendor to be recognized as a Notable contributor to OpenJDK and ranked fifth globally. The KonaJDK team, a newcomer to the OpenJDK community, aimed to provide a stable Java runtime for internal and cloud customers.
Parallel Heap Scanning
The jmap -histo tool is widely used for heap analysis, but a single run can pause Java application threads for several seconds, especially on large heaps (e.g., a 6 GB heap took about 4 seconds on the author’s machine). This pause can cause service disruption in big‑data workloads.
To address this, the team investigated the internals of jmap -histo and implemented a parallel scanning mechanism. Although the changes target jmap, most of the work resides in the garbage collector (GC) layer, requiring different parallel strategies for each GC algorithm:
ParallelScavenge: parallel scan per generation space.
G1: parallel scan per region.
ZGC and ShenandoahGC: parallel marking mechanisms.
Benchmarks on the same hardware (‑Xmx8g, 6 GB object heap) showed a 2‑8× improvement in scan speed for G1GC, as illustrated in the accompanying chart.
Gzipped Heap Dump Support
Operational feedback revealed that traditional heap dumps generated by jmap -dump are huge, making transfer over limited bandwidth impractical. While the OpenJDK community added gzipped dump support to jcmd, tools like jmap and jhsdb lacked this feature.
The KonaJDK team contributed patches to add compressed heap dump capability to jmap (merged) and jhsdb (under review). In tests, using jmap -dump:gz=1 <pid> reduced the dump file size by roughly sevenfold compared to the uncompressed version.
These enhancements are slated for inclusion in KonaJDK 8, so users of Tencent Cloud and KonaJDK will soon benefit from faster heap scans and smaller dump files.
2020 Contribution Summary
During 2020, the KonaJDK team contributed over 70 commits (≈2,000 lines of code) to OpenJDK, focusing on HotSpot (JIT, runtime, GC), SVC, core libraries, and infrastructure. Notable contributions include nine HotSpot patches, six patches adding AVX‑512 support to the Vector API, and four patches accelerating large‑heap inspection.
These efforts marked Tencent’s first official OpenJDK contribution as a domestic vendor and positioned the company as a leading global contributor.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Tencent Cloud Middleware
Official account of Tencent Cloud Middleware. Focuses on microservices, messaging middleware and other cloud‑native technology trends, publishing product updates, case studies, and technical insights. Regularly hosts tech salons to share effective solutions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
