s109 cics-java

43
CICS Java – Beauty and the Beast Ian Burnett CICS - S109

Upload: nickgarrod

Post on 04-Aug-2015

55 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: S109 cics-java

CICS Java – Beauty and the Beast

Ian Burnett

CICS - S109

Page 2: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

• The information contained in this publication is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this publication, it is provided AS IS without warranty of any kind, express or implied. In addition, this information is based on IBM’s current product plans and strategy, which are subject to change by IBM without notice. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this publication or any other materials. Nothing contained in this publication 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.

• IBM, the IBM logo, and WebSphere are trademarks of International Business Machines Corporation in the United States, other countries, or both.

• Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.

Legal Disclaimer

Page 3: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Agenda

Page 4: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Java: An Overview

Page 5: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

A Brief History of Programming Languages

FORTRAN

COBOL

PL/I

C

C++

Oak Java

Smalltalk

Lisp

ALGOL

Page 6: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

What is Java and what makes it different?

Java is What makes Java different Java is NOT compiled to executable code, it is

compiled to bytecode that runs in a virtual machine The virtual machine uses the just-in-time compiler

(JIT) to execute the code Java is not based on programs, it is based on classes Java uses a garbage collector, that removes unused

objects from the storage Java development is often based on existing

programming patterns (Design Patterns) Encourages loose coupling between components Most of the build in funtionality of Java is based of

class libraries, that are build in the Java Runtime (JRE)

Java contains a library for user interface development Java has the ability to reflect about the runtime with

several methods Java has type-safe variable declaration Uses JNI for native system calls and JDBC for

database calls

Java is Object-oriented Platform-independent Broadly-supported and prevalent A state-of-the-art language [and an island in Indonesia] Something YOU should care about

Java is not Something new and unreliable An error-prone language The only solution for good code Independent on its own Something that only the distributed world should

care about Easy to write or fully-performant out of the box A composable workbox full of libraries

Page 7: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Traditional Applications

Page 8: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Executing a COBOL Program in CICS

•Load the program into storage from DASD

•Initialise a new Language Environment enclaveo ... ?

Page 9: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Language Environment (LE)

•Prior to LE, all languages brought their own runtime libraries

•Why now LE?

Page 10: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Executing a COBOL Program in CICS

•Load the program into storage from DASD

•Initialise a new Language Environment enclave

•Control is given to the application code

•Once the application ends it 'returns' to LE

Page 11: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Enclave Structure Within CICS

= CICS Region

= CICS initial transaction

= Main Transaction Programor EC LINKed Program

Page 12: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Storage in LE

Page 13: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Dispatching a Program in CICS

CIC

S A

/S

z/OSDispatcher

WEB WEB WEB WEB

GlobalSRB

TCB

ASCBTCB

OTETCB

OTE

WEB

TCBQR

CICSDispatcher

DFHSIP

LE Enclave

Application code

Page 14: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Anatomy of a Java Application

Page 15: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

jar file

Java package

Java packaging and hierarchy

•Classes contain data and logic

•Packages contain these classes and organize them

•Jar files contain the classes and are the base for applications and libraries

•At the runtime, there are just a lot of classes on a classpath

Java package

class files

Java package

class files

class files

Page 16: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

The Java Virtual Machine

•Java Virtual Machine (JVM)

•Run time data management is performed by the JVM

•The JVM will only stop if the last non-daemon thread finishes

•Platform-independence means that:o Java is never compiled to machine instructions upfronto Everything in Java is abstracted (including data types)

Page 17: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Java Runtime

JVM

OS and Hardware

Nat

ive

codeRuntime Libraries

Java Application

Page 18: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Bytecode and the JIT Compiler

Page 19: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Java Bytecode

•Developer writes application in Java

•Compiler converts to bytecode

•Bytecode is stored in jar files on disk

•JVM loads bytecode from disk

•... ?

Page 20: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Loading a Java Class

•Loading

•Linkingo Verifyingo Preparingo Resolving

•Initialising

Page 21: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Classpath and OSGi

Java VM

log4j

barcode4j

axis

batik

commons

derby

fop

ezmorph

freemarker

httpunit

jakarta

jcl

json

jdbm

jdom

jenks

jpos18

jython

looks

lucene

mail

mx4j

naming

jetty

poi

resolver

rome

serializer

servlets

tomcat

velocity

ws-commons

xalan

wsdl4j

xerces

xmlgraphics

xmlrpc

xmlapis

...

geronimo

bsh

bsf

guiapp

hhfacility

manufact.

marketing

minerva

accounting

assetmaint

base

bi

catalina

common

oagis

order

ebay

content

datafile

ecommerce

entity

googlebase

ofbiz

widget

minilang

party

pos.

product

workeffort

workflow

...

sunjce_prov.

plugin

jsse

jce

rt

dnsns

...

...ClassNot

FoundException

BeginHere

Page 22: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Comparing Java and bytecode

public int sum(int a, int b){ int result = 0; result = a + b; return result;}

public int sum(int, int); Code: 0: iconst_0 1: istore_3 2: iload_1 3: iload_2 4: iadd 5: istore_3 6: iload_3 7: ireturn

Page 23: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Executing Bytecode

•The JVM constructs for each Thread an execution engine

•In this engine the application now needs to be executed

•Interpreting bytecode is slow

Page 24: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Just In Time Compiler (JIT)

Java Application

JVM JIT

CompilerJ9

Interpreter

OS and Hardware

Page 25: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

JIT Operation

•Sampling process

•Multiple levels of optimisation

•Transparent to application and to CICS region

Page 26: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Java on z/OS

Page 27: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Differences on z/OS

IBM JDK for z/OS

Standard JSE(JDK specification)

z/OS Extensions

Just In Time Compiler (JIT)Exploitation of the Hardware Architecture

z/OS Operating System and System z Hardware

Page 28: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

An LE Enclave With Java

Page 29: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Recap: Dispatching a Program in CICS

CIC

S A

/S

z/OSDispatcher

WEB WEB WEB WEB

GlobalSRB

TCB

ASCBTCB

OTETCB

OTE

WEB

TCBQR

CICSDispatcher

DFHSIP

LE Enclave

Application code

Page 30: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Dispatching a Java Program in CICS

CIC

S A

/S

z/OSDispatcher

WEB WEB WEB WEB

GlobalSRB

TCB

ASCBT8 TCB T8 TCB

Enclave

WEB

TCBQR

CICSDispatcher

DFHSIP

LE Enclave

Application code

pthread

pthread

GC

JIT

JVM server

Page 31: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Garbage Collection

•All memory management is responsibility of JVM

•Periodically performs garbage collectiono Many approacheso Recommend using -Xgcpolicy:gencon for OLTP

•New objects created in the nursery area

•As objects age they are moved to the tenured area

Page 32: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Shared Classes

•Faster JVM start

•Faster application start

•Reduced memory consumption for multiple JVMs

Page 33: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Compressed References

•-Xcompressedrefs

Page 34: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Comparing COBOL and Java

Page 35: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Comparing COBOL to Java

Develop a COBOL program

Cobol does not know complex data types or objects Data elements are usually shared, not hidden The compile is performed done after coding (no

online syntax checking) Compiler performs fewer static tests Debugging is performed in multiuser environments Pointers to storage locations

Runtime Behaviour of Cobol

LE does not check whether the loaded program is corrupt

The runtime can not check whether the data is assigned correctly and Problems can arise

Handlers get control if something went wrong Memory is defined upfront

Develop a Java program

Data is structured in complex objects Variables are not shared, they are addressed by

methods of the object Compiles are executed every time a class is saved

(while ongoing syntax check is performed) Compiler performs a lot of static testing Debugging is usually performed locally Memory can NEVER be addressed directly

Runtime Behaviour of Java

The JVM checks the bytecode after loading the class Classes are checked during compilation and in

runtime data is only assigned if types match Classes and methods can throw exceptions if a

problem occurs New objects can be generated dynamically

Page 36: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Updating Programs – COBOL and Java

Update a COBOL Program in CICS

COBOL program is compiled/linked into a PDSe that is concatenated into the RPL upfront of the existing load library or to replace the existing version

In CICS issue a NEWCOPY or PHASEIN to let CICS reload the program from the dataset

Use the new program

Update a Java Program in CICS

In Java you can't replace runtime code Frameworks like OSGi enables the exchange of

bundles You need to decouple the application design (using

micro services in OSGi or accept a small outage

Problems with this Approach

Compatibility is a contract that is not checked until runtime

The connection is something the compiler is not aware of

Problems with this Approach

The simple PHASEIN or NEWCOPY is not possible A complex build infrastructure is necessary Only bundles/services, not classes can be “phased

in” A change in application development architecture is

necessary

Page 37: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Specialty Engines

Page 38: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

zAAP

•IBM System z Application Assist Processor

•Provides dedicated environment for execution of Java workloads and parsing of XML

•Available on:o zEnterprise EC12 / BC12o zEnterprise 196 / 114o System z10o System z9

•Superseded by zIIP on IBM z13

Page 39: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

zIIP

•IBM System z Integrated Information Processor

•Many IBM products exploit zIIP engines

•No IBM software charges on zAAP / zIIP capacity

•Available on all System z machines since System z9

•From z/OS 1.11: zAAP-on-zIIP

•Specialty engines always run full speedo Even on subcapacity machines

Page 40: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Moving Eligible Work to a zIIP

Eligiblework

Eligiblework

Eligiblework

Eligiblework

Eligiblework

Eligiblework

GCP zIIPGCP

Page 41: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Specialty Engines and the z/OS Dispatcher

GCP zAAP

CICSStart Java application

JVMMark as zAAP-eligible

z/OS DispatcherSuspend TCB on GCP

z/OS DispatcherDispatch TCB on zAAP

JVMExecution of byte code

JVMMark as zAAP-ineligible

z/OS DispatcherSuspend TCB on zAAP

z/OS DispatcherDispatch TCB on GCP

JVMReturn to CICS

CICSSubsystem code

Page 42: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109

Questions?

Page 43: S109 cics-java

© 2015 IBM Corporation CICS Java – Beauty and the Beast – S109