56
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]

Java on the Mainframe

Embed Size (px)

Citation preview

Page 1: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Java on the MainframeJavagruppen,

Copenhagen, 27th October 2015

Michael Erichsen,Xact Consulting A/S,

[email protected]

Page 2: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Introduction

Page 3: Java on the Mainframe

COBOL is Native to the Mainframe

Page 4: Java on the Mainframe

Java is also NativeIt was just born later

Page 5: Java on the Mainframe

Good or Bad?

Page 6: Java on the Mainframe

Old or New?

• OO is just a way to do somecategories of computing– Not something given to Moses

on tablets

• The first OO language, Simula,was formalized in 1962-1965

• COBOL was formalized in 1959-60

6

Page 7: Java on the Mainframe

When I’m Good I run your Payroll

Page 8: Java on the Mainframe

When I’m Bad you have overseen a ”.”

Page 9: Java on the Mainframe

When I’m good I run stuff like Watson

Page 10: Java on the Mainframe

When I’m Bad you’ll get a Null Pointer Exception

Page 11: Java on the Mainframe

Paradigm Shifts

11

Batch OLTP Client/Server WWW Mobile/IOT

Flat files Databases Relational NoSQL ...

Unstructuredmachine

instructions

Procedurallanguages

Objectoriented

Parallelprocessing ...

Page 12: Java on the Mainframe

IBM’s Competition

12

Burroughs,Univac, ICL,Honeywell...

Oracle,Tuxedo,Unikix

Sun, DEC,Microsoft

WebLogic,Tomcat

Apple,Google,Amazon

Burroughs,Univac, ICL,Honeywell...

Adabas,Datacom Oracle OSS ...

Burroughs,Univac, ICL,Honeywell...

MicrosoftBasic C# ... ...

Page 13: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Why Java?

Page 14: Java on the Mainframe

Sun wanted to confront Microsoft

• Killer hardware– The SPARC processor

• “An industrial-strength Smalltalk, written in C++“– Dropped C++– Dropped ObjectiveC– Then “Oak”– Then “Java”

• Lost the Browser war – strong on the server side – underconstant attack for security

Page 15: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Why Java on Mainframe

Page 16: Java on the Mainframe

Java on the Big Iron

• 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

Page 17: Java on the Mainframe

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?

Page 18: Java on the Mainframe

Which Runtimes? All of them!

• Batch– BPX– JZOS

• CICS– OSGi– Liberty– PHP– Mobile– Servlets– JSP– SAML– JDBC Type 4– JCICS

• DB2– SQLJ– JDBC type 2– JDBC type 4

• IMS– JMP– JDBC

• MQ– WMQ API– jms

• WAS– ”Classic”– Liberty

• zLinux

Page 19: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Development of Java on the Mainframe

Page 20: Java on the Mainframe

Mainframe Issues

• Processor technology• Virtualization• Changing implementations• Garbage Collection Policies

Page 21: Java on the Mainframe

Processor Technology

• Mainframe processors optimized for batch I/O and OLTP– Data intensive– ”Invisible” extra processors for I/O

• Java developed on the opposite types of processors– Numeric intensive

• IBM’s challenges– Change the processors to accomodate for Java– Adapt the JVM to IBM Hardware– Specialized processors for special tasks

Page 22: Java on the Mainframe

Processor Development

• Java is a very high priority for z series mainframes• The IBM hardware lab works hard to satisfy requirements from

the IBM Java lab• 1998 COBOL/Java performance were perhaps 1/200• 2015 it is close to even• New functionality tends to be implemented in Java before

other languages like COBOL and PL/I– New compiler technology, DWARF debugging

Page 23: Java on the Mainframe

Early steps

• GZIP accelleration in hardware• UTF conversion

– ”CONVERT UTF-16 TO UTF-8” is a single instruction!• Cryptograpic Instructions

– z/OS subsystem– Offloaded to crypto coprocessors

• XML z/OS subsystem• Each step then implemented in an IBM JVM version

– I recommend you always stay on the highest level of hardware and JVM!

Page 24: Java on the Mainframe

Z196

• Out-of-order pipeline design, larger cache structure, higherclock speed

• 70+ new instructions used by Java• Conditional-load/store• Non-destructive operands• Interlock facility update for better Java concurrency

Page 25: Java on the Mainframe

EC12• Hardware Transaction Memory (HTM)

– Better concurrency for multi-threaded applications eg. ~2X improvement to juc.ConcurrentLinkedQueue• Run-time Instrumentation (RI)

– Innovation new h/w facility designed for managed runtimes– Enables new expanse of JRE optimizations

• 2GB page frames (no zVM)– Improved performance targeting 64-bit heaps

• Pageable 1MB large pages using flash– Better versatility of managing memory

• New software hints/directives– Data usage intent improves cache management– Branch pre-load improves branch prediction

• New trap instructions– Reduce overhead of implicit bounds/null checks

Page 26: Java on the Mainframe

z13

• Java 8 improvements• Simultaneous Multi-Threading (SMT)

– 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

Page 27: Java on the Mainframe

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...?

Page 28: Java on the Mainframe

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)

Page 29: Java on the Mainframe

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

Page 30: Java on the Mainframe

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

Page 31: Java on the Mainframe

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

Page 32: Java on the Mainframe

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:gencon• Highly transactional workloads

– -Xgcpolicy:subpools• Large systems with allocation contention

Page 33: Java on the Mainframe

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

Page 34: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Challenges

Page 35: Java on the Mainframe

Challenges

• 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

Page 36: Java on the Mainframe

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

Page 37: Java on the Mainframe

Or you can just buy more Real Storage...

Page 38: Java on the Mainframe

JVM startup overhead

A full scale two LPAR share-allclassic WebSphere ApplicationServer startup?!?

Time for a BIG cup of coffee...

Page 39: Java on the Mainframe

IBM Heap Analyzer

Page 40: Java on the Mainframe

IBM Health Center, GC Perspective

Page 41: Java on the Mainframe

IBM Garbage Collection and Memory Visualizer

Page 42: Java on the Mainframe

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...

Page 43: Java on the Mainframe

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

Page 44: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Development

Page 45: Java on the Mainframe

Plain Java Development

• 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

Page 46: Java on the Mainframe

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

Page 47: Java on the Mainframe

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'

Page 48: Java on the Mainframe

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

Page 49: Java on the Mainframe

Deployment

• OSGi has been added to CICS– Being extended to COBOL and

PL/I

• Elsewhere later?

Page 50: Java on the Mainframe

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

Page 51: Java on the Mainframe

EJBROLE Examples

• ADMINISTRATOR• ADMINSECURITYMANAGER• BBNBASE.deployer• BBNBASE.CosNamingCreate• COSNAMINGCREATE• OPERATOR• IZUDFLT.*.izuUsers (G)

• isCallerInRole()• isUserInRole()

Page 52: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Economy

Page 53: Java on the Mainframe

Processor Economy

• IFL– Integrated Facility for Linux– Same processor, reduced price

• zIIP– System z Integrated Information Processor

Page 54: Java on the Mainframe

Contract Economy• zNALC

– System z New Application License Charges– Reduced price on LPAR with ”new workload” such as Java on WAS

• VUE– Value Unit Edition– One time charge for eligible workloads in such LPAR

• MWP– Mobile Workload Pricing for z/OS– Extra load must be documented

• This is not Java specific, but can improve your business case

Page 55: Java on the Mainframe

The Last Words

Page 56: Java on the Mainframe

FOR MORE INFORMATION PLEASE CONTACTXact Consulting A/SArnold Nielsens Boulevard 68ADK-2650 Hvidovre

+45 7023 [email protected]

Enterprise Modernization

Moderniza-tion

Conversion

Business

SoftwareConsultants