One Process to Reap Them All: Garbage Collection As a Service

One Process to Reap Them All: Garbage Collection As a Service

One Process to Reap Them All Garbage Collection as-a-Service Ahmed Husseinyz Mathias Payery Antony L. Hosking†∗ Chris Vickx zHuawei, USA yPurdue U., USA ∗ANU / Data61, Australia xQualcomm, USA [email protected] [email protected] [email protected] [email protected] Abstract Categories and Subject Descriptors C.1.4 [Parallel Ar- Ubiquitous mobile platforms such as Android rely on man- chitectures]: Mobile processors; D.3.4 [Programming Lan- aged language run-time environments, also known as lan- guages]: Processors—Memory management (garbage col- guage virtual machines (VMs), to run a diverse range of user lection), Run-time environments; D.4.8 [Performance]: applications (apps). Each app runs in its own private VM in- Measurements stance, and each VM makes its own private local decisions in Keywords mobile, power, energy, Android, smartphones managing its use of processor and memory resources. More- over, the operating system and the hardware do not com- 1. Introduction municate their low-level decisions regarding power manage- Mobile devices must balance performance and responsive- ment with the high-level app environment. This lack of co- ness while being constrained by energy consumption and ordination across layers and across apps restricts more effec- thermal dissipation. With performance, heat, and power tive global use of resources on the device. consumption strongly tied together, mobile devices come We address this problem by devising and implement- bundled with software components such as kernel gover- ing a global memory manager service for Android that op- nors [11] and proprietary thermal engines that control power timizes memory usage, run-time performance, and power and thermal properties (dynamic frequency). The crude de- consumption globally across all apps running on the de- cisions made by these engines are orthogonal to heuristics vice. The service focuses on the impact of garbage collec- for resource management embedded within software com- tion (GC) along these dimensions, since GC poses a sig- ponents at the user space level. nificant overhead within managed run-time environments. With the number of Android [28, 31] devices exceeding Our prototype collects system-wide statistics from all run- a billion,1 the dominance of the Android run-time environ- ning VMs, makes centralized decisions about memory man- ment introduces an interesting challenge: we are faced with agement across apps and across software layers, and also devices that continuously run dozens of VMs in parallel as collects garbage centrally. Furthermore, the global memory apps and as services. All these VMs share a set of con- manager coordinates with the power manager to tune collec- strained and over-committed resources. Without global co- tor scheduling. In our evaluation, we illustrate the impact of ordination, each VM optimizes independently across com- such a central memory management service in reducing total peting goals: performance, responsiveness, and power con- energy consumption (up to 18%) and increasing throughput sumption. For example, each VM decides independently (up to 12%), and improving memory utilization and adapt- what to compile (JIT), when to garbage collect, and what ability to user activities. to collect (e.g., using a minor or a major collection). This situation is vastly different from classic desktop or applica- tion server systems where VMs use dedicated resources, and where only one or a handful of VM processes run concur- rently. 1.1 Motivation VMs substantially increase productivity by abstracting the hardware and offering useful services such as dynamic op- Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee timization, class resolution and, garbage collection (GC). provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. However, VM services impose performance and energy Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. costs, ranging from 5% to over 70% [14, 18, 34, 40, 53]. VEE’ 17, April 08-09, 2017, Xi’an, China c 2017 ACM. ISBN 978-1-4503-4948-2/17/04. $15.00 DOI: http://dx.doi.org/10.1145/3050748.3050754 1http://expandedramblings.com/index.php/android-statistics/ Tuning of GC. VM services typically come with a num- by individual VMs. The benefits of a global service include ber of optimization and scheduling heuristics designed to efficient resource management, feasible methodology to an- meet the performance needs of supported applications and alyze system behavior, fine control over tuning parameters, users. The tuning of GC performance is achieved by design- and excluded redundancy across the parallel VMs. ing a GC policy that uses a set of predefined heuristics and In this paper, we show that a global memory management the state of app execution to decide when and what to col- service provides better control over GC costs and memory lect [36]. Configuring a garbage collector is a tedious task utilization. Unlike the existing execution mode, where each because a VM often uses tens of parameters when tuning the collector runs within its own VM, the new platform has a sin- garbage collector, specific to the needs of a particular appli- gle GC service process that serves all running VMs. The GC cation: e.g., initial heap size, heap resizing, and the mode of service unifies interactions between nonadjacent system lay- collection to perform [10, 42]. Even for a single VM, it is ex- ers (i.e., the low-level OS power manager) and GC tasks. The tremely difficult to identify the best collector and heuristics service has OS-like access, capable of scanning and collect- for all service configurations [36, 39, 55]. ing per-process VM heaps remotely and gathering statistics GC Impact on Energy. Recent interest in fine-grained about all the running VMs in the system, including process power measurement shows that GC has a significant im- priority, allocation rate, and heap demographics. This allows pact on energy consumed by the apps, ranging from 7% to for fine-grained control over the GC tasks being executed, 30% [14, 53]. This happens not only because of its explicit and their scheduling, compared to just coarsely signaling in- overhead on CPU and memory cycles, but also because of dividual VMs to start GC collections. implicit scheduling decisions by the OS and hardware with We illustrate the power of combining vertical cross- respect to CPU cores. Therefore, a potential approach to op- layered heuristics to achieve efficient heap decisions such timize GC cost per single VM is to take advantage of GC as compaction, collection, and trimming. GC service effi- idleness and control the frequency of the core on which the ciency is not limited to local heuristics, resulting in better concurrent collector thread is running [23, 34]. utilization of system resources based on the workload. We Distributed Controls. Mobile platforms have a software make the following contributions: stack comprising various layers with lower-level layers pro- • We identify a unique opportunity for optimization on viding services to upper-level layers. These layers of abstrac- mobile systems by coordinating and orchestrating all the tion typically are not tuned in harmony with VM implemen- concurrently running VMs. tation. For example:( i) Device Configurations: The mobile • We design a global service that collects statistics from all system has globally fixed VM configurations such as the ini- VMs, and we implement a prototype that centralizes GC, tial and maximum heap sizes;( ii) OS: Some heuristics and including global GC heuristics that optimize memory configurations may be applied on their own, without coor- usage across VMs and the actual collection tasks. dinating with the VM [37, 41]—e.g., the low memory killer • We develop, implement, and evaluate, in vivo, a com- that handles out-of-memory events. plete running mobile platform based on Android that dis- Interference Across Running VMs. With dozens of VMs tributes GC sub-tasks between applications and an OS- running concurrently on constrained devices, tuning mem- like control unit. These heuristics include: heap growth ory configurations for mobile platforms is even more chal- management, compaction, trimming, context-aware task- lenging due to interference between VMs across the layers of killing mechanisms, and energy optimization. the hardware and software stack. Local per-VM tuning is a sub-structured approach that mostly fails to find the globally optimal policy for the entire device. For example, throttling 2. Background the CPU during GC of the highest priority app [34] cannot Mobile platforms employ aggressive power management handle concurrent GC tasks across the running apps. of sub-systems to improve battery life and to control ther- mal conditions since these platforms only have passive heat 1.2 Contributions sinks, and for example, their CPUs cannot run continuously Here we consider the impact of GC on the device’s over- at full speed. The governor [11] collects run-time statis- all performance. We identify the missing coordination be- tics at time t (e.g., work load work(t) and core tempera- tween concurrent VMs as an opportunity for optimization ture) and then applies complex heuristics—dynamic voltage on mobile systems along the dimensions of( i) memory us- and frequency scaling (DVFS)—to meet optimization cri- age,( ii) runtime performance, and( iii) power consumption. teria [15, 35, 46]. Smartphone energy profiling is a tedious A global service that collects statistics from all running VMs task because it requires( i) hardware access to device compo- can optimize across these dimensions, and it allows for coor- nents, and( ii) an understanding of the distribution of power dination with power managers to achieve global energy op- among the device components.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    16 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