Sei sulla pagina 1di 35

®

IBM Software Group

Understanding CICS and Java

Shayla Robinson
CICS/390 Level 2 Support
December 1, 2005

WebSphere® Support Technical Exchange


IBM Software Group

Why Support Java in CICS?


ƒ Exploit existing infrastructure
 Extend use of existing applications
 Exploit new technologies
 Increase value of investment in CICS

ƒ Transform CICS into a powerful application server


 Provide path to e-business
 Ease development of new e-business applications

ƒ Some Benefits
 Simple and fast to program
 Robust
 Portable
 Easier application deployment and management

WebSphere® Support Technical Exchange 2


IBM Software Group

History of JVM Support in CICS


CICS TS 1.3 CICS TS 2.1 and 22
(end of support April 2006) (out of support)
ƒJDK 1.1.8 for OS/390 ƒSDK 1.3.1 for z/OS – exploiting the persistent JVM
ƒHigh Performance Java ƒHPJ support (migration only)
ƒJCICS ƒJPDA + Distributed Debugger
Java ƒJDBC 1.2 ƒJDBC 1.2 and 2.0
ƒJDBC access to IMS
ƒCICS Connector for CICS TS (CCF)

ƒWebSphere 4.0 distributed container


ƒWebSphere Application Assembly Tool (AAT)
ƒEJB 1.1 – session beans only)
EJB ƒJava Naming and Directory Interface (JNDI) 1.2
Lightweight Directory Access Protocol and
CORBA Object Services Naming service
ƒResource Manager for Enterprise Beans (RMEB)

ƒCORBA IIOP 1.0 Inbound only ƒIIOP 1.1 (inbound and outbound)
ƒCORBA 2.1 stateless objects
CORBA IIOP

IBM ƒVisualAge for Java v4 Enterprise Edition ƒWebSphere Studio Application Developer or
ƒEnterprise Developer V4 or V5
Development
Platform

WebSphere® Support Technical Exchange 3


IBM Software Group

History of JVM Support in CICS…con’t


CICS TS 2.3 CICS TS 3.1

ƒIBM SDK 1.4.1 for z/OS – exploits JVM shared ƒIBM SDK 1.4.2 for z/OS
class cache ƒService Oriented Architecture (SOA) exploitation
ƒHPJ support (migration only) ƒSOAP 1.1 and 1.2
Java ƒJCICS – new and enhanced classe s ƒWeb services support
ƒJDBC support ƒWS-Security capability
ƒCommon Client Interface (CCI) Connector 1.0 ƒWS-Atomic Transaction
ƒXML capability for COBOL and PL/I ƒWS-Coordination
ƒSOAP for CICS ƒWS-I Basic profile 1.0a
ƒWebSphere V4 & V5 AAT or WebSphere Studio ƒWebSphere Application Server v5.x ATK
ƒEJB 1.1 session beans only ƒEJB 1.1 session beans only
EJB ƒToleration of EJB 2.0 Java Archives ƒToleration of EJB 2.0 Java Archives

ƒIIOP 1.2 - enhanced authentication & encryption ƒHTTP 1.1 support (includes outbound API & URIMAPs)
ƒCORBA 2.3 stateless objects ƒCORBA 2.3 stateless objects
CORBA IIOP

IBM ƒWebSphere Studio Application Developer or ƒWebSphere Application Server V5 (WSED)


ƒEnterprise Developer V4 or V5 ƒXML Toolkit for z/OS v1.7
Development
Platform

WebSphere® Support Technical Exchange 4


IBM Software Group

Types of Programs to run in CICS TS


ƒ JCICS Programs
ƒ Native Java Programs (CORBA objects)
ƒ Enterprise Java Beans

JNDI z/OS
Serv er
tnameserv

CICS TS
J2EE RMI/IIOP
EJB
Client
SQ L/JDBC

DB2
JCICS COBOLCCI
Prog
PL/I Program
EXCI SQ L/JDBC
Client COBOL Prog Java
DPL Program

WebSphere® Support Technical Exchange 5


IBM Software Group

CICS Java Program Definition


CEDA View PROGram( DFJ$JTSC )
PROGram : DFJ$JTSC
Group : DFH$JVM
DEscription : JAVA TSQ program Common Class
Language : CObol | Assembler | Le370 | C
RELoad : No No | Yes
RESident : No No | Yes
USAge : Normal Normal | Transient
USElpacopy : No No | Yes
Status : Enabled Enabled | Disabled
RSl : 00 0-24 | Public
CEdf : Yes Yes | No
DAtalocation : Any Below | Any
EXECKey : User User | Cics
COncurrency : Threadsafe Quasirent | Threadsafe
REMOTE ATTRIBUTES
DYnamic : No No | Yes
REMOTESystem :
REMOTEName :
Transid :
EXECUtionset : Fullapi Fullapi | Dplsubset
JVM ATTRIBUTES
JVM : Yes No | Yes
JVMClass : examples.TSQ.Common
(Mixed Case) :
:
:
:
JVMProfile : DFHJVMPR (Mixed Case)
JAVA PROGRAM OBJECT ATTRIBUTES

WebSphere® Support Technical Exchange 6


IBM Software Group

Storage Protection for Java Programs


ƒ Pre-CICS TS 2.3, all Java ran in CICS key, using J8 TCBs
 EXECKEY on program definition ignored

ƒ CICS TS 2.3 and higher, JVMs can be in one of two


execution keys:
 CICS key 8 using an open J8 tcb
 User key 9 using an open J9 tcb

ƒ Extends benefits of storage protection to Java


 Consistent with other program language support
 Specified using EXECKEY() on the program definition
 Defaults to USER key if not specified
 J8 TCBs are used if storage protection is turned off

WebSphere® Support Technical Exchange 7


IBM Software Group

Java Program Control


ƒ Prior to CICS TS 2.3, a task could only have one JVM
associated with it
 It was not possible to link between two java programs directly
 It was not possible to link indirectly via one or more non-java
programs
 DPL to another java program was supported

ƒ CICS TS 2.3 or higher, multiple JVMs can now be used


within a single task
 Allows java to java links, enterprise beans to java and vice-versa
 Results in multiple J8 and/or J9 TCBs per task

WebSphere® Support Technical Exchange 8


IBM Software Group

TCB and JVM Pool Management


JVM pool
MAXJVMTCBS=5

ƒ Size of pull managed by CICS


JVM 1 JVM 2
MAXJVMTCBS (default is 5)
DFHJVMPR USERJVM1
CICS Key User Key

•Allocated to
a tas k
Availabl e for
reuse ƒ Allocate JVM from set by
J8 TCB J9 TCB
match with JVMProfile and
JVM 5
EXECKEY
JVM 3
DFHJVMPR
User Key DFHJVMCD

•Allocated to
User Key
ƒ CEMT and SPI commands
a tas k JVM 4 Availabl e for
J9 TCB
USERJVM1
reuse CEMT INQUIRE JVMPOOL
J9 TCB
CICS Key
CEMT SET JVMPOOL
•Allocated to
a tas k CEMT INQUIRE JVM
J8 TCB

WebSphere® Support Technical Exchange 9


IBM Software Group

Shared Class Cache


ƒ Multiple JVMs can share a single class cache
 JVM base classes (primordial)
 Trusted middleware classes
 Sharable application classes - user applications

ƒ JVMs in CICS
 Master JVM using a JM TCB
• One per CICS region
• Can be started at CICS startup
• Initializes and owns the shared class cache and JIT compiled code
 Worker JVM using J8/J9 TCBs
• Run Java applications and continuously reused
• Uses the classes loaded in the shared class cache
• Working storage for objects, static variables and non-shareable
classes
• Reduced storage footprint, startup time, and time for JVM reset
 Activated via CLASSCACHE=YES in JVM Profile

WebSphere® Support Technical Exchange 10


IBM Software Group

Benefits of Shared Class Cache


ƒ Classes are loaded once rather than once per JVM

ƒ Worker JVMS start up more quickly

ƒ Worker JVMs have smaller storage requirements

ƒ Improved startup times

ƒ JVM startup is a one off cost unless:


 A reset JVM is made unresettable
 JVM is stolen
 JVM has timed out through inactivity

WebSphere® Support Technical Exchange 11


IBM Software Group

Defining the shared class cache


Classcache JVM Profile DFHJVMCC

Classcache SIT Parameters JVMPROPS=/usr/lpp/cicsts/cicst s23/props/dfjjvmcc.props


LIBPATH=\
JVMCCSTART-YES /usr/lpp/cicsts/cicsts23/lib:\
JVMCCSIZE=64M /usr/lpp/cicsts/cicsts23/ctg:\
/usr/lpp/java/J1.4/bin:\
/usr/lpp/java/J1.4/bin/classic:\
/usr/lpp/db2/db2710/lib
STDIN=dfhjvmin
Classcache Properties STDOUT=dfhjvmout
STDERR=dfhjvmerr
dfhjvmcc.props #
# CLASSCACHE_MSGLOG=dfhjvmccmsg.log
# Properties for a Master JVM #
# ---------------------------- # Specify the CICS and JVM install locations
# Specify a classpath for Java classes that are # so that CICS can construct the trusted middleware
# CICS programs or Corba applications, but not EJB jars. # classpath automatically.
# If any EJB jars use other classe s not packaged in the CICS_DIRECTORY=/usr/lpp/cicsts/cicsts23/
# deployed jars themselves, they should be placed on this #
# classpath also. # Other Trusted middleware classpath.
ibm.jv m.shareable.application.class.path=\ #
/KMV/share/kmcvt_core.jar:\ # TMPREFIX=
/KMV/lib/wsatlib.jar:\ TMSUFFIX=/usr/lpp/db2/db2710/classe s/db2j2classe s.zip:\
/KMV/lib/wsif.jar:\ /usr/lpp/db2/db2710/classe s/db2jdbc.cursors:\
/KMV/wsif-j2c.jar:\ /usr/lpp/db2/db2710/classe s:\
/KMV/lib/wsdl4j.jar:\ /usr/lpp/cicsts/cicsts23/samples/ejb/bankaccount/eablib.jar:\
/KMV/lib/qname.jar:\ /usr/lpp/cicsts/cicsts23/samples/ejb/bankaccount/recjava.jar
/KMV/lib/marshall.jar:\ REUSE=RESET

WebSphere® Support Technical Exchange 12


IBM Software Group

Defining the worker JVMs to use shared class cache

CICS Program definition Jav a Profile DFHJVMPC

PROGRA M(k mcv trep) CLA SSCACHE=YES


GROUP(KMCVT)
DESCRIPTION(CICS IIOP Request Processor) #VERBOSE=NO
EXECKEY(USER)
JVM-ATTRIBUTES WORK_DIR=.
JVM(YES) INVOKE_DFHJVMA T=NO
JVMCLASS(com.ibm.cics.iiop.RequestProcessor) JVMPROPS=/usr/lpp/cicsts/cicsts23/props/dfjjv mpc.props
JVMPROFILE(DFHJVMPC) LIBPA TH=/usr/lpp/db2/db2710/lib
#
#
STDIN=dfhjv min
STDOUT=dfhjv mout
STDERR=dfhjv merr

WebSphere® Support Technical Exchange 13


IBM Software Group

JVM pool and Class Cache


JVM pool
MAXJVMTCBS=5

Shared
JVM 6 class
JVM 10
cache
USERJVM2
CICS Key
DFHJVMPC
User Key ƒ SIT Parameters
Availabl e for
•Allocated to JVMCCSIZE=xx
a tas k Master
reuse
J9 TCB JVM JVMCCSTART=AUTO|YES|NO
J8 TCB

DFHJVMCC
User Key

JVM 9 JVM 7

USERJVM1 DFHJVMPC
ƒ CEMT and SPI Interface
JM TCB
CICS Key User Key
CEMT PERFORM CLASSCACHE
•Allocated to JVM 8 Availabl e for
a tas k reuse CEMT INQUIRE CLASSCACHE
DFHJVMPR
J8 TCB User Key J9 TCB
CEMT SET CLASSCACHE
•Allocated to
a tas k
J9 TCB

WebSphere® Support Technical Exchange 14


IBM Software Group

The Single-Use JVMs


ƒ JVM is created for each request, Java application is run
there and then the JVM is thrown away

ƒ REUSE=NO in JVM profile


 Java property Xresettable=NO for migration only

ƒ Prevents actions of one Java program from interfering with


any other

ƒ JVM has single heap structure and does not undergo reset
processing

Create JVM Prog 1 Destroy JVM … Create JVM Prog n Destroy JVM

WebSphere® Support Technical Exchange 15


IBM Software Group

The Resettable JVM


ƒ Can be started and used to run consecutive Java
applications, resetting its storage areas between each
program invocation

ƒ REUSE=RESET in JVM profile


 Java property Xresettable=YES for migration only

ƒ Storage heap divided up into a number of areas, each with


own classloader
 Each area treated differently during reset processing

ƒ Highest level of protection from effects of an earlier


program invocation in the same JVM
Create JVM Prog 1 Reset JVM Prog 2 Reset JVM … Prog n Destroy JVM

WebSphere® Support Technical Exchange 16


IBM Software Group

The Continuous JVM


ƒ Potentially long lived JVM, which is started with a single
storage heap

ƒ REUSE=YES in JVM profile

ƒ Each Java program must either leave no static data around


when it terminates, or must restore these objects to an
initial state prior to completion

ƒ JVM not reset between program invocations

ƒ Highest level of performance. Less protection from effects


of an earlier program invocation in the same JVM
Create JVM Prog 1 Prog 2 Prog 3 … Prog n Destroy JVM

WebSphere® Support Technical Exchange 17


IBM Software Group

JVM Storage Management


LE Enclave

LE Enclave Fast Garbage Collection


Heap cleared
LE Enclave

Occasional garbage collection


A nchored objects liv e across reuses
Transient
Heap
(Xinitth)
No Garbage
Collection
Application
Class System
Middlew are System Heap
Heap (Xinitsh)
Heap
(Xms)
(Xinitacsh)

Reinitialized
on Reset

WebSphere® Support Technical Exchange 18


IBM Software Group

Tuning LE Enclave storage for JVMs

ƒ JVM LE enclave uses storage allocations set by CICS

ƒ Use user exit DFHJVMRO to modify default settings


 Assembler URM
 Invoked before invoking CEEPIPI to create new LE enclave for JM

A NYHEAP(4K,8176,,A NY,FREE)
BELOWHEA P(4096,2048,FREE)
HEA P(4M,1M,A NY,FREE,0K,4080)
CICS LIBS(8,900,FREE) LE
STACK(128K,128K,A NY,KEEP)
STORA GE(,,,0K)

WebSphere® Support Technical Exchange 19


IBM Software Group

Tuning JVM Storage


ƒ Aim is for only Garbage Collection to be CICS-scheduled
runs

ƒ CICS forces garbage collection


 MAX_RESETS_TO_GC in JVM profile
 Default is 100

ƒ Set VERBOSE=gc in the JVM profile

ƒ Check JVM log for message output by Garbage collection


 Located in file specified by STDERR (dfjvmerr by default))

ƒ Tune JVM size according to message issued

WebSphere® Support Technical Exchange 20


IBM Software Group

Garbage Collection Messages

Caused by CICS automatic request

<GC(32): GC cycle started Fri Jun 20 09:20:25 2003


<GC(32): freed 0 bytes from Transient Heap 100% free (523776/523776) and...>
<GC(32): freed 5676656 bytes, 56% free (7763712/13761024), in 12 ms>
<GC(32): mark: 10 ms, sweep: 2 ms, compact: 0 ms>
<GC(32): refs: soft 0 (age <= 32), weak 0, final 0, phantom 0>

Caused by heap expansion

<AF[7]: Allocation Failure. need 16400 bytes, 770 ms since last AF>
<AF[7]: managing allocation failure, action=3 (114624/9697792)>
<GC(8): need to expand mark bits for 13761024-byte heap>
<GC(8): expanded mark bits by 63488 to 215016 bytes>
<GC(8): need to expand alloc bits for 13761024-byte heap>
<GC(8): expanded alloc bits by 63488 to 215016 bytes>
<GC(8): need to expand FR bits for 13761024-byte heap>
<GC(8): expanded FR bits by 126976 to 430036 bytes>
<GC(8): expanded heap by 4063232 to 13761024 bytes, 30% free>
<AF[7]: completed in 1 ms>

WebSphere® Support Technical Exchange 21


IBM Software Group

Garbage Collection Messages…con’t

Caused by Allocation Failure

<AF[7]: Allocation Failure. Need 524 bytes, 1894 ms since last AF>
<AF[7]: managing allocation failure, action=3 (1962672/3471872)>
<GC(53): GC cycle started Fri Jun 6 07:13:12 2003
<GC(53): freed 114688 bytes from Transient Heap 96% free (507376/523776) and>
<GC(53): freed 247144 bytes, 62% free (2078744/3340800), in 6 ms>
<GC(53): mark: 5 ms, sweep: 1 ms, compact: 0ms>
<GC(53): refs: soft 0 (age <= 32), weak 0, final 0, phantom 0>
<AF[7]: completed in 7 ms>

Caused by Expansion request

GC[14]: Expanded System Heap by 65536 bytes


GC[14]: Expanded ACS Heap by 65536 bytes

WebSphere® Support Technical Exchange 22


IBM Software Group

Java Program Request Mapping


ƒ Requests to run Java programs are matched against the
current set of JVM resources
 Information in the program definition tells CICS the storage key
and the JVM Profile name that are to be used with the request

ƒ CICS looks for a JVM that has the same characteristics,


which is currently not assigned a task.
 If found then the new request is routed there
 If none are available, CICS will try and start a new JVM for the
request, unless the MAXJVMTCBS limit has been reached
 If the JVM pool is full, the request is placed onto a queue to wait
further selection processing
• Task suspended in JVM_POOL wait

ƒ Reduces number of JVM and TCB recycling

WebSphere® Support Technical Exchange 23


IBM Software Group

Recycling JVM pool members


ƒ In a full JVM pool not all JVMs may be assigned work

ƒ Idle JVMs can be recycled with options taken from another


JVM profile

ƒ If the storage key of a new program request does not


match then the JVM and its TCB have to be recreated

ƒ Recycling is expensive and CICS provides an intelligent


selection system to reduce the number of times this
occurs

WebSphere® Support Technical Exchange 24


IBM Software Group

In Summary
ƒ CICS continues to extend support for Java workloads

ƒ Java programs can use Storage protection

ƒ Classes can be shared between JVMs

ƒ Integrity and Performance addressed by different JVM


reuse modes

ƒ Program request matching provides optimized number of


JVM restarts

ƒ Multiple JVMs per CICS task now support

WebSphere® Support Technical Exchange 25


IBM Software Group

1-Setting up CICS for Java Support


ƒ Authorize CICS region access to HFS files & directories
 Assign a z/OS UNIX UID and GID to CICS regions
• OMVS segment in RACF database
 Grant CICS read, write and execute permission
• Work directory
• Directory used in any USEROUTPUTCLASS options
 Grant CICS read and execute permission
• CLASSPATH directories
• Shareable application class path
• LIBPATH
• Trusted middleware path
• Properties and profiles directory
• pickup directory
 Grant CICS exclusive read and write permission
• Shelf directory

WebSphere® Support Technical Exchange 26


IBM Software Group

2-Set up the JVM Profile…


ƒ Contains set of CICS and Java defined parameters for the
 HFS file in directory specified by SIT parameter
JVMPROFILEDIR
• Default is /usr/lpp/cicsts/cicsts23/JVMProfiles
 File name specified by JVMPROFILE in PROGRAM definition
• Case matters!
• Supplied sample files in JVMProfiles directory:
− DFHJVMCC-default profile to configure master JVM
− DFHJVMCD -for CICS supplied system programs only
− DFHJVMPC -default profile to configure resettable worker JVMs
-specifies REUSE=NO
− DFHJVMPR -default profile for resettable JVMs
(non- shared class cache)
-specifies REUSE=YES, CLASSCACHE=NO
− DFHJVMPS -default profile for single use JVM
-specifies REUSE=YES, CLASSCACHE=YES

WebSphere® Support Technical Exchange 27


IBM Software Group

The JVM Profile…con’t


ƒ Contains
 Program locations
• LIBPATH – location of run-time modules such as the JVM
• TMSUFFIX – location of the Trusted Middleware path
• CLASSPATH – location of Java applications

 CICS options
• WORK_DIR – location of this regions home directory
• STDIN, STDOUT, and STDERR
• CLASSCACHE setting
• JVM Reset values: REUSE={YES|NO|RESET}

 Java options
• JVMPROPS – HFS file containing JVM properties
• Storage Heap settings

WebSphere® Support Technical Exchange 28


IBM Software Group

JVM Profile sample


# DFHJVMPR
#
# Sample CICS JVM Profile for standalone JVM
#
# ********* CICS-specific parameters ***********
CLASSCACHE=NO
REUSE=RESET
#
# Specify the CICS and JVM install locations
CICS_DIRECTORY=/usr/lpp/cicsts/cics630/
JAVA_HOME=/usr/lpp/java141s/J1.4/
JVMPROPS=/u/usassc5/cics630/props/dfjjvmpr.props
LIBPATH=\
/usr/lpp/cicsts/cics630/lib:\
/usr/lpp/cicsts/cics630/ctg:\
/usr/lpp/java141s/J1.4/bin:\
/usr/lpp/java141s/J1.4/bin/classic
#
STDIN=dfhjvmin
STDOUT=dfhjvmout
STDERR=dfhjvmerr
#
# JVM properties file for the Master JVM).
CLASSPATH=/u/usassc5/sr/samples/dfjcics
#
# ********* Java non-standard options **********
Xmx=32M
etc ……

WebSphere® Support Technical Exchange 29


IBM Software Group

3-Set up the JVM Properties File…


ƒ An HFS file that contains a set JVM and application-
defined parameters and values
 Passed to JVM at initialization for construction of system
properties
ƒ JVM properties files specified in JVMPROFILE
 JVMPROPS=/usr/lpp/cicsts/cicsts23/props/dfjjvmpr.props
ƒ CICS sample files are:
 Supplied in /usr/lpp/cicsts/cicsts23/props
• dfjjvmcc.props – properties to configure master JVM
• dfjjvmcd.props – properties for CICS supplied system programs only
• dfjjvmpc.props – properties for resettable worker JVMs
• dfjjvmpr.props – properties for resettable worker JVMs
• dfjjvmpr.props – properties for resettable JVMs
(non shared class cache)
• dfjjvmps.props – properties for single use JVM

WebSphere® Support Technical Exchange 30


IBM Software Group

The JVM Properties File…con’t


ƒ Shareable class path
 Program loaded at JVM initialization and not removed at program
termination

ƒ Java 2 Security File


 HFS file that contains JVM security policy
• Passed to JVM at initialization for construction of system properties

WebSphere® Support Technical Exchange 31


IBM Software Group

JVM System Properties File sample


# Shared application classpath
ibm.jvm.shareable.application.class.path=\
u/jtilli1/testjdbc:\
u/jtilli1/testjdbc/jdbcprofiles
#
# The following lines are needed while testing applications
# for conformance with the rules for reuse of JVMs.
#
ibm.jvm.events.output=ure.log
ibm.jvm.unresettable.events.level=max
#
# EJB properties
# --------------
#
java.naming.provider.url=iiop://wibble.ibm.com:900
#
# JDBC Properties
#
# jdbc.drivers=COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver
#
#
# Enable Java 2 Security policy mechanism
#
#java.security.manager=default
#java.security.policy=/usr/lpp/cicsts/lib/security/dfjejbpl.policy

WebSphere® Support Technical Exchange 32


IBM Software Group

4-Set up the Shared Class Cache usage


ƒ Check the semaphore (lock) options in BPXPRMxx
member of PARMLIB
 Master JVM uses a single ID, and requests a set of 32
semaphores
• MNIDS, maximum number of semaphore IDs in use
• MNSEMS, maximum number of semaphores per ID
 DFHSIT parameters
• JVMCCPROFILE
− JVM profile for master JVM
− Value specified is name of an HFS file
− Value specified is used on INITIAL or COLD start
− Case matters!
• JVMCCSIZE = {24M number}
− Size of shared CC on INITIAL or COLD start
− Between 1 MB and 2047 MB
• JVMCCSTART = {AUTO | YES | NO}

WebSphere® Support Technical Exchange 33


IBM Software Group

5-Enabling Java applications for JVM use


ƒ CICS PROGRAM definition
 JVM (YES)
 JVMCLASS
• Name of the main class to be run
• Java class name qualified by package name
− e.g. example.HelloWorld.HelloCICSWorld
 JVMPROFILE
• Name of profile in the HFS directory to be used for this program

ƒ Ensure application class can be found by JVM loader


 CLASSPATH
 Shareable class path

WebSphere® Support Technical Exchange 34


IBM Software Group

Questions and Answers

WebSphere® Support Technical Exchange 35

Potrebbero piacerti anche