Top Banner
7/28/2019 Java Architecture Manual http://slidepdf.com/reader/full/java-architecture-manual 1/24 Architecture Manual This documentation provides an overview of the architecture of the Application Server Java (AS Java). It describes the setup of a Java cluster and the components involved.  Also, it describes the system architecture of the J2EE Engine. Integration You can operate the AS Java solely for Java/J2EE applications, or together with the Application Server  ABAP (AS ABAP). The integrated scenario is described in the documentation section SAP NetWeaver Application Server with ABAP and Java. This architecture overview provides an introduction to and background information for administration and development of Java/J2EE applications with the AS Java. Features The Architecture Manual is divided into the following sections: Java Cluster Architecture J2EE Engine System Architecture Development Infrastructure (DI) – the architecture of usage type Development Infrastructure (DI) Web Dynpro Java Persistence (You can also find this documentation in the Development Manual) SAP NetWeaver Application Server with ABAP and Java.
24

Java Architecture Manual

Apr 03, 2018

Download

Documents

Pandian Pandian
Welcome message from author
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
Page 1: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 1/24

Architecture ManualThis documentation provides an overview of the architecture of the Application Server Java (AS Java). Itdescribes the setup of a Java cluster and the components involved.

 Also, it describes the system architecture of the J2EE Engine.

IntegrationYou can operate the AS Java solely for Java/J2EE applications, or together with the Application Server 

 ABAP (AS ABAP).

The integrated scenario is described in the documentation section SAP NetWeaver Application Server with ABAP and Java.

This architecture overview provides an introduction to and background information for administration anddevelopment of Java/J2EE applications with the AS Java.

FeaturesThe Architecture Manual is divided into the following sections:

Java Cluster Architecture

J2EE Engine System Architecture

Development Infrastructure (DI) – the architecture of usage type Development Infrastructure (DI)

Web Dynpro

Java Persistence (You can also find this documentation in the Development Manual)

SAP NetWeaver Application Server with ABAP and Java.

Page 2: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 2/24

Java Cluster ArchitectureA Java cluster installation consists of:

●  One or more Instances of the AS Java

●  The Central Services, which also form an instance●  One or several databases

 The different instances can be split up among different physical machines. The

Central Services (Message Service and Enqueue Service) are installed on one host

that meets possible requirements for high availability.

Minimum Cluster Installation

 The following figure shows the simplest installation of the usage type AS Java. A

system installed in this way can process only requests to Java applications. The

integrated scenario with Java and ABAP is described in the section SAP NetWeaver

Application Server with ABAP and Java.

 The minimal AS Java installation consists of:

●   A Java central instance with a dispatcher, a server process, and the Software DeploymentManager (SDM).

●  The Central Services instance.

●  The Database.

 A  Java Instance consists of (with the exception of Central Services):

●  a Java Dispatcher 

Page 3: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 3/24

●  One or several server processes

Large Cluster Installation

 The figure below shows a larger Java cluster installation. It consists of four

instances, all of which have an instance number and each one can be started,

stopped, and monitored separately.

Load Balancing

If you have a large Java cluster installation, the load is distributed between the

available dialog instances by a load balancer. This scenario with implementation of 

the SAP Web Dispatcher is described in the section Load Balancing of Java

Applications. 

Further Information

 You will find further information on the cluster architecture in the following sections:

 Java Instance

Central Services

 Java Startup and Control Framework

Load Balancing of Java Applications

High Availability and Failover

Page 4: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 4/24

Java Instance

Definition A Java instance is a unit in the AS Java cluster, which can be started, stopped, and monitored separately.The cluster elements that form an instance run on one physical machine. It is also possible to run several

instances on one physical machine. An instance is identified by the system ID (SID) and the instancenumber.

Central Services are a special example of a Java instance.

 Another special instance is the one that runs the SDM ( Software Deployment Manager ). This oneusually runs with the database and Central Services on the same machine and is then indicated as thecentral instance.

Structure A Java instance contains at least one Server Process.

Normally it comprises one Java Dispatcher  and several server processes.

 A Java instance is started and stopped by the Java Startup and Control Framework.

IntegrationThere could be Java instances in mixed ABAP/J2EE systems, as well as in Java-only systems. For moreinformation, see SAP NetWeaver Application Server with ABAP and Java.

Example An HTTP request to execute a servlet runs through several layers in the J2EE Engine. The Javadispatcher receives the request, selects a server process for the processing and establishes theconnection from the client to the server.

Page 5: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 5/24

Java Dispatcher 

DefinitionThe Java dispatcher receives the client request and forwards it to the server process with the lowestcapacity usage. If there is already a connection to the client, the request goes to the server process thatprocesses this client.

UseIf a request arrives at the dispatcher for the first time, it is received by the connection request handler.The connection request handler deals with the following tasks:

•  It initializes a connection object, which from now on is assigned to this connection. The client then

has a connection to the connection manager for all subsequent requests.

•  It asks the load balancer which server is going to process this client. A weighted round-robin

procedure is used for this (see Load Balancing by the Java Dispatcher ).

From now the client is connected to the connection manager, which decides, on the basis of the requests,which session service is selected (for example, HTTP or RMI). All subsequent requests from this clientare sent to the same server.

The communication handler accepts the data and passes it to the Server Process.

StructureThe dispatcher contains the following components.

•  The connection request handler receives the first request from a client (see above). From this

time point on, the client has a fixed connection to the dispatcher.

•  The connection manager manages the existing connections to the clients.

•  The session level services are services that are assigned to a session.

•  The communication handler forwards the request to the server process. Accumulating requests

are stored in the request queue.

The graphic below shows the structure of the dispatcher.

Page 7: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 7/24

Server Process

DefinitionThe server processes of the J2EE Engine actually execute the J2EE application. Each server process ismulti-threaded, and can therefore process a large number of requests simultaneously. The JavaDispatcher assigns requests to the server processes.

StructureThe server process consists of the following components: Some of these are the same as in theDispatcher.

•  Communication handler (see Java Dispatcher )

•  Session level services (see Java Dispatcher )

•   Application-level services or the actual application program.

 A server process is constructed in the Java cluster as shown in the following graphic:

IntegrationSee

Java Cluster Architecture

Java Instance

J2EE Engine System Architecture

Page 8: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 8/24

Central Services

DefinitionThe Central Services run on one physical machine and constitute a Java instance.

They comprise the Message Service and the Enqueue Service.

UseThe Central Services form the basis of communication and synchronization for the Java cluster.

The Message Service keeps a list of the dispatchers and server processes of the Java cluster. Itrepresents the infrastructure for data exchange (small datasets only) between the participating nodes.The Message Service also supplies information to the SAP Web Dispatcher about Load BalancingBetween Many Java Instances.

The Enqueue Service manages logical database locks, which are set by the executed applicationprogram in a server process. The Enqueue Service also synchronizes data across the cluster.

The section Deployment of a New Application describes how the central components handle thedeployment of a new application.

IntegrationThe Central Services are always required when a Java cluster is installed. The Central Services instancehas its own system number.

When Central Services are running, further Java instances are started with the program JControl . For more information, see Java Startup and Control Framework.

See also:

Java Instance

 Administration of Central Services

Page 9: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 9/24

Message Service

DefinitionThe Message Service is a separate program used for communication between the elements of a Javacluster.

The Message Service is aware of all the active Java Instances.

UseThe Message Service is responsible for the following tasks in the Java cluster:

•  Notification of events that arise in the cluster, for example, if a cluster node gets lost (through

failure or shutdown of the instance), or when a service is started or stopped.

•  Communication between different services

•  Forwarding of messages and requests to all participants (broadcast)

•  Prepare logon information for the SAP Web Dispatcher (see Load Balancing Between Many Java

Instances)

•  Support for Message Server failover 

•  Guaranteed message transmission•  Exchange of cache information in the cluster 

MotivationBy using the Message Service you can avoid performance problems that occur if all the cluster elementsare connected with each other and exchange data with each other. With large clusters especially, thisresults in considerable performance problems.

The same technology is used as with the SAP Message Server for the earlier AS ABAP versions.

See also:

Cluster Communication

Integration

The Message Service is addressed through the Cluster Manager of one of the processes in the Javacluster (dispatcher or server processes), as shown in the figure below.

Page 10: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 10/24

The settings and the status of the Message Service are made accessible to the administrator via the

Message Info Service in the Visual Administrator. For more information, see Message Info Service inthe Administration Manual.

See also:

Enqueue Service

Page 11: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 11/24

Architecture of the Message Info Service

Communication within the Java cluster is administered by the Cluster Manager. If a server process wantsto send a message or data, this is arranged by the Cluster Manager, which connects to the MessageServer.

The Message Server is managed by the Message Info Service.

The figure below shows the relationships between the components Cluster Manager, Message Server,and Message Info Service.

 

Message Server and Message Service are used synonymously here. The correctexpression would be that the Message Server is a process or program that provides theMessage Service.

For information about the architecture of the SAP Web AS for Java, see the Architecture Manual.

See also:

Cluster Communication

Page 12: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 12/24

Enqueue Service

DefinitionThe Enqueue Service is used to manage logical locks. The tried and tested SAP lock concept is used for 

this (see  Functions of the SAP Lock Concept).

The terms Enqueue Server and Enqueue Service are used synonymously here. The correctexpression is that the Enqueue Server is the program or process that provides the EnqueueService.

UseThe Enqueue Service has the following tasks:

•  Internally it is used for synchronization within the Java cluster.

•  The applications can lock objects and release locks again. The Enqueue Service processes these

requests and manages the lock table with the existing locks.

StructureThe Enqueue Service runs on the Central Services instance of the Java cluster. It manages the lock tablein the main memory and receives requests for setting or releasing locks.

It maps the logical locks to the database.

See also:

 Architecture of the Locking Adapter Service

Deployment of a New Application

IntegrationThe Enqueue Service can be configured for high availability, by setting it up with the replication server and a platform-independent high availability solution.

For more information, see Standalone Enqueue Server .

Page 13: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 13/24

Architecture of the Locking Adapter Service

Applications running on the J2EE Engine can only use the interfaces

LogicalLocking and TableLocking, which are provided by the Locking Adapter

service. These have access to the Locking Manager that provides theServerInternalLockinginterface. This ensures that a J2EE application can only set

or release locks for the current user using the application.

 The figure below shows the interfaces and how they are related to each other.

Interfaces There are the following interfaces to set and release locks.

ServerInternalLocking

 This interface is provided by the Locking Manager and offers central functions.

It takes the following input parameters:

1. Lock owner 

2. Lock name

3. Lock argument

4. Lock mode

Page 14: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 14/24

Any lock can be set with this interface. It can only be used by the J2EE Engine

components (directly) or indirectly by the LogicalLocking interface.

LogicalLocking

Using the LogicalLocking interface you cannot specify the lock owner. The system

determines the owner from the context of the user session or the transaction. Whatis used to determine the user can be specified in the lifetime parameter. After the

transaction or the user session has finished, all associated locks are released.

A user session ends when the user logs off or a timeout occurs. A transaction ends

when commit or rollback is called or when a timeout occurs.

 A transaction’s lifetime does not necessarily have to be the same as the lifetime of the user session. If the user logs off without calling a commit or rollback in the transaction, locks

restricted to the transaction can continue to be effective until the transaction terminates witha timeout.

No locks can be set for the system user because of security reasons.

 This interface takes the following input parameters:

5. Lifetime of the lock (running user session or running transaction)

6. Lock name

7. Lock argument

8. Lock mode

 You can change your own locks only. You can, however, still select the format and

lock mode.

TableLocking

Using this interface, you can lock/unlock a whole row of a database table. The row is

identified by the argument primaryKeys. The database connection is identified by

the argument dbconnection.

 This interface takes the following input parameters:

9. Lifetime of the lock (separate user session or transaction)

10. Database connection (instance of SQL connection created from a data source that has a

transaction in the deployment descriptor of the DB pool)

11. Name of the database table

12. Primary key of the database table

13. Lock mode

Additional Information

14. You can find more information and examples about working with locks under  Locks in the

Development Manual.

Page 15: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 15/24

15. Detailed javadoc documentation is available as part of the SAP NetWeaver Developer Studio help.

16. Java Dictionary in the Development Manual.

17. Deployment of a New Application18. If a new application is to be written to the database, the central components of the cluster must

work together, as shown in the figure below:

19.   1.  The Configuration Manager requests a lock from the Locking Manager (see Architecture of 

the Locking Adapter Service). The Locking Manager in turn requests the lock from the EnqueueService. The relevant area in the database is locked.

20.   2.  The Configuration Manager writes the application data to the database.

21.   3.  The Configuration Manager triggers the Cluster Manager of its server process to publish the

new application in the cluster. To do this, the Cluster Manager passes the message to the MessageService, which forwards the message to all the server processes in the cluster (broadcast).

22.   4.  The other server processes load the application from the database. The application can then

be run in the entire cluster.

23. The figure below shows the components involved and the communication between them.

24.25. ..

26. ...

27. See also:

28. Message Service29. Enqueue Service

30. Connecting the J2EE Engine to DBs

Page 16: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 16/24

Java Startup and Control Framework

DefinitionThe Java startup and control framework comprises the programs JControl and Jlaunch. JLaunch is

started by JControl and itself starts the bootstrap Java program or an element of the Java cluster 

(dispatcher or server process).

UseThe Java startup and control framework is used to start, stop, and monitor a Java Instance.

The program JControl starts the Java instance as specified in the configuration file.

StructureThe framework consists of the following components:

•  JControl starts, stops, and monitors the processes of a Java instance (usually a dispatcher and

several server processes). The program implements the SAP signal handling to stop the instance.JControl starts the JLaunch processes.

•  JLaunch starts a Java program. It loads the JVM into its own address space and then represents

the required cluster element. The program can receive notification from the JControl process via

named pipes to stop the cluster element, and terminates, if the JControl stops running (fork

emulation under Windows).

•  The Bootstrap JAVA program synchronizes the binary data from the Java database with the local

file system and creates a property file, which describes the processes of the Java instance.

The process is described in Startup, Operation and Shutdown of a Java Instance.

IntegrationThe Java startup and control framework is called in different ways according to the operating system andinstallation type:

•  Under Windows, the SAP Management Console is used. If you choose Action → Start from the

context menu of an instance containing a J2EE Engine, the JControl program is called.

•  Under UNIX and OS/400 platforms, the scripts startsap and stopsap are used to call the

program.

•  If you start the Java instance using the SAP NetWeaver Developer Studio (NWDS), the client

integrated into the NWDS calls the JControl program.

See also:

Starting and Stopping the SAP System (UNIX)

Starting and Stopping the SAP System (Windows)

Page 17: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 17/24

Startup, Operation and Shutdown of a Java Instance

PurposeWith the Java startup and control framework you can start, monitor, and stop a Java

instance. This means you can:

•  Restart processes

•  Send request to shut instance down

•  Terminate hanging processes

 The program JControl is part of the standard delivery.

Process Flow The following figure shows the flow of the actions that the Java startup and control

framework executes.

 

Startup of the Java Instance

The following steps are involved in starting the Java instance:

Page 18: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 18/24

•  JControl is started (in Windows by the SAP start service; on UNIX platforms by the startsap 

script).

•  JControl initializes the SAP signal handling to be able to handle signals received.

•  JControl starts JLaunch with the bootstrap.properties file (1). This executes the following steps:

•    The first argument of JLaunch is the PID of the parent process

(JControl). JLaunch starts a thread, which ends the JLaunch process, if theparent process, JControl, fails.

•   Creates Java Virtual Machine (JVM) arguments and initializes hosting of 

the virtual machine (VM).

•   Loads the VM into its own process, initializes the VM and starts the

bootstrap program.

•    The bootstrap program synchronizes the binary data of the Java database

with the local file system (2).

•    The bootstrap program reads the Java instance description from the Java

database and writes the file instance.properties (3). The file instance.properties 

contains the description and the arguments of the AS Java cluster elements

that are to be started.

•  JControl reads and creates a list of the AS Java cluster elements to be started (4).

•  JControl starts a JLaunch process for each cluster element (5). This executes the following

steps:

•    The first argument of JLaunch is the PID of the parent process

(JControl). JLaunch starts a thread, which ends the JLaunch process, if the

parent process, JControl, fails.

•   Creates JVM arguments and initializes hosting of the VM.

•   Loads the VM into its own process, initializes the VM and starts the Java

cluster element. This executes the following steps:

•   Starts the “offline“ configuration manager to read the properties for

the Java Enterprise runtime from the database and to save them in

various hash tables (6).

•   Stops the “offline“ configuration manager and starts the Java

Enterprise runtime with the saved properties.

•   Starts the service framework and the services.

 

See also:

Page 19: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 19/24

 J2EE Engine System Architecture

 

Operation of the Java Instance

 The JControl process monitors the Java instance. It continuously checks the status

of the cluster elements of the instance and restarts terminated processes.

Shutdown of the Java Instance

Signals and named pipes trigger a Java instance to stop. The process ensures that

following a shutdown time interval all cluster elements of the instance are exited.

 The figure below shows the communication.

An instance is stopped as follows:

•  The SAP start/stop environment (start script or SAP Start Service on Windows), which started the

JControl process, sends a SIGINT to the JControl process (1).

•  JControl sets the status of the Java instance to STOPPING in its list and sends a notification

using a named pipe to all of the running cluster elements (2).•  The JLaunch process of the Java cluster element must respond to the notification within a defined

time interval. (If this soft shutdown does not work, the JLaunch process is completely terminated

by JControl.) It triggers the shutdown of the AS Java cluster element in the JVM and waits for its

own VM to terminate (3).

•  JControl exits.

Page 20: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 20/24

Load Balancing of Java Applications The purpose of load balancing is to distribute inbound requests optimally to the

available resources.

Technical System Landscape The SAP NetWeaver AS provides load balancing at various levels.

 These are shown as (1) and (2) in the figure below.

•  Load balancing between many SAP NetWeaver AS instances (1)

Page 21: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 21/24

 You can start a system with many Java dispatchers, for which the SAP Web

Dispatcher or a different load balancer is already activated as a Web switch. For

more information, see Load Balancing Between Many Java Instances.

•  Load balancing within the SAP NetWeaver AS instance (2)

In the  Java Instance the  Java Dispatcher distributes the inbound requests tothe Server Processes to which it is connected. The Java dispatcher runs the

load balancing when the first session request arrives. The dispatcher ensures

that subsequent requests get to the server process that is processing this

session.

For more information, see:

Load Balancing by the Java Dispatcher

Load Balancing for J2EE Web Applications

Registering Server Processes for HTTP Load Balancing

Load Balancing Between Many Java Instances The following figure shows a system with several Java dispatchers, to which the

SAP Web Dispatcher is the entry point in the DMZ. It executes the load balancing

between the Java dispatchers, which then distribute the requests to their server

processes.

Instead of the SAP Web dispatcher, you can use any other load balancing device. Using thedevice’s configuration tools, you have to register the communication ports of the Javadispatchers of the AS Java instances running behind it. The communication with theMessage Server and the mapping to the SAP logon group are then no longer required.

 

Page 22: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 22/24

Instance-level Load Balancing using SAP Web Dispatcher

 The SAP Web dispatcher fetches the information it needs from the Message Server.

 This information includes the hosts and ports of the Java dispatcher, and the

capacities of the connected J2EE Engines, so that the SAP Web dispatcher can apply

the weighted round robin load balancing algorithm.

To configure communication with the Message Server, you have to enter the HTTP or HTTPS port of theMessage Server (parameter ms/http_port or ms/https_port) to the profile file of the SAP Web

dispatcher. See also Example: Profile File of a SAP Web Dispatcher .

SAP Web Dispatcher 

 The SAP Web dispatcher is delivered with the Central Services instance (Enqueue

Service and Message Service). In the standard installation, you can find it in the

directory \usr\sap\<SID>\SCS<nr>\exe.

Integration The SAP Web dispatcher can be used for load balancing in the following scenarios:

•  Java-only scenario, as described here. As all requests are forwarded to J2EE Engine, all the

distribution procedures using the URL prefixes in the SAP Web Dispatcher documentation arenot relevant.

•   ABAP-only scenario, see  SAP Web Dispatcher 

•  Integrated scenario (Java and ABAP). For more information, see SAP NetWeaver Application

Server with ABAP and Java

Page 23: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 23/24

For more information about load balancing in the Java environment, see the

following sections:

Load Balancing by the Java Dispatcher 

Load Balancing for J2EE Applications

Page 24: Java Architecture Manual

7/28/2019 Java Architecture Manual

http://slidepdf.com/reader/full/java-architecture-manual 24/24