Oracle JRockit

Book description

Develop and manage robust Java applications with Oracle's high-performance Java Virtual Machine

  • Learn about the fundamental building blocks of a JVM, such as code generation and memory management, and utilize this knowledge to develop code you can count on
  • Realize the full potential of Java applications by learning how to apply advanced tuning and analysis
  • Work with the JRockit Mission Control 3.1/4.0 tools suite to debug or profile your Java applications
  • Learn the simplicity and performance benefits of virtualizing Java through JRockit Virtual Edition
  • Written by Marcus Hirt and Marcus Lagergren, founder members of Appeal Virtual Machines, the company that created the Java Virtual Machine: JRockit

In Detail

Oracle JRockit is one of the industry’s highest performing Java Virtual Machines. Java developers are always on the lookout for better ways to analyze application behavior and gain performance. As we all know, this is not as easy as it looks. Welcome to JRockit: The Definitive Guide.

This book helps you gain in-depth knowledge of Java from the JVM’s point of view. We will explain how to write code that works well with the JVM to gain performance and scalability. Starting with the inner workings of the JRockit JVM and finishing with a thorough walkthrough of the tools in the JRockit Mission Control suite, this book is for anyone who wants to know more about how the JVM executes your Java application and how to profile for better performance.

Table of contents

  1. Oracle JRockit The Definitive Guide
    1. Table of Contents
    2. Oracle JRockit
    3. Credits
    4. Foreword
    5. About the Authors
    6. Acknowledgement
    7. About the Reviewers
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Errata
        2. Piracy
        3. Questions
    9. 1. Getting Started
      1. Obtaining the JRockit JVM
      2. Migrating to JRockit
        1. Command-line options
          1. System properties
          2. Standardized options
          3. Non-standard options
            1. VM flags
        2. Changes in behavior
      3. A note on JRockit versioning
      4. Getting help
      5. Summary
    10. 2. Adaptive Code Generation
      1. Platform independence
      2. The Java Virtual Machine
        1. Stack machine
        2. Bytecode format
          1. Operations and operands
          2. The constant pool
      3. Code generation strategies
        1. Pure bytecode interpretation
        2. Static compilation
        3. Total JIT compilation
        4. Mixed mode interpretation
      4. Adaptive code generation
        1. Determining "hotness"
          1. Invocation counters
          2. Software-based thread sampling
          3. Hardware-based sampling
        2. Optimizing a changing program
      5. Inside the JIT compiler
        1. Working with bytecode
          1. Bytecode obfuscation
        2. Bytecode "optimizers"
          1. Abstract syntax trees
        3. Where to optimize
      6. The JRockit code pipeline
        1. Why JRockit has no bytecode interpreter
        2. Bootstrapping
        3. Runtime code generation
          1. Trampolines
          2. Code generation requests
          3. Optimization requests
          4. On-stack replacement
          5. Bookkeeping
            1. Object information for GC
            2. Source code and variable information
            3. Assumptions made about the generated code
        4. A walkthrough of method generation in JRockit
          1. The JRockit IR format
            1. Data flow
            2. Control flow
            3. A word about exceptions
          2. JIT compilation
            1. Generating HIR
            2. MIR
            3. LIR
            4. Register allocation
            5. Native code emission
          3. Generating optimized code
            1. A general overview
            2. How does the optimizer work?
      7. Controlling code generation in JRockit
        1. Command-line flags and directive files
          1. Command-line flags
            1. Logging
            2. Turning off optimizations
            3. Changing the number of code generation threads
          2. Directive files
      8. Summary
    11. 3. Adaptive Memory Management
      1. The concept of automatic memory management
        1. Adaptive memory management
        2. Advantages of automatic memory management
        3. Disadvantages of automatic memory management
      2. Fundamental heap management
        1. Allocating and releasing objects
        2. Fragmentation and compaction
      3. Garbage collection algorithms
        1. Reference counting
        2. Tracing techniques
          1. Mark and sweep
          2. Stop and copy
        3. Stopping the world
          1. Conservative versus exact collectors
          2. Livemaps
        4. Generational garbage collection
          1. Multi generation nurseries
          2. Write barriers
        5. Throughput versus low latency
          1. Optimizing for throughput
          2. Optimizing for low latency
        6. Garbage collection in JRockit
          1. Old collections
          2. Nursery collections
          3. Permanent generations
          4. Compaction
      4. Speeding it up and making it scale
        1. Thread local allocation
        2. Larger heaps
          1. 32-Bits and the 4-GB Barrier
          2. The 64-bit world
            1. Compressed references
        3. Cache friendliness
          1. Prefetching
          2. Data placement
        4. NUMA
        5. Large pages
        6. Adaptability
      5. Near-real-time garbage collection
        1. Hard and soft real-time
        2. JRockit Real Time
          1. Does the soft real-time approach work?
          2. How does it work?
      6. The Java memory API
        1. Finalizers
        2. References
          1. Weak references
          2. Soft references
          3. Phantom references
        3. Differences in JVM behavior
      7. Pitfalls and false optimizations
        1. Java is not C++
      8. Controlling JRockit memory management
        1. Basic switches
          1. Outputting GC data
          2. Set initial and maximum heap size
          3. Controlling what to optimize for
          4. Specifying a garbage collection strategy
        2. Compressed references
        3. Advanced switches
      9. Summary
    12. 4. Threads and Synchronization
      1. Fundamental concepts
        1. Hard to debug
        2. Difficult to optimize
          1. Latency analysis
      2. Java API
        1. The synchronized keyword
        2. The java.lang.Thread class
        3. The java.util.concurrent package
        4. Semaphores
        5. The volatile keyword
      3. Implementing threads and synchronization in Java
        1. The Java Memory Model
          1. Early problems and ambiguities
            1. Immutability
          2. JSR-133
        2. Implementing synchronization
          1. Primitives
          2. Locks
            1. Thin locks
            2. Fat locks
            3. A word on fairness
            4. The lock word in JRockit
        3. The Java bytecode implementation
          1. Lock pairing
        4. Implementing threads
          1. Green threads
            1. N x M threads
          2. OS threads
            1. Thread pooling
      4. Optimizing threads and synchronization
        1. Lock inflation and lock deflation
        2. Recursive locking
        3. Lock fusion
        4. Lazy unlocking
          1. Implementation
          2. Object banning
          3. Class banning
          4. Results
      5. Pitfalls and false optimizations
        1. Thread.stop, Thread.resume and Thread.suspend
        2. Double checked locking
      6. JRockit flags
        1. Examining locks and lazy unlocking
          1. Lock details from -Xverbose:locks
          2. Controlling lazy unlocking with–XX:UseLazyUnlocking
        2. Using SIGQUIT or Ctrl-Break for Stack Traces
        3. Lock profiling
          1. Enabling lock profiling with -XX:UseLockProfiling
            1. JRCMD
        4. Setting thread stack size using -Xss
        5. Controlling lock heuristics
      7. Summary
    13. 5. Benchmarking and Tuning
      1. Reasons for benchmarking
        1. Performance goals
        2. Performance regression testing
        3. Easier problem domains to optimize
        4. Commercial success
      2. What to think of when creating a benchmark
        1. Measuring outside the system
        2. Measuring several times
        3. Micro benchmarks
          1. Micro benchmarks and on-stack replacement
          2. Micro benchmarks and startup time
        4. Give the benchmark a chance to warm-up
      3. Deciding what to measure
        1. Throughput
        2. Throughput with response time and latency
        3. Scalability
        4. Power consumption
        5. Other issues
      4. Industry-standard benchmarks
        1. The SPEC benchmarks
          1. The SPECjvm suite
          2. The SPECjAppServer / SPECjEnterprise2010 suite
          3. The SPECjbb suite
        2. SipStone
        3. The DaCapo benchmarks
        4. Real world applications
      5. The dangers of benchmarking
      6. Tuning
        1. Out of the box behavior
        2. What to tune for
          1. Tuning memory management
            1. Heap sizes
            2. The GC algorithm
            3. Compaction
            4. Tweaking System.gc
            5. Nursery size
            6. GC strategies
            7. Thread local area size and large objects
            8. Number of GC threads
            9. NUMA and CPU affinity
          2. Tuning code generation
            1. Call profiling
            2. Changing the number of optimization threads
            3. Turning off code optimizations
          3. Tuning locks and threads
            1. Lazy unlocking
            2. Enforcing thread priorities
            3. Thresholds for inflation and deflation
          4. Generic tuning
            1. Compressed references
            2. Large pages
      7. Common bottlenecks and how to avoid them
        1. The –XXaggressive flag
        2. Too many finalizers
        3. Too many reference objects
        4. Object pooling
        5. Bad algorithms and data structures
          1. Classic textbook issues
          2. Unwanted intrinsic properties
        6. Misuse of System.gc
        7. Too many threads
        8. One contended lock is the global bottleneck
        9. Unnecessary exceptions
        10. Large objects
        11. Native memory versus heap memory
      8. Wait/notify and fat locks
        1. Wrong heap size
        2. Too much live data
        3. Java is not a silver bullet
      9. Summary
    14. 6. JRockit Mission Control
      1. Background
        1. Sampling-based profiling versus exact profiling
        2. A different animal to different people
      2. Mission Control overview
        1. Mission Control server-side components
        2. Mission Control client-side components
        3. Terminology
        4. Running the standalone version of Mission Control
        5. Running JRockit Mission Control inside Eclipse
        6. Starting JRockit for remote management
          1. The JRockit Discovery Protocol
        7. Running in a secure environment
        8. Troubleshooting connections
          1. Hostname resolution issues
      3. The Experimental Update Site
      4. Debugging JRockit Mission Control
      5. Summary
    15. 7. The Management Console
      1. A JMX Management Console
      2. Using the console
        1. General
          1. The Overview
        2. MBeans
          1. MBean Browser
          2. Triggers
        3. Runtime
          1. System
          2. Memory
          3. Threads
        4. Advanced
          1. Method Profiler
          2. Exception Count
          3. Diagnostic Commands
        5. Other
          1. JConsole
      3. Extending the JRockit Mission Control Console
      4. Summary
    16. 8. The Runtime Analyzer
      1. The need for feedback
        1. Recording
      2. Analyzing JRA recordings
        1. General
          1. Overview
          2. Recording
          3. System
        2. Memory
          1. Overview
          2. GCs
          3. GC Statistics
          4. Allocation
          5. Heap Contents
          6. Object Statistics
        3. Code
          1. Overview
          2. Hot Methods
          3. Optimizations
        4. Thread/Locks
          1. Overview
          2. Threads
          3. Java Locks
          4. JVM Locks
          5. Thread Dumps
        5. Latency
          1. Overview
          2. Log
          3. Graph
          4. Threads
          5. Traces
          6. Histogram
        6. Using the Operative Set
      3. Troubleshooting
      4. Summary
    17. 9. The Flight Recorder
      1. The evolved Runtime Analyzer
        1. A word on events
        2. The recording engine
        3. Startup options
          1. Starting time-limited recordings
      2. Flight Recorder in JRockit Mission Control
        1. Advanced Flight Recorder Wizard concepts
      3. Differences to JRA
        1. The range selector
        2. The Operative Set
        3. The relational key
        4. What's in a Latency?
        5. Exception profiling
        6. Memory
      4. Adding custom events
      5. Extending the Flight Recorder client
      6. Summary
    18. 10. The Memory Leak Detector
      1. A Java memory leak
        1. Memory leaks in static languages
        2. Memory leaks in garbage collected languages
      2. Detecting a Java memory leak
      3. Memleak technology
      4. Tracking down the leak
        1. A look at classloader-related information
      5. Interactive memory leak hunting
      6. The general purpose heap analyzer
      7. Allocation traces
      8. Troubleshooting Memleak
      9. Summary
    19. 11. JRCMD
      1. Introduction
      2. Overriding SIGQUIT
        1. Special commands
      3. Limitations of JRCMD
      4. JRCMD command reference
        1. check_flightrecording (R28)
        2. checkjrarecording (R27)
        3. command_line
        4. dump_flightrecording (R28)
        5. heap_diagnostics (R28)
        6. hprofdump (R28)
        7. kill_management_server
        8. list_vmflags (R28)
        9. lockprofile_print
        10. lockprofile_reset
        11. memleakserver
        12. oom_diagnostics (R27)
        13. print_class_summary
        14. print_codegen_list
        15. print_memusage (R27)
        16. print_memusage (R28)
        17. print_object_summary
        18. print_properties
        19. print_threads
        20. print_utf8pool
        21. print_vm_state
        22. run_optfile (R27)
        23. run_optfile (R28)
        24. runfinalization
        25. runsystemgc
        26. set_vmflag (R28)
        27. start_flightrecording (R28)
        28. start_management_server
        29. startjrarecording (R27)
        30. stop_flightrecording (R28)
        31. timestamp
        32. verbosity
        33. version
      5. Summary
    20. 12. Using the JRockit Management APIs
      1. JMAPI
        1. JMAPI examples
      2. JMXMAPI
        1. The JRockit internal performance counters
        2. An example—building a remote version of JRCMD
      3. Summary
    21. 13. JRockit Virtual Edition
      1. Introduction to virtualization
        1. Full virtualization
        2. Paravirtualization
        3. Other virtualization keywords
        4. Hypervisors
          1. Hosted hypervisors
          2. Native hypervisors
          3. Hypervisors in the market
        5. Advantages of virtualization
        6. Disadvantages of virtualization
      2. Virtualizing Java
        1. Introducing JRockit Virtual Edition
          1. The JRockit VE kernel
        2. The virtual machine image concept and management frameworks
        3. Benefits of JRockit VE
          1. Performance and better resource utilization
            1. Getting rid of "Triple virtualization"
            2. Memory footprint
          2. Manageability
          3. Simplicity and security
        4. Constraints and limitations of JRockit VE
      3. A look ahead—can virtual be faster than real?
        1. Quality of hot code samples
        2. Adaptive heap resizing
        3. Inter-thread page protection
          1. Improved garbage collection
          2. Concurrent compaction
      4. Summary
    22. A. Bibliography
    23. B. Glossary
      1. Abstract syntax tree
      2. Access file
      3. Adaptive code generation
      4. Adaptive memory management
      5. Agent
      6. Ahead-of-time compilation
      7. Allocation profiling
      8. AST
      9. Atomic instructions
      10. Automatic memory management
      11. Balloon driver
      12. Basic block
      13. Benchmark driver
      14. Biased locking
      15. Bytecode
      16. Bytecode interpretation
      17. Call profiling
      18. Card
      19. Card Table
      20. CAS
      21. Class block
      22. Class garbage collection
      23. Client-side template
      24. Cloud
      25. Code generation queue
      26. Color
      27. Compaction
      28. Compare and swap
      29. Compressed references
      30. Concurrent garbage collection
      31. Conservative garbage collection
      32. Constant pool
      33. Continuous JRA
      34. Control flow graph
      35. CPU profiling
      36. Critical section
      37. Dead code
      38. Deadlock
      39. Deadlock detection
      40. Design mode
      41. Deterministic garbage collection
      42. Diagnostic command
      43. Double-checked locking
      44. Driver
      45. Editor
      46. Escape analysis
      47. Event
      48. Event attribute
      49. Event field
      50. Event settings
      51. Event type
      52. Exact garbage collection
      53. Exact profiling
      54. Extension point
      55. Fairness
      56. Fat lock
      57. Fragmentation
      58. Free list
      59. Full virtualization
      60. GC heuristic
      61. GC pause ratio
      62. GC strategy
      63. Generation
      64. Generational garbage collection
      65. Graph coloring
      66. Graph fusion
      67. Green threads
      68. Guard page
      69. Guest
      70. Hard real-time
      71. Hardware prefetching
      72. Heap
      73. HIR
      74. Hosted hypervisor
      75. Hypervisor
      76. Inlining
      77. Intermediate representation
      78. Internal pointer
      79. IR
      80. Invocation counters
      81. Java bytecode
      82. Java Memory Model
      83. JFR
      84. JIT compilation
      85. JMAPI
      86. JMX
      87. JMXMAPI
      88. JRA
      89. JRCMD
      90. JRMC
      91. JRockit
      92. JRockit Flight Recorder
      93. JRockit Memory Leak Detector
      94. JRockit Mission Control
      95. JRockit Runtime Analyzer
      96. JSR
      97. JSR-133
      98. JSR-174
      99. JSR-292
      100. JVM Browser
      101. Keystore
      102. Lane
      103. Large pages
      104. Latency
      105. Latency threshold
      106. Lazy unlocking
      107. LIR
      108. Livelock
      109. Livemap
      110. Live object
      111. Live set
      112. Live Set + Fragmentation
      113. Lock deflation
      114. Lock fusion
      115. Lock inflation
      116. Lock pairing
      117. Lock token
      118. Lock word
      119. Mark and sweep
      120. Master password
      121. MBean
      122. MBean server
      123. MD5
      124. Memleak
      125. Memory Model
      126. Method garbage collection
      127. Micro benchmark
      128. MIR
      129. Mixed mode interpretation
      130. Monitor
      131. Name mangling
      132. Native code
      133. Native hypervisor
      134. Native memory
      135. Native threads
      136. Non-contiguous heaps
      137. NxM threads
      138. NUMA
      139. Nursery
      140. Obfuscation
      141. Object header
      142. Object pooling
      143. Old space
      144. On-stack replacement
      145. Operative set
      146. Optimization queue
      147. Out of the box behavior
      148. Overprovisioning
      149. OS threads

      150. Page protection
      151. Parallel garbage collection
      152. Paravirtualization
      153. Password file
      154. PDE
      155. Perspective
      156. Phantom References
      157. Prefetching
      158. Producer
      159. Promotion
      160. RCP
      161. Read barrier
      162. Real-time
      163. Recording agent
      164. Recording engine
      165. Recursive lock
      166. Reference compression
      167. Reference counting
      168. Reference decompression
      169. Register allocation
      170. Relational key
      171. Rich client platform
      172. Role
      173. Rollforwarding
      174. Root set
      175. Run mode
      176. Safepoint
      177. Samples
      178. Sample-based profiling
      179. Semaphore
      180. Server-side template
      181. Soft real-time
      182. Soft references
      183. Software prefetching
      184. Spilling
      185. Spinlock
      186. SSA form
      187. Static compilation
      188. Stop and copy
      189. Stopping the world
      190. Strong references
      191. SWT
      192. Synthetic attribute
      193. Tab group
      194. Tab group toolbar
      195. Thin lock
      196. Thread local allocation
      197. Thread local area
      198. Thread local heap
      199. Thread pooling
      200. Thread sampling
      201. Throughput
      202. TLA
      203. Tracing garbage collection
      204. Trampoline
      205. Trigger action
      206. Trigger condition
      207. Trigger constraint
      208. Trigger rule
      209. Truststore
      210. Virtualization
      211. Virtual machine image
      212. Volatile fields
      213. Warm up round
      214. Weak reference
      215. Write barrier
      216. Young space
    24. Index

Product information

  • Title: Oracle JRockit
  • Author(s): Marcus Hirt, Marcus Lagergren
  • Release date: June 2010
  • Publisher(s): Packt Publishing
  • ISBN: 9781847198068