WUG_UK_JVM_20080303_2

Download Report

Transcript WUG_UK_JVM_20080303_2

IBM Java Technology Centre
Exploring IBM Java 6 - New
Features and Enhancements
Trent Gray-Donald
Senior Technical Staff Member –
Java Virtual Machine
March 4, 2008
© 2008 IBM Corporation
IBM Java Technology Centre
Goal
What’s in It for You?
Learn about IBM’s Java™ Virtual Machine
(JVM™) offerings, see what’s improved
technically on the way to Java platform
v.6, and have a peek at some of our
serviceability tools.
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Agenda
History and Architecture
Java Platform v.6—What’s New This Release?
Java 5 platform updates
Java 6 class library updates
JVM Software
Garbage Collection
JIT
Shared Classes
Serviceability Update
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Agenda
History and Architecture
Java Platform v.6—What’s New This Release?
Java 5 platform updates
Java 6 class library updates
JVM Software
Garbage Collection
JIT
Shared Classes
Serviceability Update
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
IBM and Java
 Java is critically important to IBM
– As an fundamental infrastructure for our own software portfolio including WebSphere
and Rational products.
 IBM is investing strategically in Java and in virtual machines
– The transition to our next generation virtual machine base was completed
successfully in the Java SE 5.0 release.
– We expect to accelerate innovation in performance, reliability and serviceability
going forward.
 IBM is also looking to engender accelerated public innovation
in Java
– Support of Eclipse, Apache (XML, Derby, Geronimo, Harmony, Tuscany, …)
– Broad participation in relevant open standards bodies such as JCP, OSGi
5
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
IBM’s Approach to Java Technology
Quality Engineering
Performance
Security
Reliability
Serviceability
Reference
Java
Technology
(Sun, OSS,
Others)
IBM Java
Technology
Centre
IBM
Java
 Listen to and act upon market
requirements
 World class service and support
 Available on more platforms than any
other Java implementation
 Highly optimized
 Embedded in IBM’s middleware
portfolio and available to ISV partners
Production Requirements
IBM Software Group
IBM eServer
ISVs
IBM Clients
6
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Design Philosophy and Architecture





Current offerings based on the J9 Virtual Machine
– 3rd generation JVM software from IBM
– Designed from the ground up to be a scalable solution for
embedded, desktop, and server class hardware
Common code base for all Java Platform, Micro Edition
(Java ME platform) and Java Platform, Standard Edition
(Java SE platform) products
– Highly configurable—pluggable interfaces with different
implementations depending on the target market
Class library independence
Supports latest language features (Java SE v.6)
Scaling to available hardware
– Wide range—“from a watch to a mainframe”
– Portable, configurable, flexible
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java Application Code
Uses 1 of many possible
configurations
Java calls
Pluggable components
that dynamically load
into the virtual machine
Virtual Machine
JVM Profiler
Class loader
Debugger
Realtime Profiler
JIT
Thread Model
JNI
JavaSE 6
Java SE 5
CDC
MIDP
CLDC
Class
Library
JNI
Calls to
C
Libraries
Native
Applications
Interpreter
Exception handler
JCL Natives
Garbage collector
OS-Specific Calls
Port Library (file IO, sockets, memory allocation, etc.)
Operating System
JNI = Java Native Interface
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Agenda
History and Architecture
Java Platform v.6—What’s New This Release?
Java 5 platform updates
Java 6 class library updates
JVM Software
Garbage Collection
JIT
Shared Classes
Serviceability Update
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java 5.0 Language Features
 Compile-Time Type Safety with Generics
– Similar to C++ templates
– e.g. Vector<String>
 Extended Syntax for for loops
– Makes iterating over collections easier. Similar to for each in other languages.
– void cancelAll(Collection<Tasks> tasks) {
for (Task t : tasks)
t.cancel(); }
 Auto-Boxing of Primitive Types
– Automatic conversion of primitive types (e.g. int) to boxed equivalent (e.g.
java.lang.Integer).
 Typesafe Enumerations
– An alternative to static, final constants.
– e.g. enum Seasons { WINTER, SPRING, SUMMER, FALL}
 Annotations: Language Metadata
– Modifiers can be added to most language elements, and is available at runtime.
– Allows semantic markup of programs for documentation, registration, etc.
 Library enhancements for concurrency, management, JVMTI
10
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java Platform v.6
All that’s new…

Standard Java SE platform v.6 class library enhancements
– java.util.concurrent updates (and lock monitoring)
– Collections framework
– Java.lang.instrument – class redefinition

Base JVM technology enhancements
– JVM Tool Interface 1.1 (multiple agents,
better heap iterator API, instrumentation of native methods…)
– Class loading performance boost
– New class file data improves verification time
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
java.util.concurrent
Great performance opportunities…
 Building scalable data structures is HARD… really hard!
– Need to deeply understand concurrency and thread models.
– Low level hardware details dramatically affect performance
– Bugs are typically hard to shake out and irreproducible.
 Java now provides very solid building blocks
– Task scheduling (Executor framework)
– Concurrent collections (fast and scalable implementations of Map, List, Queue)
– Atomic variables (atomic math ops such as increment, test and set.)
– More variety in locking operations (tryEntry, multiple condvars)
 Please use these libraries! (for everyone’s sanity.)
12
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Testarossa JIT: Dynamic, adaptive, optimizing compiler
 Dynamic
– Triggered at runtime based on projected profitability of compilation
– Compiled methods can be freely intermixed with interpreted callers/callees
– May have multiple versions of methods built with different levels of optimization
 Adaptive
– Sensitive to need for program to have CPU (e.g. throttled during startup, runs on
asynchronous thread )
– Able to profile program to retrieve common control paths or data values
– Profile information used in subsequent re-optimizing compilation step
 Optimizing
– Comprehensive collection of conventional optimizations
– control flow simplification, data flow analysis
– Speculative and Java-specific optimizations
– e.g.. devirtualization, partial inlining, lock coarsening
– Tuned code generation for latest x86, Power, zArchitecture and more
– e.g.. instruction selection, instruction scheduling, register allocation
13
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java Platform v.6
Just In Time (JIT) Compiler updates


POWER 6® and IBM System z10™ exploitation
Inliner and basic block layout improvements
–

Lock reservation (IBM paper at OOPSLA ’02)
–

Determine what’s hot, what’s not (common path analysis)
Improves scaling and overall performance
Dozens of platform dependent and independent optimizations
implemented, (e.g., new register allocators, live range reduction,
idiom recognition)
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java Platform v.6
Garbage Collector (GC) modes
 -Xgcpolicy:optthruput (default)
–
–
–
–
My applications is designed around raw throughput and some GC pause is acceptable.
There is little intermingling of garbage collection and application work – better raw throughput.
The application is stopped each time garbage is collected.
Start here for tuning.
 -Xgcpolicy:gencon
– My application allocates many short-lived objects.
– The heap space is fragmented.
– My application is transaction-based (that is, objects in the transaction don't survive beyond the
transaction commit).
 -Xgcpolicy:optavgpause
– My application cannot tolerate the length of the GC pauses. A degradation in performance is
acceptable as long as the GC pause time is reduced.
– I am running on a 64-bit platform and use a very large heap -- more than 3 or 4GB.
– My application is a GUI application and I'm concerned about the user response times.
 -Xgcpolicy:subpool
•
15
I have scalability problems on large multiprocessor machines.
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Memory Management and Garbage Collection
How the IBM J9 generational garbage collector works
Nursery/Young Generation
IBM J9:
• Xmn (-Xmns/-Xmnx)
Sun:
• XX:NewSize=nn
• XX:MaxNewSize=nn
• Xmn<size>


16
Old Generation
IBM J9:
• Xmo (-Xmos/-Xmox)
Sun:
• XX:NewRatio=n
Permanent Space
Sun JVM Software Only:
• XX:MaxPermSize=nn
Minor collection—takes place only in the young generation,
normally done through direct copying => very efficient
Major collection—takes place in the new and old generation
and uses the normal mark/sweep (+compact) algorithm
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java Platform v.6
Garbage Collector (GC) updates


Significantly faster classLoader load/unload performance and improved footprint
Hierarchical Scanning—faster, memory hierarchy aware optimization for—
Xgcpolicy:gencon. Paper in ISMM ’06 (Siegwart and Hirtzel)
– Challenge: improving locality
– Commercial workloads spend 45% stalled in memory requests.
– Copying GC can improve object ordering, co-locating
objects on the same page or cache line
– While maintaining scalability…
– Parallelism and workload balancing is essential
for server workloads
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Parent-Child Distances for Hierarchical
(SPECjbb2005)
30%
Proportion
25%
Breadth-First
Hierarchical
20%
15%
10%
5%
0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
64 byte
cache line
page size (4 kB)
18
Scanned Slot to Copied Object Distance
(Log2)
– less TLB misses, less L2 cache misses
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Understanding Heap Sizes
GC resizes heap based on occupancy
and duration stats
free
-Xmx = max
-Xms = initial
occupied
Occupancy Constraint:
30%* < free < 60%*
-Xminf < free < -Xmaxf
Duration Constraint:
5%* < duration < 13%*
-Xmint < duration < -Xmaxt
Adjustment Size:
1Mb* < adjustment < ∞*
-Xmine < adjustment < -Xmaxe
Hint: Use -verbose:sizes to see defaults for your platform, * denotes default
19
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Garbage collection -Xgcpolicy:gencon changes
Allocate Space
-Xmns
Old Survivor
Generation
Startup state
-Xmns
Allocate Space
Survivor
-Xmnx



20
Reserved but unallocated
Old Generation
Maximal state
Removed 64mb cap on default new space size.
Default maximum value of –Xmns and –Xmnx is now 25% heap.
ONLY applies if you specify –Xgcpolicy:gencon
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Java Platform v.6—Shared Classes
Overview



Target: server environments where multiple
JVM implementations exist on the same box
Goal: improve startup time and memory footprint
Sharing of common data
–

For classes, granularity is .class file
Multiple sharing strategies
–
Standard classloaders (including application Classloader) exploit the feature
when enabled
–
API to extend custom ClassLoaders available
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Shared Classes – details
 Please attend Ben Corrie’s talk immediately following this one for
many more details on what they are, how to use them, and when…
22
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Customer Feedback
Resulting in Process Changes



23
Java platform v.5 and before => closed beta program
Java platform v.6 => open early access program
Move to iterative development model
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Agenda
History and Architecture
Java Platform v.6—What’s New This Release?
Java 5 platform updates
Java 6 class library updates
JVM Software
Garbage Collection
JIT
Shared Classes
Serviceability Update
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Reliability, Availability, and Serviceability
RAS strategy

Centralization of tools
– Central customer visible repository of supported, maintained tools

– Extensible, open tools, with programmable extension interfaces
Tools must be usable everywhere
– GUI mode for interactive use

– Report generation for headless environments
Documentation
– Improvements to problem determination doc

– Aggregated search in IBM support assistant
Iterate!
– Tools being deployed very regularly—looking for customer feedback
25
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Reliability, Availability, and Serviceability
Improvements across releases

IBM Support Assistant™
–

Diagnostic Tool Framework For Java (DTFJ)
–

First stop analysis engine for common Java problems (OutOfMemoryError and
crashes)
Garbage Collection and Memory Visualizer (GCMV)
–

Presented at the 2006 JavaOneSM conference
DumpAnalyzer (using DTFJ)
–

Java platform 1.4.2, Java platform v.5, and Java platform v.6 plug-ins
Verbose GC visualization and analysis
Java Lock Analyzer (on alphaWorks)
–
Capture and visualize lock contention data.
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
27
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
GCMV—Heap Usage Visualization
Heap occupancy
Pause times
28
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
GCMV—Comparison and Advice
Compare runs…
Performance advisor…
29
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
GCMV—Tuning Recommendations
30
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Further Information

IBM JDK home page
–

IBM support assistant
–

https://www14.software.ibm.com/iwm/web/cc/earlyprograms/ibm/java6/
WebSphere® Real Time™
–
31
http://www.ibm.com/software/support/isa/
Early access program
–

http://www.ibm.com/developerworks/java/jdk/
http://www-306.ibm.com/software/webservers/realtime/
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Agenda Review
History and Architecture
Java Platform v.6—What’s New This Release?
Java 5 platform updates
Java 6 class library updates
JVM Software
Garbage Collection
JIT
Shared Classes
Serviceability Update
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation
IBM Java Technology Centre
Questions & Answers
© 2008 IBM Corporation
IBM Java Technology Centre
© IBM Corporation 2008. All Rights Reserved.
The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are
provided for informational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or
advice to any participant. While efforts were made to verify the completeness and accuracy of the information contained in this
presentation, it is provided AS IS without warranty of any kind, express or implied. IBM shall not be responsible for any damages arising
out of the use of, or otherwise related to, this presentation or any other materials. Nothing contained in this presentation is intended to,
nor shall have the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and
conditions of the applicable license agreement governing the use of IBM software.
References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which
IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion
based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any
way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken
by you will result in any specific sales, revenue growth or other results.
Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual
throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the
amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed.
Therefore, no assurance can be given that an individual user will achieve results similar to those stated here.
All customer examples described are presented as illustrations of how those customers have used IBM products and the results they
may have achieved. Actual environmental costs and performance characteristics may vary by customer.
The following are trademarks of the International Business Machines Corporation in the United States and/or other countries. For a
complete list of IBM trademarks, see www.ibm.com/legal/copytrade.shtml
AIX, CICS, CICSPlex, DB2, DB2 Universal Database, i5/OS, IBM, the IBM logo, IMS, iSeries, Lotus, OMEGAMON, OS/390, Parallel Sysplex,
pureXML, Rational, RCAF, Redbooks, Sametime, Smart SOA, System i, System i5, System z , Tivoli, WebSphere, and z/OS.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both.
Intel and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other
countries.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
Other company, product, or service names may be trademarks or service marks of others.
34
Java Overview | SE 6 Background and Update
© 2008 IBM Corporation