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