Java Memory Model
- Program Counter Register
- VM Stack (StackFrame)
- Local Variables
- Operands Stack
- Frame Data
- Method’s name
- class
- return address
- Native Method Stack
- Method Area
- Heap
GC
How to:
- GC Root enumeration
- Safe Point
- Preepmtive Suspension
- Voluntary Suspension - make every thread check a markword periodically
- Safe Region (much longer safe-point)
- RememberedSet & Card Table
- to solve cross generation reference problem
- Writer Barrier
- Concurrent Reachable Analysis
Three Metrics:
- footprint (memory)
- throughput
- latency
G1GC
Steps
- Initial Marking (STW)
- Concurrent Marking
- Final Marking (STW)
- Live Data Counting and Evacuation (STW)
how to choose one garbage collector
-Xlog[:[selector][:[output][:[decorators][:output-options]]]]
- time
- uptime
- timemillis
- up timemillis
- up timenanos
- pid
- tid
- level
- tags
Performance Monitoring
- jmc
- jfr
- jps
- jstat
-gcutil 2874
- jinfo
- jmap
- jhat
- jstack