FOR MORE INFORMATION PLEASE CONTACT Xact Consulting A/S Arnold Nielsens Boulevard 68A DK-2650 Hvidovre +45 7023 0100 [email protected]www.xact.dk Enterprise Modernization Java on the Mainframe Javagruppen, Copenhagen, 27th October 2015 Michael Erichsen, Xact Consulting A/S, [email protected]
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre
• Open the mainframe to a new generation of developers• Portability of applications• But also
– IBM wanted to confront Microsoft too– Microsoft exerted an aggressive dominance– Hard to imagine in these Apple, Google and Facebook times?– At that point in time it was ”EAM”: Everybody Against Microsoft
IBM has always been Competition driven
Why invent a mainframe whenyou made most of your moneyon selling small pieces ofcardboard?
Why invent a PC when you mademost of your money onmainframes?
– 2x hardware threads/core for improved throughput– Also available on zIIP and IFL
• Single Instruction Multiple Data (SIMD)– Vector processing unit– Accelerates loops and string operations
• Cryptographic Function (CPACF)– Improved performance of crypto co-processors
Virtualization
• Mainframe has excelled in virtual storage and machines sincethe 1960’es– Based on a set of civilized traffic rules in a multi-tenant system
• Java has its own Virtual Machine– Raised as a spoiled only child with no manners– Grabs all the storage it can immediately– Has been handled in different ways over time
• JVM on top of Virtual Storage on top of z/VM on top ofPR/SM...?
HPJ (”High Performance Java”)
• In the beginning it was impossible for IBM to make a JVMperform
• Initialization cost of a JVM: 20.000.000 instructíons• HPJ ran as a fully compiled Language Environment load module
– Performed like C (which is probably what it really was?)– Still humongeous startup cost
• Impossible for IBM to have their HPJ compiler support all thenew functionality pouring into Java (Only 1.1)
Reuse – Reset – Continuous...
• IBM switched focus to the JVM and tried various strategies• Reusable
– Keep the environment running for exactly the same program• Resettable
– Keep the JVM running, but reset the environment• Continuous
– More sharing, JIT• Since then
– Still more sharing, more threads, 64 bit
Garbage CollectionJava has no explicit allocationand deallocationDeallocation done as GarbageCollection
– All active objects marked andcopied away
– All unused deleted bycompacting storage
– Done in different pools tohandle short and long livedobjects separately
Garbage Collection Issues
• Pause time• Pause predictability• CPU usage• Memory footprint
– Virtual footprint– GC interaction with paging and
swapping• The unimaginable memory leaks
– Unintended object retention
IBM JVM Garbage Collection Policies
• Four GC policies – optimized for different scenarios– -Xgcpolicy:optthruput
• For “batch” type apps
– -Xgcpolicy:optavgpause• For apps with responsiveness criteria
– -Xgcpolicy:subpools• Large systems with allocation contention
gencon• Generational & concurrent GC collector introduced with IBM JVM 1.5
– It does split the Java Heap space between nursery and tenured spaces– Nursery (YoungGen) space objects are collected separately via the scavenger GC
collector– Tenured space objects are collected via the global GC collector– The GC collector is concurrent and taking advantage of any multi physical cores
machine• Results:
– Reduced major collection frequency (Full GC)– Reduced Full GC elapsed time & pause time– Increase JVM throughput– Increase performance & capacity of your application
FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre
• Hardware has been optimized for Java• JVM has been optimized for z/OS• Still a number of challenges
– Sizing of heaps and underlying layers– Startup CPU usage– Batch
Heap Sizes
• Java heap size tuning is an art– Small heaps get filled up quickly => GC often– Large heaps holds a lot of objects => GC takes a long time (”Stop the
World”)– Need tools, measurements, statistics and tuning
• Java heaps lives on top of Language Environment heaps andz/OS virtual storage– LE heaps can be measured and tuned– Paging and swapping can be the result of overallocating heaps
Or you can just buy more Real Storage...
JVM startup overhead
A full scale two LPAR share-allclassic WebSphere ApplicationServer startup?!?
Time for a BIG cup of coffee...
IBM Heap Analyzer
IBM Health Center, GC Perspective
IBM Garbage Collection and Memory Visualizer
More Tools
• IBM Extensions for Memory Analyzer• IBM Interactive Diagnostic Data Explorer
– All available with ISA, IBM Support Assistant, at no separate cost
• Perhaps your favourite Monitor product has support?– Omegamon, TMON, Mainview, Sysview...
Batch
• BPXBATCH is the normal Unix Systems Services batchimplementation
• JZOS is a custom JVM launcher for z/OS– Built by 3rd party as Open Source– Bought by IBM and added to z/OS– Better Java support– Better DB2 interface
• “Modern batch” is a different story
FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre
• All Java tools can be used• Rational Developer for z has support for special API’s like JCICS• The IBM JVM is 100% compatible with Sun/Oracle from the
development side– Differences only in JVM implementation and in toolbox
Mixed Language Development
• OO COBOL was originally intended to redefine COBOL as an OOlanguage– This has been dropped to let OO and COBOL each do what they are best at
• OO COBOL remains as an interface to call COBOL from Java– Allows you to define classes with methods in Cobol– Create instances of Java and Cobol classes– Invoke methods on Java and Cobol objects– Write classes that inherit from Java or Cobol classes– Overload methods
Mixed Language Development• In Enterprise Cobol you can also invoke the Java Native Interface (JNI) to
obtain other Java-oriented capabilities• Function pointers for JNI services are in the JNI Environment Structure• New special register JNIEnvPtr• Linkage section
– COPY 'JNI.cpy'
• Procedure division– Set address of JNIEnv to JNIEnvPtr– Set address of JNINativeInterface to JNIEnv– Invoke aJavaObject 'someJavaMethod'– Invoke exceptionObject 'PrintStackTrace'
Storage Differences
• Storage is static in COBOL,HLASM, PL/I etc.
• Storage is dynamic in Java• You can call from Java to
COBOL with an area that hasnot yet been allocated by Java– Storage violations– Null pointer exceptions
Deployment
• OSGi has been added to CICS– Being extended to COBOL and
PL/I
• Elsewhere later?
Security
• EJBROLE– Member class for Enterprise Java
Beans authorization roles• GEJBROLE
– Grouping class for Enterprise JavaBeans authorization roles
• JAVA– Contains profiles that are used by
Java for z/OS applications toperform authorization checking forJava for z/OS resources