SEP Recycling

Overview

A SEP in Enterprise Server for .NET is implemented as a .NET Application Domain (AppDomain). AppDomains are used because they provide an isolation boundary for security, reliability and for unloading assemblies. Enterprise Server for .NET manages a pool of AppDomains, so that when it receives a request to run a CICS transaction or batch job, it takes an AppDomain from its pool and runs the request within it. When the request completes, and there is no request on the request queue ready for immediate execution, the AppDomain is returned to the pool. If there is a request ready to be executed, the AppDomain is immediately reused to execute it.

Once an assembly is loaded into an AppDomain, it cannot be unloaded until the AppDomain itself is unloaded. This means that if a new version of a program gets deployed, it will not get picked up and used by any existing AppDomain that has an earlier version of it loaded. The following sections describe how AppDomains (SEPs) may be recycled.

CICS SEP Recycling

Two options are available. You can either run the cpmt newcopy|phasein <program name> transaction, or run the seesys -phasein -program:<program name> command.

JES SEP Recycling

When a batch job runs, the AppDomain that is assigned to run the job runs the JES engine which coordinates the allocation of resources and driving of the individual job steps. The execution of the individual job steps occurs within a child AppDomain of the AppDomain running the JES engine (i.e. when a job executes under Enterprise Server for .NET, there are two AppDomains involved in its execution - one for the JES engine, the other for the job steps). By default, at the end of each job, the child AppDomain that has been used to run the job steps gets unloaded. This means that if new versions of any programs that have been loaded by the job steps get redeployed, the next time a job is run by the JES engine in the same AppDomain, the new versions of the programs will be used in the child AppDomain it creates to run the job steps in. This behavior is beneficial while developing your applications when programs need to be regularly recompiled and redeployed.

However, recycling the child AppDomain at the end of each job does incur a performance overhead. First, instantiating an AppDomain is not cheap and results in the COBOL run-time system and the job step execution environment needing to be initialised. Secondly, all programs used by the job steps will need to be loaded from their deployment locations. To avoid this performance overhead, which will be especially important in a production environment, the JES region can be configured so that the child AppDomains do not get unloaded at the end of each job, but instead only get unloaded after a certain period of time, or when the region running the job is different from the previous region, or never.

When a JES region is configured so that child AppDomains do not get unloaded at the end of each job, you can run the seesys -phasein -program:<program name> command to unload those AppDomains that have the given program loaded.

Explicit SEP Recycling

This may need to be done periodically to reduce the memory footprint of the processes that are hosting the SEPs. The seesys -recycle command is used to do this.