real time java real time java
play

Real Time Java Real Time Java Filip Pizlo , Jan Vitek Filip Pizlo , - PowerPoint PPT Presentation

An Emprical Evaluation An Emprical Evaluation of of Memory Management Memory Management Alternatives Alternatives for for Real Time Java Real Time Java Filip Pizlo , Jan Vitek Filip Pizlo , Jan Vitek Purdue University Purdue University


  1. An Emprical Evaluation An Emprical Evaluation of of Memory Management Memory Management Alternatives Alternatives for for Real Time Java Real Time Java Filip Pizlo , Jan Vitek Filip Pizlo , Jan Vitek Purdue University Purdue University West Lafayette, IN, USA West Lafayette, IN, USA RTSS Dec 2006 RTSS Dec 2006

  2. Motivation • Real Time Java programmers are forced to choose between two memory management styles: • Scoped Memory • Real Time Garbage Collection • To date, no direct performance comparison exists. 2

  3. Contribution • We present the first open-source implementation of both scoped memory and RTGC in one VM • A discussion of software engineering benefits and dangers of scoped memory versus RTGC* • An empirical performance evaluation using two realistic Real Time Java applications 3

  4. Talk Overview • Summary of Scoped Memory • Summary of RTGC (Metronome Style) • Software Engineering Issues • Evaluation 4

  5. Scoped Memory Immortal Heap Scope A Scope B Scope C 5

  6. Scoped Memory Immortal Heap Scope A Parent Relation Scope B Scope C 6

  7. Scoped Memory Thread B Thread A Immortal Threads create the Heap Scope A scope hierarchy as they enter scopes. Scope B Scope C 7

  8. Scoped Memory Immortal Heap Scope A Invalid Refs Scope B Scope C 8

  9. Scoped Memory Immortal Heap Scope A Scope B Scope C 9

  10. Scoped Memory Thread B Thread A Immortal Objects in scopes are Heap Scope A freed when the scope is exited. Scope B Scope C 10

  11. Scoped Memory Thread B Thread A Immortal Objects in scopes are Heap Scope A freed when the scope is exited. Scope B Scope C 11

  12. Scoped Memory Immortal Heap Scope A Scope B Scope C 12

  13. Scoped Memory • What we wanted: avoidance of GC interruptions. • What scoped memory gives us: • Mostly-safe, somewhat-manual memory management • To avoid GC interruptions we add no-heap threads : • A no-heap thread cannot have references to the heap. 13

  14. Scoped Memory Example myScope = new LTMemory(65536, 65536); myAction = new Runnable() { public void run() { new Object(); // allocated in scope // deallocated after we exit the scope } }; // run myAction in myScope myScope.enter( myAction ); 14

  15. Scoped Memory Summary • Threads enter/exit scopes following a stack discipline • Objects deleted when scope exited • Dynamic checks: • Write Checks: prevent dangling pointers • Read Checks: prevent no-heap threads from accessing the heap. 15

  16. RTGC (The Metronome Way) T1 T2 T3 16

  17. RTGC (The Metronome Way) 1) Control collector interruptions: GC T1 T2 T3 ( collector interruptions ~ 1ms ) 2) Insure that collector methods used by mutator are highly predictable (worst case ~ best case) 17

  18. RTGC Implementation • “Insure that collector methods used by mutator are highly predictable (worst case ~ best case)” • We go to some trouble to make sure that the following are predictable: • Write Barrier • Allocation 18

  19. Write Barrier • What it is: • A small piece of code inserted by the compiler at every write of a reference to memory. It guarantees • that the collector does not lose track of objects. • What we need it to do: Do not exhibit worse performace during collection than when the collector is idle! GC Idle GC Active GC T1 Write Barrier 19

  20. Write Barrier • Idea: Whatever the worst case is, we need to simulate it. • Solution: Our write barrier always performs at worst case when the GC is idle. 20

  21. Allocation • No slow path! Collector ensures that all free space is accounted for. • Worst case: empty freelist, allocate new page, bump pointer in page 21

  22. Software Engineering Issues We now consider the software engineering impact of the two styles of Real Time Java memory management. • Scoped Memory • Real-Time Garbage Collection 22

  23. Scoped Memory Cons Pros Read Checks Fast Alloc Write Checks Fast Free Not Automatic Fail-Fast 23

  24. RTGC Cons Pros Overhead Safe Analysis Burden Automatic 24

  25. Performance • Methodology • RTGC Overhead • RTZen Performance • CD Performance 25

  26. Methodology • We use the OpenVM virtual machine and the J2c ahead-of-time compiler. • Our platform is an Pentium IV with 512MB RAM running Linux 2.6. • Memory Management: • Java-GC (mostly-copying, semi-space) • Java-GC + Scopes • RTGC 26

  27. Performance • Methodology • RTGC Overhead • RTZen Performance • CD Performance 27

  28. RTGC Overhead • We use the industry standard SPECjvm98 benchmark suite. • Three collectors: • Java-GC • RTGC w/o write barriers • RTGC 28

  29. SPEC Performance RTGC H NoBar L Java - GC 32% overhead 140 7% overhead RTGC - C 120 G a v a 100 J f o t n e 80 c r e P s 60 a e m i T 40 . c e x E 20 compress jess db javac mpegaudio mtrt jack Geo. Mean 29

  30. Performance • Methodology • RTGC Overhead • RTZen Performance • CD Performance 30

  31. RTZen Performance • RTZen is a real-time CORBA implementation. • RTZen uses scoped memory. We run it with and without scopes. • We test four memory management configurations: • Java-GC • RTGC • Scopes • Scopes w/o checks (see paper) 31

  32. RTZen Latency v. Time, Java-GC 70 58ms 60 44ms 50 L s i l l i m 40 H y c n e 30 t a L 20 1.56ms (best) 10 Time H secs L 100 200 300 400 500 600 32

  33. RTZen Latency v. Time, RTGC 3.5 2.9ms 3 2.5 1ms L s i l l 2 i m H y c n 1.5 e t a L 1.4ms 1 0.5 Time H secs L 100 200 300 400 500 600 33

  34. RTZen Latency v. Time, Scopes 3.5 3 2.1ms 0.8ms (RTGC is 38% worse) 2.5 L s i l l 2 i m H y c n 1.7ms 1.5 e t a L 1 0.5 Time H secs L 100 200 300 400 500 600 34

  35. Performance • Methodology • RTGC Overhead • RTZen Performance • CD Performance 35

  36. CD Latency v. Iteration, Java-GC 120 114ms 100 80 L s i l l i m H y 60 c n e t a L 40 20 4ms 0 50 100 150 200 250 300 Iteration Number 36

  37. CD Latency v. Iteration, RTGC 25 18ms 20 L s i 15 l l i m H y c n e 10 t a L 5 6ms 0 50 100 150 200 250 300 Iteration Number 37

  38. CD Latency v. Iteration, Scopes 25 20 L s i 15 8ms (RTGC is 80% worse) l 10ms l i m H y c n e 10 t a L 5 4ms 0 50 100 150 200 250 300 Iteration Number 38

  39. Conclusion • In RTGC, raw throughput suffers only 7% for SPECjvm98 (though it is 32% worse in the jess benchmark). • RTGC has between 38% (RTZen) and 80% (CD) worse latency in the worst case. • Your Mileage May Vary, but: • If you can tolerate the overhead, RTGC is easier. • Scopes are still best if your specification is tight. • Read the paper for a more in-depth evaluation! 39

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend