Home Page Icon
Home Page
Table of Contents for
OS threads
Close
OS threads
by Marcus Lagergren, Marcus Hirt
Oracle JRockit
Oracle JRockit
Oracle JRockit
Credits
Foreword
About the Authors
Acknowledgement
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Getting Started
Obtaining the JRockit JVM
Migrating to JRockit
Command-line options
System properties
Standardized options
Non-standard options
VM flags
Changes in behavior
A note on JRockit versioning
Getting help
Summary
2. Adaptive Code Generation
Platform independence
The Java Virtual Machine
Stack machine
Bytecode format
Operations and operands
The constant pool
Code generation strategies
Pure bytecode interpretation
Static compilation
Total JIT compilation
Mixed mode interpretation
Adaptive code generation
Determining "hotness"
Invocation counters
Software-based thread sampling
Hardware-based sampling
Optimizing a changing program
Inside the JIT compiler
Working with bytecode
Bytecode obfuscation
Bytecode "optimizers"
Abstract syntax trees
Where to optimize
The JRockit code pipeline
Why JRockit has no bytecode interpreter
Bootstrapping
Runtime code generation
Trampolines
Code generation requests
Optimization requests
On-stack replacement
Bookkeeping
Object information for GC
Source code and variable information
Assumptions made about the generated code
A walkthrough of method generation in JRockit
The JRockit IR format
Data flow
Control flow
A word about exceptions
JIT compilation
Generating HIR
MIR
LIR
Register allocation
Native code emission
Generating optimized code
A general overview
How does the optimizer work?
Controlling code generation in JRockit
Command-line flags and directive files
Command-line flags
Logging
Turning off optimizations
Changing the number of code generation threads
Directive files
Summary
3. Adaptive Memory Management
The concept of automatic memory management
Adaptive memory management
Advantages of automatic memory management
Disadvantages of automatic memory management
Fundamental heap management
Allocating and releasing objects
Fragmentation and compaction
Garbage collection algorithms
Reference counting
Tracing techniques
Mark and sweep
Stop and copy
Stopping the world
Conservative versus exact collectors
Livemaps
Generational garbage collection
Multi generation nurseries
Write barriers
Throughput versus low latency
Optimizing for throughput
Optimizing for low latency
Garbage collection in JRockit
Old collections
Nursery collections
Permanent generations
Compaction
Speeding it up and making it scale
Thread local allocation
Larger heaps
32-Bits and the 4-GB Barrier
The 64-bit world
Compressed references
Cache friendliness
Prefetching
Data placement
NUMA
Large pages
Adaptability
Near-real-time garbage collection
Hard and soft real-time
JRockit Real Time
Does the soft real-time approach work?
How does it work?
The Java memory API
Finalizers
References
Weak references
Soft references
Phantom references
Differences in JVM behavior
Pitfalls and false optimizations
Java is not C++
Controlling JRockit memory management
Basic switches
Outputting GC data
Set initial and maximum heap size
Controlling what to optimize for
Specifying a garbage collection strategy
Compressed references
Advanced switches
Summary
4. Threads and Synchronization
Fundamental concepts
Hard to debug
Difficult to optimize
Latency analysis
Java API
The synchronized keyword
The java.lang.Thread class
The java.util.concurrent package
Semaphores
The volatile keyword
Implementing threads and synchronization in Java
The Java Memory Model
Early problems and ambiguities
Immutability
JSR-133
Implementing synchronization
Primitives
Locks
Thin locks
Fat locks
A word on fairness
The lock word in JRockit
The Java bytecode implementation
Lock pairing
Implementing threads
Green threads
N x M threads
OS threads
Thread pooling
Optimizing threads and synchronization
Lock inflation and lock deflation
Recursive locking
Lock fusion
Lazy unlocking
Implementation
Object banning
Class banning
Results
Pitfalls and false optimizations
Thread.stop, Thread.resume and Thread.suspend
Double checked locking
JRockit flags
Examining locks and lazy unlocking
Lock details from -Xverbose:locks
Controlling lazy unlocking with — XX:UseLazyUnlocking
Using SIGQUIT or Ctrl-Break for Stack Traces
Lock profiling
Enabling lock profiling with -XX:UseLockProfiling
JRCMD
Setting thread stack size using -Xss
Controlling lock heuristics
Summary
5. Benchmarking and Tuning
Reasons for benchmarking
Performance goals
Performance regression testing
Easier problem domains to optimize
Commercial success
What to think of when creating a benchmark
Measuring outside the system
Measuring several times
Micro benchmarks
Micro benchmarks and on-stack replacement
Micro benchmarks and startup time
Give the benchmark a chance to warm-up
Deciding what to measure
Throughput
Throughput with response time and latency
Scalability
Power consumption
Other issues
Industry-standard benchmarks
The SPEC benchmarks
The SPECjvm suite
The SPECjAppServer / SPECjEnterprise2010 suite
The SPECjbb suite
SipStone
The DaCapo benchmarks
Real world applications
The dangers of benchmarking
Tuning
Out of the box behavior
What to tune for
Tuning memory management
Heap sizes
The GC algorithm
Compaction
Tweaking System.gc
Nursery size
GC strategies
Thread local area size and large objects
Number of GC threads
NUMA and CPU affinity
Tuning code generation
Call profiling
Changing the number of optimization threads
Turning off code optimizations
Tuning locks and threads
Lazy unlocking
Enforcing thread priorities
Thresholds for inflation and deflation
Generic tuning
Compressed references
Large pages
Common bottlenecks and how to avoid them
The -XXaggressive flag
Too many finalizers
Too many reference objects
Object pooling
Bad algorithms and data structures
Classic textbook issues
Unwanted intrinsic properties
Misuse of System.gc
Too many threads
One contended lock is the global bottleneck
Unnecessary exceptions
Large objects
Native memory versus heap memory
Wait/notify and fat locks
Wrong heap size
Too much live data
Java is not a silver bullet
Summary
6. JRockit Mission Control
Background
Sampling-based profiling versus exact profiling
A different animal to different people
Mission Control overview
Mission Control server-side components
Mission Control client-side components
Terminology
Running the standalone version of Mission Control
Running JRockit Mission Control inside Eclipse
Starting JRockit for remote management
The JRockit Discovery Protocol
Running in a secure environment
Troubleshooting connections
Hostname resolution issues
The Experimental Update Site
Debugging JRockit Mission Control
Summary
7. The Management Console
A JMX Management Console
Using the console
General
The Overview
MBeans
MBean Browser
Triggers
Runtime
System
Memory
Threads
Advanced
Method Profiler
Exception Count
Diagnostic Commands
Other
JConsole
Extending the JRockit Mission Control Console
Summary
8. The Runtime Analyzer
The need for feedback
Recording
Analyzing JRA recordings
General
Overview
Recording
System
Memory
Overview
GCs
GC Statistics
Allocation
Heap Contents
Object Statistics
Code
Overview
Hot Methods
Optimizations
Thread/Locks
Overview
Threads
Java Locks
JVM Locks
Thread Dumps
Latency
Overview
Log
Graph
Threads
Traces
Histogram
Using the Operative Set
Troubleshooting
Summary
9. The Flight Recorder
The evolved Runtime Analyzer
A word on events
The recording engine
Startup options
Starting time-limited recordings
Flight Recorder in JRockit Mission Control
Advanced Flight Recorder Wizard concepts
Differences to JRA
The range selector
The Operative Set
The relational key
What's in a Latency?
Exception profiling
Memory
Adding custom events
Extending the Flight Recorder client
Summary
10. The Memory Leak Detector
A Java memory leak
Memory leaks in static languages
Memory leaks in garbage collected languages
Detecting a Java memory leak
Memleak technology
Tracking down the leak
A look at classloader-related information
Interactive memory leak hunting
The general purpose heap analyzer
Allocation traces
Troubleshooting Memleak
Summary
11. JRCMD
Introduction
Overriding SIGQUIT
Special commands
Limitations of JRCMD
JRCMD command reference
check_flightrecording (R28)
checkjrarecording (R27)
command_line
dump_flightrecording (R28)
heap_diagnostics (R28)
hprofdump (R28)
kill_management_server
list_vmflags (R28)
lockprofile_print
lockprofile_reset
memleakserver
oom_diagnostics (R27)
print_class_summary
print_codegen_list
print_memusage (R27)
print_memusage (R28)
print_object_summary
print_properties
print_threads
print_utf8pool
print_vm_state
run_optfile (R27)
run_optfile (R28)
runfinalization
runsystemgc
set_vmflag (R28)
start_flightrecording (R28)
start_management_server
startjrarecording (R27)
stop_flightrecording (R28)
timestamp
verbosity
version
Summary
12. Using the JRockit Management APIs
JMAPI
JMAPI examples
JMXMAPI
The JRockit internal performance counters
An example — building a remote version of JRCMD
Summary
13. JRockit Virtual Edition
Introduction to virtualization
Full virtualization
Paravirtualization
Other virtualization keywords
Hypervisors
Hosted hypervisors
Native hypervisors
Hypervisors in the market
Advantages of virtualization
Disadvantages of virtualization
Virtualizing Java
Introducing JRockit Virtual Edition
The JRockit VE kernel
The virtual machine image concept and management frameworks
Benefits of JRockit VE
Performance and better resource utilization
Getting rid of "Triple virtualization"
Memory footprint
Manageability
Simplicity and security
Constraints and limitations of JRockit VE
A look ahead—can virtual be faster than real?
Quality of hot code samples
Adaptive heap resizing
Inter-thread page protection
Improved garbage collection
Concurrent compaction
Summary
A. Bibliography
B. Glossary
Abstract syntax tree
Access file
Adaptive code generation
Adaptive memory management
Agent
Ahead-of-time compilation
Allocation profiling
AST
Atomic instructions
Automatic memory management
Balloon driver
Basic block
Benchmark driver
Biased locking
Bytecode
Bytecode interpretation
Call profiling
Card
Card Table
CAS
Class block
Class garbage collection
Client-side template
Cloud
Code generation queue
Color
Compaction
Compare and swap
Compressed references
Concurrent garbage collection
Conservative garbage collection
Constant pool
Continuous JRA
Control flow graph
CPU profiling
Critical section
Dead code
Deadlock
Deadlock detection
Design mode
Deterministic garbage collection
Diagnostic command
Double-checked locking
Driver
Editor
Escape analysis
Event
Event attribute
Event field
Event settings
Event type
Exact garbage collection
Exact profiling
Extension point
Fairness
Fat lock
Fragmentation
Free list
Full virtualization
GC heuristic
GC pause ratio
GC strategy
Generation
Generational garbage collection
Graph coloring
Graph fusion
Green threads
Guard page
Guest
Hard real-time
Hardware prefetching
Heap
HIR
Hosted hypervisor
Hypervisor
Inlining
Intermediate representation
Internal pointer
IR
Invocation counters
Java bytecode
Java Memory Model
JFR
JIT compilation
JMAPI
JMX
JMXMAPI
JRA
JRCMD
JRMC
JRockit
JRockit Flight Recorder
JRockit Memory Leak Detector
JRockit Mission Control
JRockit Runtime Analyzer
JSR
JSR-133
JSR-174
JSR-292
JVM Browser
Keystore
Lane
Large pages
Latency
Latency threshold
Lazy unlocking
LIR
Livelock
Livemap
Live object
Live set
Live Set + Fragmentation
Lock deflation
Lock fusion
Lock inflation
Lock pairing
Lock token
Lock word
Mark and sweep
Master password
MBean
MBean server
MD5
Memleak
Memory Model
Method garbage collection
Micro benchmark
MIR
Mixed mode interpretation
Monitor
Name mangling
Native code
Native hypervisor
Native memory
Native threads
Non-contiguous heaps
NxM threads
NUMA
Nursery
Obfuscation
Object header
Object pooling
Old space
On-stack replacement
Operative set
Optimization queue
Out of the box behavior
Overprovisioning
OS threads
Page protection
Parallel garbage collection
Paravirtualization
Password file
PDE
Perspective
Phantom References
Prefetching
Producer
Promotion
RCP
Read barrier
Real-time
Recording agent
Recording engine
Recursive lock
Reference compression
Reference counting
Reference decompression
Register allocation
Relational key
Rich client platform
Role
Rollforwarding
Root set
Run mode
Safepoint
Samples
Sample-based profiling
Semaphore
Server-side template
Soft real-time
Soft references
Software prefetching
Spilling
Spinlock
SSA form
Static compilation
Stop and copy
Stopping the world
Strong references
SWT
Synthetic attribute
Tab group
Tab group toolbar
Thin lock
Thread local allocation
Thread local area
Thread local heap
Thread pooling
Thread sampling
Throughput
TLA
Tracing garbage collection
Trampoline
Trigger action
Trigger condition
Trigger constraint
Trigger rule
Truststore
Virtualization
Virtual machine image
Volatile fields
Warm up round
Weak reference
Write barrier
Young space
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Overprovisioning
Next
Next Chapter
Page protection
OS threads
See
Native threads
.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset