22
06/14/22 University of Nebraska-Li ncoln 1 Adaptive Code Unloading for Resource-Constrained JVMs ACM SIGPLAN, 2004 Presented by Mithuna Soundararaj

Adaptive Code Unloading for Resource-Constrained JVMs

Embed Size (px)

DESCRIPTION

Adaptive Code Unloading for Resource-Constrained JVMs. ACM SIGPLAN, 2004 Presented by Mithuna Soundararaj. Outline. Introduction Motivation and Contributions Compile-only and Interpreter-only JVM Code Unloading What to Unload? When to Unload? Results. Introduction. - PowerPoint PPT Presentation

Citation preview

Page 1: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 1

Adaptive Code Unloading for Resource-Constrained JVMs

ACM SIGPLAN, 2004

Presented by

Mithuna Soundararaj

Page 2: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 2

Outline

Introduction

Motivation and Contributions

Compile-only and Interpreter-only JVM Code Unloading What to Unload? When to Unload? Results

Page 3: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 3

Introduction

Java Virtual machine extension for adaptive code unloading.

Reduces memory requirement imposed by compile-only JVMs.

The extension feature, an unloader uses execution behavior to adaptively determine *when* and *what* code to unload.

Unloading strategies used reduces the code size, in turn reducing the execution time and memory.

Page 4: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 4

Motivation

To reduce the overhead of memory consumed by compiled code which increases the cost of memory management.

To adaptively balance not storing any code and caching all generated code according to the dynamic memory availability.

Page 5: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 5

Compile-only Vs Interpreter JVM

Compile-only JVM

-Uses device resources more efficiently.

-Higher quality code.

-Code reuse and optimization. Interpreter-only JVM

-Simple to interpret.

-No memory overhead

Page 6: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 6

Code Unloading opportunities

Large amount of executed code used only during program start up( initial 10% of execution time).

Code that remains in the system and is never invoked after start up.(shorter lifetimes).

Long-lived methods executed in-frequently during their lifetime.

Page 7: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 7

Page 8: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 8

Code Unloading

To exploit the available code unloading opportunities and to relieve the memory pressure imposed by compile-only JVMs, they have developed an extensible framework for the implementation of strategies that decide

-What to unload?-When to unload?-Balance between memory pressure and

recompilation overhead.

Page 9: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 9

Page 10: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 10

What to Unload?

Predicting methods which are unlikely to be invoked in the future.

Monitor the execution to identify the methods that have not been recently invoked by

-Online eXhaustive profiling (OnX)

-Online Sample-based profiling (OnS)

-Offline exhaustive profiling (Off)

-No profiling (NP).

Page 11: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 11

What strategies

Online eXhaustive profiling(OnX)

Compiler instruments methods setting a mark bit to one every time a method is invoked.

Online Sample-Based profiling(OnS)

Sets the mark bits of the two methods on the top of the invocation stack.

Offline Exhaustive Profiling(Off) To analyze the behavior of the methods offline No Profiling unload all methods that are not currently on the run

time stack when unloading occurs.

Page 12: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 12

When to unload?

Timer Triggered Approach Garbage Collection triggered Strategy. Maximum Call Times Triggered(MCT). Code Cache Size Triggered(CS).

Page 13: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 13

When Strategies

Timer Triggered Approach. Unloads code at regular intervals Does not account for the dynamically

changing memory availability. Approximates time using thread switch

count which occurs every 10 ms. Increments count according to time

spent in GC.

Page 14: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 14

When Strategies

Adaptive Garbage Collection Triggered Strategy -Unloading trigger of GC invocation count. -Frequency of code unloading dynamically adapts to

resource behavior. -Unloading more frequently when memory is highly

constrained but less frequent otherwise. -Memory Usage behavior is got from heap residency. -At the end of each GC cycle, resource monitor

forwards the percentage of execution time that is spent in GC to the unloader so as to adjust the frequency of the unloading sessions.

Page 15: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 15

When Strategies

Maximum Call Times Triggered(MCT)

-unloads a method after its final compilation.

Code Cache Size Triggered

-Stores native code bodies in a fixed size code cache, when cache becomes full it is unloaded.

Page 16: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 16

Unloading Optimized Code

Recompiling an unloaded,previously optimized method affects the balance of re-compilation overhead and performance benefits.

Strategies to handle optimized code -RO(Reload Optimized methods using

the optimization hint). -EO(Exclude unloading of optimized

methods) -DO(Delay unloading of optimized

methods)

Page 17: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 17

RESULTS

Page 18: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 18

Impact On Memory Footprint

Page 19: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 19

Page 20: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 20

Impact On Execution Performance

Page 21: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 21

Conclusion

Opportunity for dynamically unloading compiled code in JIT-based JVMs for mobile and embedded devices.

Adaptively unload dead and infrequently used code to reduce memory consumed and improve performance.

When memory is highly constrained,reduction in code size by 61% and execution time of 23% on an average across benchmark programs and JVM configurations.

Page 22: Adaptive Code Unloading for Resource-Constrained JVMs

04/19/23 University of Nebraska-Lincoln 22

Thank You