Skip to main content
QUICK REVIEW

[论文解读] DJXPerf: Identifying Memory Inefficiencies via Object-centric Profiling for Java

Bolun Li, Pengfei Su|arXiv (Cornell University)|Apr 7, 2021
Parallel Computing and Optimization Techniques参考文献 57被引用 5
一句话总结

DJXPerf 是一种轻量级、面向对象的 Java 内存分析器,利用硬件性能监控计数器(PMU)将缓存未命中和 TLB 未命中归因于特定的 Java 对象,使开发人员能够识别内存低效问题,如数据局部性差和内存膨胀。其运行时开销仅约 8%,内存开销仅约 5%,无需修改代码或 JVM,且能指导优化,显著提升真实世界 Java 和 Scala 应用的性能。

ABSTRACT

Java is the "go-to" programming language choice for developing scalable enterprise cloud applications. In such systems, even a few percent CPU time savings can offer a significant competitive advantage and cost saving. Although performance tools abound in Java, those that focus on the data locality in the memory hierarchy are rare. In this paper, we present DJXPerf, a lightweight, object-centric memory profiler for Java, which associates memory-hierarchy performance metrics (e.g., cache/TLB misses) with Java objects. DJXPerf uses statistical sampling of hardware performance monitoring counters to attribute metrics to not only source code locations but also Java objects. DJXPerf presents Java object allocation contexts combined with their usage contexts and presents them ordered by the poor locality behaviors. DJXPerf's performance measurement, object attribution, and presentation techniques guide optimizing object allocation, layout, and access patterns. DJXPerf incurs only ~8% runtime overhead and ~5% memory overhead on average, requiring no modifications to hardware, OS, Java virtual machine, or application source code, which makes it attractive to use in production. Guided by DJXPerf, we study and optimize a number of Java and Scala programs, including well-known benchmarks and real-world applications, and demonstrate significant speedups.

研究动机与目标

  • 解决在 Java 等托管语言中缺乏从对象级别分析数据局部性和内存效率的工具的问题。
  • 识别由空间和时间局部性差以及内存膨胀导致的企业级 Java 应用性能瓶颈。
  • 提供一种可投入生产的、低开销的分析解决方案,将硬件性能指标归因于特定 Java 对象,且无需修改 JVM、操作系统或应用代码。
  • 指导开发人员基于实际内存层次结构行为,优化对象分配、布局和访问模式。
  • 通过面向对象的洞察,展示在真实世界和基准测试的 Java/Scala 应用中实现可测量性能提升。

提出的方法

  • 利用硬件性能监控单元(PMU)在应用执行期间收集低层级的缓存未命中和 TLB 未命中统计数据。
  • 使用轻量级 Java 字节码增强技术,将 PMU 事件与特定 Java 对象及其分配上下文关联。
  • 应用统计采样技术,将性能指标归因于源代码位置和单个对象,实现面向对象的分析。
  • 将对象分配位置与使用模式和访问频率相关联,识别出因局部性差或内存膨胀而受影响的对象。
  • 按性能影响排序展示分析结果,突出显示对内存延迟贡献最大的对象和代码区域。
  • 采用非侵入式、适合生产环境的设计,无需修改 JVM、操作系统或应用源代码。
Figure 1. Code-centric vs. object-centric profiling. $O$ denotes an object and $I$ denotes a memory access instruction; tuple $\langle O_{m},I_{n}\rangle$ denotes that instruction $I_{n}$ accesses object $O_{m}$ .
Figure 1. Code-centric vs. object-centric profiling. $O$ denotes an object and $I$ denotes a memory access instruction; tuple $\langle O_{m},I_{n}\rangle$ denotes that instruction $I_{n}$ accesses object $O_{m}$ .

实验结果

研究问题

  • RQ1能否有效利用硬件性能监控计数器将内存层次结构指标(如缓存未命中)归因于单个 Java 对象?
  • RQ2面向对象的分析如何改善在托管语言中识别内存膨胀和局部性差等内存低效问题?
  • RQ3一种将 PMU 事件归因于对象但不修改 JVM 或应用代码的分析系统,其运行时和内存开销是多少?
  • RQ4面向对象的分析能否指导实际优化,从而在真实世界 Java 和 Scala 应用中实现可测量的性能提升?
  • RQ5与传统的基于代码的分析相比,面向对象的分析在揭示隐藏性能瓶颈方面表现如何?

主要发现

  • DJXPerf 在真实世界 Java 和 Scala 应用(包括 Dacapo 基准测试中的 luindex 和 lusearch)中成功识别出内存膨胀和局部性差的问题。
  • 在 Dacapo 2006 的 luindex 基准测试中,将数组分配移出方法减少了内存占用并提升了性能,但由于缓存未命中次数较低,速度提升微乎其微(仅 0.5%)。
  • 在 lusearch 基准测试中,将 TopDocCollector 对象作为静态字段缓存,使运行时间减少了 1%,表明面向对象优化可带来可测量但适中的性能增益。
  • DJXPerf 仅带来约 8% 的平均运行时开销和约 5% 的内存开销,适合投入生产环境使用。
  • 该分析器使开发人员能够基于实际内存访问行为优化对象分配和布局模式,在多个案例研究中实现了显著的性能提升。
  • 面向对象的分析揭示了传统基于代码的分析器无法发现的性能问题,尤其是与内存膨胀和分散的对象访问模式相关的问题。
Figure 2. Overview of DJXPerf ’s object-centric analysis.
Figure 2. Overview of DJXPerf ’s object-centric analysis.

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。