SlideShare a Scribd company logo
Jean-Philippe BEMPEL
WebScale
@jpbempel
CLR/JVM
implementation
differences
2 •
• Common Design Goals
• JIT
• GC
• Tooling
JVM/CLR implementation differences
Common Design Goals
4 •
Native
Executable
OS: Win32
Format: PE
CPU: x64/SSE2
Executable
OS: Linux
Format: ELF
CPU: x64/AVX2
OS
Windows
CPU
x64/SSE2
OS
Linux
CPU
x64/AVX2
5 •
Runtime
ByteCode/IL
Runtime
OS
Windows
CPU
x64/SSE2
OS
Linux
CPU
X64/AVX2
Runtime
JIT
7 •
• Dynamic compilation opposed to AOT (Ahead Of Time)
+ In theory can produce code faster than static compiler (more information at runtime than
statically, usage),
+ Global code optimization (instead of linking, inlining)
+ Cpu instruction detection
- Time constraints, startup/warmup time
- No shareable code across process
JIT Pros & Cons
8 •
• No JIT at first, interpreter only
• Some companies worked on JIT (Borland,
Symantec, IBM, BEA)
• First JIT in Sun JVM in 1999 with JDK 1.3 HotSpot
JVM JIT History
9 •
• Start compiling after a threshold
Allow to compile only Hot methods => Hot spots !
• Profile guided optimizations
• Optimistic/Aggressive optimization - Deoptimizations
• 2 flavors: Client (C1) – Server (C2)
• Since JDK 8: Tiered Compilation
HotSpot JIT Characteristics
10 •
• Client Compiler
• Reduce warmup time, quick compilation
• Threshold set to 1500 calls before compilation
• Less optimizations, less aggressive or advanced
C1
11 •
• Server Compiler
• Peak performance
• Threshold set to 10 000 calls before compilation
• More optimizations, more aggressive and advanced
C2
12 •
• Start with interpreter and Statistics gathering (PGO)
• Use stats to apply aggressive/optimistic optimizations:
• Devirtualization (very important for Java)
• Inlining (Mother-Of-All-Optimizations)
• Exception handling elimination
• Uncommon branch elimination
• Null Check elimination
• OnStack Replacement
JVM Specific optimizations
13 •
+ Optimistic/PGO optimizations
+ Interpreter allow any fallback in case of issue and does not prevent execution even on
startup. Allow also longer compilation phases => more optimized
+ instrumentation (Changing bytecode on the fly)
- Warmup can be long (10,000 calls before kicking JIT) (Mitigation: configurable, Tiered
Compilation)
- Deoptimizations are STW
JVM JIT Pros & Cons
14 •
• JIT Released with 1.0 in 2002 but only 32bits
• JIT 64 bits for .NET 2.0, more optimized for server, slower to compile
• RyuJit x64 in .NET 4.6 (2015), Faster to compile with same level of optimizations
CLR JIT History
15 •
CLR JIT Machinery
MyApp.exe
list.Add("Foo")
PreCode Stub
Universal JIT
thunk
JIT
push ebp
mov bp, esp
…
ret
16 •
• No interpreter, Execution is always with native code
• Fast compile time
• Compilation happening on the calling threads
CLR JIT Characteristics
17 •
+ After first call, method is always fast (warmup short) and stable
+ Fast compile time
+ Value type support
- Optimizations are not advanced and conservatives
- Interface call dispatch has relatively high overhead and not inlinable
CLR JIT Pros & Cons
GC
19 •
+ Simplify memory management (including some Lock-free algorithms)
+ Fast allocation
+ Reduce Fragmentation
+ Can be cache friendly
- unpredictable Stop-The-World Pauses
- hard to tune
GC Pros & cons
20 •
• Serial
• Parallel
• Concurrent Mark & Sweep
• G1
• Azul’s C4
• Shenandoah
• Z
JVM GC Algorithms
21 •
• Maximum heap need to be fixed
• Minor GC triggered by young gen being full
• Lot of options for tuning (too much?)
JVM GC Characteristics
22 •
JVM GC Layout
23 •
JVM GC Layout
24 •
+ Large choice of algorithms adapted to workload
+ Few or no fragmentation (often compacting)
+/- Fine Control/Tuning
- Pause time can be large
JVM GC Pros & Cons
25 •
• Workstation
• STW
• Background
• Server
• STW
• Background
CLR GC Algorithms
26 •
CLR GC Layout
Gen2 Gen1
Segment
Gen0
27 •
• Total heap sized depends on physical memory available
• GC triggered based on a estimated allocation budget per generation
• Leverage the non-fixed size of generation to adjust them
• On each GC a plan phase determines if a compacting phase is required
• Large Object Heap (>85,000B)
• No option, auto-tuning
CLR GC Characteristics
28 •
+ Pause time relatively short
+ Suits interactive apps mostly, with small/medium heap
+/- Almost No Control/Tuning
- Fragmentation/FreeLists
- Pinned Objects
CLR GC Pros & Cons
Tooling
30 •
• Command line tools:
• Thread Dump: jstack, jcmd
• Heap Dump & Class Histogram: jmap, jcmd
• GC: jstat, jcmd, GC logs
• Config: jinfo, jcmd
• Monitoring/Profiling/Analysis tools:
• Jconsole
• VisualVM
• Mission Control
• MXBeans
JVM troubleshooting
31 •
• Command line tools:
• Thread Dump: procdump
• Heap Dump, Class Histogram: procdump
• GC: PerfCounters/ETW events
• Monitoring/Profiling/Analysis tools:
• WinDBG + SOS/SOSEX
• Visual Studio
• ETW events
• PerfView
CLR troubleshooting
Conclusion
33 •
• Common Design goals
• Runtime
• Hardware abstraction
• Memory safety
• JIT differences
• JVM: Hybrid interpreter/compiled
• CLR: First execution compilation
• GC differences
• JVM: Compacting, highly tunable, many choices
• CLR: auto-tunable, Free Lists, Pinned object
• Tooling
• JVM: many tools, OS independent
• CLR: raw tools, OS dependent
CLR/JVM
References
35 •
• Just-In-Time compilation Wikipedia
• Just-In-Time Compilers from Java 1.1 Unleashed
• PC Mag April 23 ’96
• Combining Analyses, Combining Optimizations - Cliff Click ‘s PhD thesis
• Combining Analyses, Combining Optimizations – Summary
• Design of the Java HotSpot Client Compiler for Java 6
• The Java HotSpot Server Compiler
• Null Check elimination
• Black Magic of (Java) Method Dispatch
• Virtual Call 911
• JIT Watch
References JVM JIT
36 •
• Java Garbage Collection Distilled
• The Java GC mini book
• Oracle’s white paper on JVM memory management & GC
• CMS phases
• G1 One Garbage Collector to rule them all
• Tips for Tuning The G1 GC
• G1 Garbage Collector Details and Tuning by Simone Bordet
• C4 Algorithm paper
• Shenandoah: The Garbage Collector That Could by Aleksey Shipilev
• ZGC - Low Latency GC for OpenJDK
References JVM GC
37 •
• jmap
• jstack
• jcmd
• jinfo
• jstat
• Understanding GC logs
• Java Mission Control
• Using the Platform MBean Server and Platform MXBeans
References JVM tooling
38 •
• JIT Optimizations
• TieredCompilation in .NET Core
• RyuJIT: The next-generation JIT compiler for .NET
• RyuJIT Overview
• Managed Profile-Guided Optimization Using Background JIT
• .NET Just in Time Compilation and Warming up Your System
• Performance decrease when using interfaces
• Virtual Stub Dispatch
• Simple devirtualization
• Collect Optimization Candidates for Using Intel Hardware Intrinsics in mscorlib
• sharplab.io
References CLR JIT
39 •
• Maoni’s blog
• Garbage Collection Design
• Learning How Garbage Collectors Work
• GC Pauses and Safe Points
• Back to basics: Generational Garbage Collector
• Garbage Collector Basics and Performance Hints
• Fun with .NET GC, Paging, Generations and Write Barriers
References CLR GC
40 •
• Analysing .NET Memory Dumps with CLR MD
• Analysing Pause times in the .NET GC
• CLR MD Going beyond SOS
• Intro to WinDBG for .NET developers
• SOS.dll
• SOSEX
• CLR ETW Events
References CLR tooling
Thank You!
@jpbempel

More Related Content

What's hot (20)

PPTX
Progress_190315
Hyo jeong Lee
 
PDF
スマホでDeepLearning実践入門(α版)
cocodrips
 
PDF
QNIBTerminal: Understand your datacenter by overlaying multiple information l...
QNIB Solutions
 
PPTX
Rocks db state store in structured streaming
Balaji Mohanam
 
PPT
Exploring Petri Net State Spaces
Universität Rostock
 
PDF
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
Linaro
 
PDF
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
Anne Nicolas
 
PDF
High Performance Systems Without Tears - Scala Days Berlin 2018
Zahari Dichev
 
PDF
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Anne Nicolas
 
PDF
Exploiting parallelism opportunities in non-parallel architectures to improve...
GreenLSI Team, LSI, UPM
 
PDF
BKK16-203 Irq prediction or how to better estimate idle time
Linaro
 
PDF
Kafka short
Tikal Knowledge
 
PDF
BKK16-304 The State of GDB on AArch64
Linaro
 
PDF
Heatmap
Tikal Knowledge
 
PDF
Processing Big Data in Realtime
Tikal Knowledge
 
PDF
BKK16-306 ART ii
Linaro
 
PDF
Low latency Java apps
Simon Ritter
 
PDF
Pimp my gc - Supersonic Scala
Pierre Laporte
 
PDF
BUD17-300: Journey of a packet
Linaro
 
PDF
BUD17-TR02: Upstreaming 101
Linaro
 
Progress_190315
Hyo jeong Lee
 
スマホでDeepLearning実践入門(α版)
cocodrips
 
QNIBTerminal: Understand your datacenter by overlaying multiple information l...
QNIB Solutions
 
Rocks db state store in structured streaming
Balaji Mohanam
 
Exploring Petri Net State Spaces
Universität Rostock
 
LAS16-501: Introduction to LLVM - Projects, Components, Integration, Internals
Linaro
 
Kernel Recipes 2018 - A year of fixing Coverity issues all over the Linux ker...
Anne Nicolas
 
High Performance Systems Without Tears - Scala Days Berlin 2018
Zahari Dichev
 
Kernel Recipes 2018 - 10 years of automated evolution in the Linux kernel - J...
Anne Nicolas
 
Exploiting parallelism opportunities in non-parallel architectures to improve...
GreenLSI Team, LSI, UPM
 
BKK16-203 Irq prediction or how to better estimate idle time
Linaro
 
Kafka short
Tikal Knowledge
 
BKK16-304 The State of GDB on AArch64
Linaro
 
Processing Big Data in Realtime
Tikal Knowledge
 
BKK16-306 ART ii
Linaro
 
Low latency Java apps
Simon Ritter
 
Pimp my gc - Supersonic Scala
Pierre Laporte
 
BUD17-300: Journey of a packet
Linaro
 
BUD17-TR02: Upstreaming 101
Linaro
 

Similar to Clr jvm implementation differences (20)

PPTX
Advanced Java Features: A Deep Dive into JVM, JIT, and GC
Naresh IT
 
PDF
Advanced Java Features: A Deep Dive into JVM, JIT, and GC
Naresh IT
 
PPTX
JVM Magic
Baruch Sadogursky
 
PDF
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
PDF
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
Joseph Kuo
 
PDF
JVM Under the Hood
Serkan Özal
 
PDF
Why should i switch to Java SE 7
Vinay H G
 
PPT
Introduction to Real Time Java
Deniz Oguz
 
PDF
JVM Performance Tuning
Jeremy Leisy
 
PPTX
A tour of Java and the JVM
Alex Birch
 
PPTX
Java10 new features 2018
Arjun Bhati
 
PDF
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
PDF
Java on the Mainframe
Michael Erichsen
 
PPTX
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Anna Shymchenko
 
PDF
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon
 
PPTX
Introduction to .net FrameWork by QuontraSolutions
Quontra Solutions
 
PDF
G1: To Infinity and Beyond
ScyllaDB
 
PDF
Software Profiling: Java Performance, Profiling and Flamegraphs
Isuru Perera
 
PDF
Java at Scale, Dallas JUG, October 2013
Azul Systems Inc.
 
PPTX
Building a Better JVM
Simon Ritter
 
Advanced Java Features: A Deep Dive into JVM, JIT, and GC
Naresh IT
 
Advanced Java Features: A Deep Dive into JVM, JIT, and GC
Naresh IT
 
Performance Tuning - Understanding Garbage Collection
Haribabu Nandyal Padmanaban
 
TWJUG x Oracle Groundbreakers 2019 Taiwan - What’s New in Last Java Versions
Joseph Kuo
 
JVM Under the Hood
Serkan Özal
 
Why should i switch to Java SE 7
Vinay H G
 
Introduction to Real Time Java
Deniz Oguz
 
JVM Performance Tuning
Jeremy Leisy
 
A tour of Java and the JVM
Alex Birch
 
Java10 new features 2018
Arjun Bhati
 
Software Profiling: Understanding Java Performance and how to profile in Java
Isuru Perera
 
Java on the Mainframe
Michael Erichsen
 
Вячеслав Блинов «Java Garbage Collection: A Performance Impact»
Anna Shymchenko
 
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon
 
Introduction to .net FrameWork by QuontraSolutions
Quontra Solutions
 
G1: To Infinity and Beyond
ScyllaDB
 
Software Profiling: Java Performance, Profiling and Flamegraphs
Isuru Perera
 
Java at Scale, Dallas JUG, October 2013
Azul Systems Inc.
 
Building a Better JVM
Simon Ritter
 
Ad

More from Jean-Philippe BEMPEL (14)

PDF
Mastering GC.pdf
Jean-Philippe BEMPEL
 
PDF
Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...
Jean-Philippe BEMPEL
 
PDF
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
Jean-Philippe BEMPEL
 
PDF
Tools in action jdk mission control and flight recorder
Jean-Philippe BEMPEL
 
PDF
Le guide de dépannage de la jvm
Jean-Philippe BEMPEL
 
PDF
Out ofmemoryerror what is the cost of java objects
Jean-Philippe BEMPEL
 
PDF
OutOfMemoryError : quel est le coût des objets en java
Jean-Philippe BEMPEL
 
PDF
Low latency & mechanical sympathy issues and solutions
Jean-Philippe BEMPEL
 
PDF
Lock free programming - pro tips devoxx uk
Jean-Philippe BEMPEL
 
PDF
Lock free programming- pro tips
Jean-Philippe BEMPEL
 
PDF
Programmation lock free - les techniques des pros (2eme partie)
Jean-Philippe BEMPEL
 
PDF
Programmation lock free - les techniques des pros (1ere partie)
Jean-Philippe BEMPEL
 
PDF
Measuring directly from cpu hardware performance counters
Jean-Philippe BEMPEL
 
PDF
Devoxx france 2014 compteurs de perf
Jean-Philippe BEMPEL
 
Mastering GC.pdf
Jean-Philippe BEMPEL
 
Javaday 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneur...
Jean-Philippe BEMPEL
 
Devoxx Fr 2022 - Remèdes aux oomkill, warm-ups, et lenteurs pour des conteneu...
Jean-Philippe BEMPEL
 
Tools in action jdk mission control and flight recorder
Jean-Philippe BEMPEL
 
Le guide de dépannage de la jvm
Jean-Philippe BEMPEL
 
Out ofmemoryerror what is the cost of java objects
Jean-Philippe BEMPEL
 
OutOfMemoryError : quel est le coût des objets en java
Jean-Philippe BEMPEL
 
Low latency & mechanical sympathy issues and solutions
Jean-Philippe BEMPEL
 
Lock free programming - pro tips devoxx uk
Jean-Philippe BEMPEL
 
Lock free programming- pro tips
Jean-Philippe BEMPEL
 
Programmation lock free - les techniques des pros (2eme partie)
Jean-Philippe BEMPEL
 
Programmation lock free - les techniques des pros (1ere partie)
Jean-Philippe BEMPEL
 
Measuring directly from cpu hardware performance counters
Jean-Philippe BEMPEL
 
Devoxx france 2014 compteurs de perf
Jean-Philippe BEMPEL
 
Ad

Recently uploaded (20)

PPTX
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PPTX
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
DOCX
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PPTX
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
Thermal runway and thermal stability.pptx
godow93766
 
PPTX
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
PPTX
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
DOCX
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
PPTX
Hashing Introduction , hash functions and techniques
sailajam21
 
PPTX
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
PPTX
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
PDF
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
PPTX
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
PDF
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
PPTX
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
PDF
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
GitOps_Without_K8s_Training_detailed git repository
DanialHabibi2
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Types of Bearing_Specifications_PPT.pptx
PranjulAgrahariAkash
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
8th International Conference on Electrical Engineering (ELEN 2025)
elelijjournal653
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Product Development & DevelopmentLecture02.pptx
zeeshanwazir2
 
MRRS Strength and Durability of Concrete
CivilMythili
 
Thermal runway and thermal stability.pptx
godow93766
 
GitOps_Repo_Structure for begeinner(Scaffolindg)
DanialHabibi2
 
Depth First Search Algorithm in 🧠 DFS in Artificial Intelligence (AI)
rafeeqshaik212002
 
CS-802 (A) BDH Lab manual IPS Academy Indore
thegodhimself05
 
Hashing Introduction , hash functions and techniques
sailajam21
 
Introduction to Neural Networks and Perceptron Learning Algorithm.pptx
Kayalvizhi A
 
MobileComputingMANET2023 MobileComputingMANET2023.pptx
masterfake98765
 
MAD Unit - 1 Introduction of Android IT Department
JappanMavani
 
原版一样(Acadia毕业证书)加拿大阿卡迪亚大学毕业证办理方法
Taqyea
 
Set Relation Function Practice session 24.05.2025.pdf
DrStephenStrange4
 
artificial intelligence applications in Geomatics
NawrasShatnawi1
 
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 

Clr jvm implementation differences

  • 2. 2 • • Common Design Goals • JIT • GC • Tooling JVM/CLR implementation differences
  • 4. 4 • Native Executable OS: Win32 Format: PE CPU: x64/SSE2 Executable OS: Linux Format: ELF CPU: x64/AVX2 OS Windows CPU x64/SSE2 OS Linux CPU x64/AVX2
  • 6. JIT
  • 7. 7 • • Dynamic compilation opposed to AOT (Ahead Of Time) + In theory can produce code faster than static compiler (more information at runtime than statically, usage), + Global code optimization (instead of linking, inlining) + Cpu instruction detection - Time constraints, startup/warmup time - No shareable code across process JIT Pros & Cons
  • 8. 8 • • No JIT at first, interpreter only • Some companies worked on JIT (Borland, Symantec, IBM, BEA) • First JIT in Sun JVM in 1999 with JDK 1.3 HotSpot JVM JIT History
  • 9. 9 • • Start compiling after a threshold Allow to compile only Hot methods => Hot spots ! • Profile guided optimizations • Optimistic/Aggressive optimization - Deoptimizations • 2 flavors: Client (C1) – Server (C2) • Since JDK 8: Tiered Compilation HotSpot JIT Characteristics
  • 10. 10 • • Client Compiler • Reduce warmup time, quick compilation • Threshold set to 1500 calls before compilation • Less optimizations, less aggressive or advanced C1
  • 11. 11 • • Server Compiler • Peak performance • Threshold set to 10 000 calls before compilation • More optimizations, more aggressive and advanced C2
  • 12. 12 • • Start with interpreter and Statistics gathering (PGO) • Use stats to apply aggressive/optimistic optimizations: • Devirtualization (very important for Java) • Inlining (Mother-Of-All-Optimizations) • Exception handling elimination • Uncommon branch elimination • Null Check elimination • OnStack Replacement JVM Specific optimizations
  • 13. 13 • + Optimistic/PGO optimizations + Interpreter allow any fallback in case of issue and does not prevent execution even on startup. Allow also longer compilation phases => more optimized + instrumentation (Changing bytecode on the fly) - Warmup can be long (10,000 calls before kicking JIT) (Mitigation: configurable, Tiered Compilation) - Deoptimizations are STW JVM JIT Pros & Cons
  • 14. 14 • • JIT Released with 1.0 in 2002 but only 32bits • JIT 64 bits for .NET 2.0, more optimized for server, slower to compile • RyuJit x64 in .NET 4.6 (2015), Faster to compile with same level of optimizations CLR JIT History
  • 15. 15 • CLR JIT Machinery MyApp.exe list.Add("Foo") PreCode Stub Universal JIT thunk JIT push ebp mov bp, esp … ret
  • 16. 16 • • No interpreter, Execution is always with native code • Fast compile time • Compilation happening on the calling threads CLR JIT Characteristics
  • 17. 17 • + After first call, method is always fast (warmup short) and stable + Fast compile time + Value type support - Optimizations are not advanced and conservatives - Interface call dispatch has relatively high overhead and not inlinable CLR JIT Pros & Cons
  • 18. GC
  • 19. 19 • + Simplify memory management (including some Lock-free algorithms) + Fast allocation + Reduce Fragmentation + Can be cache friendly - unpredictable Stop-The-World Pauses - hard to tune GC Pros & cons
  • 20. 20 • • Serial • Parallel • Concurrent Mark & Sweep • G1 • Azul’s C4 • Shenandoah • Z JVM GC Algorithms
  • 21. 21 • • Maximum heap need to be fixed • Minor GC triggered by young gen being full • Lot of options for tuning (too much?) JVM GC Characteristics
  • 22. 22 • JVM GC Layout
  • 23. 23 • JVM GC Layout
  • 24. 24 • + Large choice of algorithms adapted to workload + Few or no fragmentation (often compacting) +/- Fine Control/Tuning - Pause time can be large JVM GC Pros & Cons
  • 25. 25 • • Workstation • STW • Background • Server • STW • Background CLR GC Algorithms
  • 26. 26 • CLR GC Layout Gen2 Gen1 Segment Gen0
  • 27. 27 • • Total heap sized depends on physical memory available • GC triggered based on a estimated allocation budget per generation • Leverage the non-fixed size of generation to adjust them • On each GC a plan phase determines if a compacting phase is required • Large Object Heap (>85,000B) • No option, auto-tuning CLR GC Characteristics
  • 28. 28 • + Pause time relatively short + Suits interactive apps mostly, with small/medium heap +/- Almost No Control/Tuning - Fragmentation/FreeLists - Pinned Objects CLR GC Pros & Cons
  • 30. 30 • • Command line tools: • Thread Dump: jstack, jcmd • Heap Dump & Class Histogram: jmap, jcmd • GC: jstat, jcmd, GC logs • Config: jinfo, jcmd • Monitoring/Profiling/Analysis tools: • Jconsole • VisualVM • Mission Control • MXBeans JVM troubleshooting
  • 31. 31 • • Command line tools: • Thread Dump: procdump • Heap Dump, Class Histogram: procdump • GC: PerfCounters/ETW events • Monitoring/Profiling/Analysis tools: • WinDBG + SOS/SOSEX • Visual Studio • ETW events • PerfView CLR troubleshooting
  • 33. 33 • • Common Design goals • Runtime • Hardware abstraction • Memory safety • JIT differences • JVM: Hybrid interpreter/compiled • CLR: First execution compilation • GC differences • JVM: Compacting, highly tunable, many choices • CLR: auto-tunable, Free Lists, Pinned object • Tooling • JVM: many tools, OS independent • CLR: raw tools, OS dependent CLR/JVM
  • 35. 35 • • Just-In-Time compilation Wikipedia • Just-In-Time Compilers from Java 1.1 Unleashed • PC Mag April 23 ’96 • Combining Analyses, Combining Optimizations - Cliff Click ‘s PhD thesis • Combining Analyses, Combining Optimizations – Summary • Design of the Java HotSpot Client Compiler for Java 6 • The Java HotSpot Server Compiler • Null Check elimination • Black Magic of (Java) Method Dispatch • Virtual Call 911 • JIT Watch References JVM JIT
  • 36. 36 • • Java Garbage Collection Distilled • The Java GC mini book • Oracle’s white paper on JVM memory management & GC • CMS phases • G1 One Garbage Collector to rule them all • Tips for Tuning The G1 GC • G1 Garbage Collector Details and Tuning by Simone Bordet • C4 Algorithm paper • Shenandoah: The Garbage Collector That Could by Aleksey Shipilev • ZGC - Low Latency GC for OpenJDK References JVM GC
  • 37. 37 • • jmap • jstack • jcmd • jinfo • jstat • Understanding GC logs • Java Mission Control • Using the Platform MBean Server and Platform MXBeans References JVM tooling
  • 38. 38 • • JIT Optimizations • TieredCompilation in .NET Core • RyuJIT: The next-generation JIT compiler for .NET • RyuJIT Overview • Managed Profile-Guided Optimization Using Background JIT • .NET Just in Time Compilation and Warming up Your System • Performance decrease when using interfaces • Virtual Stub Dispatch • Simple devirtualization • Collect Optimization Candidates for Using Intel Hardware Intrinsics in mscorlib • sharplab.io References CLR JIT
  • 39. 39 • • Maoni’s blog • Garbage Collection Design • Learning How Garbage Collectors Work • GC Pauses and Safe Points • Back to basics: Generational Garbage Collector • Garbage Collector Basics and Performance Hints • Fun with .NET GC, Paging, Generations and Write Barriers References CLR GC
  • 40. 40 • • Analysing .NET Memory Dumps with CLR MD • Analysing Pause times in the .NET GC • CLR MD Going beyond SOS • Intro to WinDBG for .NET developers • SOS.dll • SOSEX • CLR ETW Events References CLR tooling

Editor's Notes

  • #2: Pitch: At Criteo we are using both .NET CLR runtime and JVM one. At first look it seems there are very similar: a bytecode, a JIT, a GC, … but in fact there is some differences in the implementation and in the vision of the targeted applications and their requirements Let’s dig into those differences with the pros & cons
  • #5: Native executables: on excutables for each target (OS, CPU instructions)
  • #6: A Runtime can abtract away this with a unified intermediate representation (ByteCode/IL) Can abstract OS API and format Can use specific instructions
  • #19: GC does not imply Runtime. Can have a GC on natively compiled language, however compacting is very difficult (ref updating) without runtime to abstract away addresses