Identifying Memory Inefficiencies Via Object-Centric Profiling for Java

Identifying Memory Inefficiencies Via Object-Centric Profiling for Java

DJXPerf: Identifying Memory Inefficiencies via Object-centric Profiling for Java Bolun Li Pengfei Su Milind Chabbi North Carolina State University University of California, Merced Scalable Machines Research [email protected] [email protected] [email protected] Shuyin Jiao Xu Liu North Carolina State University North Carolina State University [email protected] [email protected] Abstract Woodstock ’18: ACM Symposium on Neural Gaze Detection, June 03–05, 2018, Java is the “go-to” programming language choice for developing Woodstock, NY. ACM, New York, NY, USA, 13 pages. https://doi.org/10.1145/ 1122445.1122456 scalable enterprise cloud applications. In such systems, even a few percent CPU time savings can offer a significant competitive ad- vantage and cost saving. Although performance tools abound in 1 Introduction Java, those that focus on the data locality in the memory hierarchy Java is the “go-to” programming language choice for developing are rare. scalable enterprise cloud applications [1, 11, 12, 50, 64, 80, 81]. Per- In this paper, we present DJXPerf, a lightweight, object-centric formance is critical in such Java programs running on a distributed memory profiler for Java, which associates memory-hierarchy per- system comprised of thousands of hosts; on such systems, saving formance metrics (e.g., cache/TLB misses) with Java objects. DJXPerf CPU time even by a few percentages offers both competitive ad- uses statistical sampling of hardware performance monitoring coun- vantages (lower latency) and cost savings. Tools abound in Java ters to attribute metrics to not only source code locations but also for “hotspot” performance analysis that can bubble-up code con- Java objects. DJXPerf presents Java object allocation contexts com- texts where the execution spends the most time and are also used bined with their usage contexts and presents them ordered by by developers for tuning performance. However, once such “low the poor locality behaviors. DJXPerf’s performance measurement, hanging targets” are optimized, identifying further optimization op- object attribution, and presentation techniques guide optimizing portunities is not easy. Java, like other managed languages, employs object allocation, layout, and access patterns. DJXPerf incurs only various abstractions, runtime support, just-in-time compilation, and ∼8% runtime overhead and ∼5% memory overhead on average, re- garbage collection, which hide important execution details from quiring no modifications to hardware, OS, Java virtual machine, or the plain source code. application source code, which makes it attractive to use in pro- In modern computer systems, compute is “free” but memory duction. Guided by DJXPerf, we study and optimize a number of accesses cost dearly. Long-latency memory accesses are a major Java and Scala programs, including well-known benchmarks and cause of execution stalls in modern general-purpose CPUs. CPU’s real-world applications, and demonstrate significant speedups. memory hierarchy (different levels of caches) offers a means to reduce average memory access latency by staging data into caches CCS Concepts and repeatedly accessing before evicting. Access patterns that reuse • Software and its engineering ! Compilers; General pro- previously fetched data are said to exhibit good data locality. There gramming languages. are traditionally two types of data locality: spatial and temporal. An access pattern exhibits spatial locality when it accesses a memory Keywords location and then accesses nearby locations soon afterward. An arXiv:2104.03388v1 [cs.PF] 7 Apr 2021 access pattern exhibits temporal locality when it accesses the same compiler techniques and optimizations, performance, dynamic anal- memory multiple times. Programs that do not exploit these features ysis, managed languages and runtimes are said to lack spatial or temporal locality. ACM Reference Format: Maintaining the locality of references in a CPU’s memory hier- Bolun Li, Pengfei Su, Milind Chabbi, Shuyin Jiao, and Xu Liu. 2018. DJXPerf: archy is well-known and mastered to achieve high performance in Identifying Memory Inefficiencies via Object-centric Profiling for Java.In natively compiled code such as C and C++. Besides the traditional locality problems, garbage collected languages such as Java expose Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed another unique locality issue — memory bloat [95]. Memory bloat for profit or commercial advantage and that copies bear this notice and the full citation occurs by allocating (and initializing) many objects whose lifetimes on the first page. Copyrights for components of this work owned by others than ACM do not overlap. For example, allocating objects in a loop where must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a the lifetime of the object is only the scope of the loop body. Since fee. Request permissions from [email protected]. the garbage collection happens sometime later in the future, the Woodstock ’18, June 03–05, 2018, Woodstock, NY memory consumption spikes, which results in a higher memory © 2018 Association for Computing Machinery. ACM ISBN 978-1-4503-XXXX-X/18/06...$15.00 footprint and suboptimal cache utilization. Memory bloat can be https://doi.org/10.1145/1122445.1122456 seen as a case of lack of both spatial and temporal locality because Woodstock ’18, June 03–05, 2018, Woodstock, NY Bolun Li, Pengfei Su, Milind Chabbi, Shuyin Jiao, and Xu Liu (a) Object access sequence in the timeline its execution behaviors. Second, automatic runtime memory man- 4% 8% 24% 8% 10% 12% 8% 12% 8% 6% agement (i.e., garbage collection) further impedes understanding misses (%) misses memory performance of Java and other languages based on JVM, <O1, Ia> <O2, Ib> <O3, Ic> <O1, Id> <O1, Ie> <O2, If> <O1, Ig> <O1, Ih> <O1, Ii> <O2, Ij> such as Scala [8] and Clojure [48]. Cache Since developers in native languages have explicit knowledge I : 24% I : 12% I : 12% I : 10% c f h e and understanding of objects and their lifetimes, they pay more Ih: 12% Ie: 10% O1: 50% Id : 8% Ig : 8% Ib: 8% Id: 8% Ixxxsi : 8% Ia: 4% attention to objects and their locality; Java developers, on the other Ig: 8% Ii: 8% If: 12% Ib : 8% Ij: 6% Ia: 4% O : 26% hand, lack the precise knowledge of object lifetimes and their in- 2 I : 6% j fluence on locality. Surprisingly, Java lacks any object-centric per- O3: 24% Ic: 24% formance attribution tool, which can pinpoint objects subject to (b) Code-centric profiling (c) Object-centric profiling serious latency problems. Tools such as Linux perf [57] and Intel VTune [52] exploit hardware performance monitoring and attribute Figure 1: Code-centric vs. object-centric profiling. $ denotes cache miss metrics to code, such as Java methods, loops, or source an object and 퐼 denotes a memory access instruction; tuple locations, but they do not attribute metrics to Java objects. As h$<, 퐼=i denotes that instruction 퐼= accesses object $<. shown in Figure 1, these tools only attribute metrics to problematic code lines; without object-level information, they cannot tell which accessing a large number of independent objects results in access- objects are problematic and deserve optimization. A few tools such ing disparate cache lines and little or no reusing of a previously as [69, 94, 97] instrument Java byte code to identify problematic accessed cache line(s). objects. However, these tools suffer from high overhead and lack Exploring data locality in native languages has been under inves- real execution performance metrics available from the hardware. tigation for decades. There exist a number of tools [13–15, 58, 59, 61– Often times, the optimization lacking the quantification from the 63, 101] to measure the data locality using various metrics. Soft- underlying hardware can yield trivial or negative speedups [59]. ware metrics such as reuse distances [28, 79, 86, 100, 101], memory Most of today’s shared memory multiprocessor systems support footprints [10, 54], and cache miss ratio curves [15, 19], which non-uniform memory access (NUMA), where the loss of data local- are derived from memory access traces, quantify the locality in- ity not only pervasively exists within a single CPU processor (aka a dependent of architectures. In contrast, hardware metrics, such as NUMA socket), but also across CPU processors. NUMA character- cache/TLB misses, collected with hardware performance monitor- istics introduce the explicit NUMA property of the shared memory ing units (PMU) during program execution, quantify data locality systems, where differences in local and remote memory access on a given architecture. Attributing PMU metrics to source code is latencies can be up to two orders of magnitude. Shared memory a straightforward way to demonstrate code regions that incur high applications with transparent data distributions across all nodes access latencies; we call it as code-centric profiling. often incur high overheads due to excessive remote memory ac- In object-oriented systems, delivering profiles centered around cesses. Minimizing the number of remote accesses is crucial for objects is highly desirable. An object may have accesses to it scat- high performance, and this, in turn, usually requires a suitable, tered in many places, and each code location may contribute a small application-specific data distribution. In general, choosing anap- fraction to the overall data-access problem. Bridging the memory- propriate data distribution remains a challenge. We can attribute hierarchy latency metrics with runtime data objects requires more metrics to individual objects with the object-centric idea, then iden- involved measurement and attribution techniques, which is the tifying the objects that suffer from severe remote accesses. focus of our work; we call it as object-centric profiling. Note that In this paper, we describe DJXPerf, a lightweight object-centric object-centric profiling not only shows the objects subject to high ag- profiler for Java programs.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us