Anda di halaman 1dari 37

<Insert Picture Here>

In memory session replication with WebLogic,


GlassFish and Coherence

2011 Oracle Corporation

Agenda

ActiveCache - Coherence*Web
Deployment Models
Session Models
Locking Modes
Cluster Node Isolation
Session and Session Attribute Sharing
ActiveCache - WebLogic Server 10.3
ActiveCache - Oracle GlassFish Server 3.1

2011 Oracle Corporation

<Insert Picture Here>

Coherence*Web

2011 Oracle Corporation

Coherence*Web
What: Distributed HTTP Session Management
Span Applications: Seamlessly share sessions between
applications
Span Heterogeneous Environments: Share sessions between
WebLogic, OAS, WebSphere, JBoss

Handle Large Sessions: Store more information within the


session

2011 Oracle Corporation

Coherence*Web
Why:
Decouple session management from web container
Handle more users without adding more application servers
Restart/maintain applications/containers without loosing
sessions
Handle very large sessions efficiently
Keep session data coherent under heavy load

2011 Oracle Corporation

<Insert Picture Here>

Deployment Models

2011 Oracle Corporation

Deployment Models:
In-Process
Session state maintained
within app server process
Default model for ease of
demonstration

DO NOT USE IN
PRODUCTION

2011 Oracle Corporation

Deployment Models:
Out-of-Process

Two tiers app server and


cache server
Session data storage is
offloaded from the app server
tier
Each tier can be scaled
independently

Default recommendation
due to flexibility

2011 Oracle Corporation

Deployment Models:
Out-of-Process-Extend

Similar to the Out-ofProcess deployment model


Communication between
tiers is over
Coherence*Extend (i.e.
TCP/IP)
Ideal in environments where
network does not support
UDP

2011 Oracle Corporation

<Insert Picture Here>

Session Models

2011 Oracle Corporation

Session Models:
Traditional

Manages each session in a


single Coherence cache
entry
But manages each
session attributes
serialization/deserialization
separately

2011 Oracle Corporation

11

Session Models:
Monolithic

Similar to the Traditional


Model
But serializes and
deserializes all session
attributes together in a single
object stream.
Solves the shared object
issue

2011 Oracle Corporation

12

Session Models:
Split
Session meta-data and
small attributes stored in
one cache
Large attributes stored in
a separate cache
Easily supports very large
session objects
Leverages near caching for
small attributes
HIGHLY RECOMMENDED

2011 Oracle Corporation

13

<Insert Picture Here>

Locking Modes

2011 Oracle Corporation

Locking Mode
Optimistic Locking (default)
Allows multiple nodes in a cluster to access an HTTP session
simultaneously. Concurrent updates are detected and rejected using an
optimistic approach.

Member Locking
Does not allow more than one node in the cluster to access an
HTTP session.

Thread Locking
Does not allow more than one thread in the cluster to access an
HTTP session.

2011 Oracle Corporation

15

<Insert Picture Here>

Cluster Node Isolation

2011 Oracle Corporation

Cluster Node Isolation:


App Server Scoped
All deployed applications in
each app server instance will
be part of one Coherence
node.
Will result in the smallest
number of Coherence nodes
(one per web container JVM).
Minimizes resource
utilization (only one copy of
the Coherence classes
loaded per JVM)

2011 Oracle Corporation

17

Cluster Node Isolation:


EAR Scoped
All deployed applications
within each EAR will be part
of one Coherence node.
Will result in the next
smallest number of
Coherence nodes (one per
deployed EAR that uses
Coherence*Web).
Reduces the deployment
effort as no changes to the
application server classpath
are required.

2011 Oracle Corporation

18

Cluster Node Isolation:


WAR Scoped
Each deployed web
applications will be its own
Coherence node.
Will result in the largest
number of Coherence nodes
(one per deployed WAR that
uses Coherence*Web).
Results in the largest
resource utilization out of the
three options (one copy of
the Coherence classes
loaded per deployed WAR).

2011 Oracle Corporation

19

<Insert Picture Here>

Session and Session


Attribute Scoping

2011 Oracle Corporation

Session and Session Attribute Scoping


Session Scoping
Coherence*Web allows session data to be shared by
different Web applications deployed in the same or different
Web containers.

Session Attribute Scoping


Extension of Session Scoping allowing for scoping of
individual session attributes so that they are either globally
visible or scoped to an individual web application.
Behavior is controllable via the AttributeScopeController
interface. Two out of the box implementations:
ApplicationScopeController and GlobalScopeController

2011 Oracle Corporation

21

ActiveCache and
WebLogic

2008 Oracle Corporation

22

ActiveCache and WebLogic


Integration of Coherence
and WebLogic Server

Incremental progress since


launch of 11g

The whole is greater than


sum of its parts!
Coherence*Web SPI Support
for HTTP Sessions
Dependency Injection
Configuration, Lifecycle and
and Monitoring of Coherence
Clusters and Servers

2011 Oracle Corporation

23

WebLogic Server Installers with Coherence

PS2 installer includes Coherence 3.5.3p2


$MW_HOME\coherence_3.5
PS3 installer includes Coherence 3.6.0.4
$MW_HOME\coherence_3.6

2011 Oracle Corporation

24

active-cache-1.0.jar
Shipped with WebLogic Server distribution
Required for advanced WebLogic Server and Coherence
integration
Manage Coherence configuration with WLS MBeans and WLS
Console
Dependency Injection in JEE modules
Manages Coherence Lifecycle in JEE modules
How to reference from applications:
EAR scope - Import into the JEE application as a shared library jar in weblogicapplication.xml
WAR scope - Import as an optional package via META-INF/manfiest.mf
Server scope reference this jar from the system classpath

2011 Oracle Corporation

25

active-cache-1.0.jar (continued)
META-INF/manifest.mf file uses relative paths to refer to other WLS
libraries, so refer to this jar in the location:
$WLS_HOME/common/deployable-libraries
If you copy it out of that location it will not work

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: R28.0.2-3-133398-1.6.0_20-20100512-1453-windows-ia32 (Orac
le Corporation)
Specification-Title: active-cache
Specification-Version: 1.0
Implementation-Title: active-cache
Implementation-Version: 1.0
Extension-Name: active-cache
Class-Path: @BEA_HOME@/modules/features/weblogic.server.modules.cohere
nce.integration_10.3.4.0.jar ../../../modules/features/weblogic.serve
r.modules.coherence.integration_10.3.4.0.jar

2011 Oracle Corporation

26

coherence.jar
Shipped with Coherence distribution in
$COHERENCE_HOME/lib
Contains core Coherence classes
How to reference from applications:
EAR scoped - reference as a shared library in weblogicapplication.xml (recommended) or embed in APP-INF/lib
WAR scoped - embed in an application in WEB-INF/lib
Server scoped - can be put on the system classpath

2011 Oracle Corporation

27

coherence-web-spi.war
Shipped with Coherence distribution in
$COHERENCE_HOME/lib
Contains WebLogic Server SPI implementation for
HTTP Session storage in Coherence
Reference as a shared library in web module WEBINF/weblogic.xml
Contains default cache configuration for session
storage WEB-INF/classes/session-cache-config.xml
(can be overridden via classpath)
Local storage defaults to false by default

2011 Oracle Corporation

28

Node Manager and Coherence Servers


Coherence Servers need classpath to include
$MW_HOME/modules/features/weblogic.server.modul
es.coherence.server_10.3.4.0.jar
META-INF/manfist.mf contains relative references to
other WebLogic Server libraries, so refer to it in the
default location and do not copy it
If no classpath entries are specified in Startup tab, this
jar and coherence.jar are added by default implicitly by
Node Manager

2011 Oracle Corporation

29

ActiveCache and
GlassFish

2008 Oracle Corporation

30

ActiveCache and Oracle GlassFish Server


Integration of Coherence
and GlassFish
For commercial
distribution, not open
source edition

Coherence*Web support
for HTTP Sessions
+

2011 Oracle Corporation

31

Getting Started
Configure your session to use Coherence*Web
Edit glassfish-web.xml
<glassfish-web-app error-url=>
<Session-config>
<session-manager persistence-type=coherence-web />
</session-config>

</glassfish-web-app>

Advanced configuration options available in glassfish-web.xml


Defaults will handle most web applications
Additional <context-params> elements will override or add
new configuration

2011 Oracle Corporation

32

Preparing your GlassFish application(s)


Configuration changes do require restart of Web App
Extract coherence-web.jar and session-cacheconfig.xml from coherence\lib\webInstaller.jar/webinstall
Copy session-cache-config.xml to WEB-INF\classes
If clustered, copy coherence.jar to appropriate location

2011 Oracle Corporation

Clustered EAR
Deployment

Clustered WAR
Deployment

<EAR file>/lib

WEB-INF\lib

33

Example: preparing your GlassFish


Server
Example: clustered, in-process deployment model
Create/configure domain
Use asadmin at command line to create and start
Use GF console to add appropriate JVM options
coherence D JVM arguments

Example JVM options


Well known addresses (as opposed to multicast)
If multi-homed system that has multiple IPs, which IP to bind to
Tell glassfish to use cache servers for storage, not the in the
GlassFish JVM, e.g.
Session.localstorage=false (ensuring use of coherence cache
server, not GF)

2011 Oracle Corporation

34

Example continued
Example: clustered, in-process deployment model
Configure load balancer (ex. Apache)
Configure JVM for cluster or standalone servers to use
Configure / Enable mod_jk.conf load balancer plug-in
Mount paths defined in workers.properties
Edit workers.properties list to accommodate cluster members
Enable mod_jk for GlassFish
Djvmroute option for routing to LB
JVM -D option for location of workers.properties &
In GF console, enable JK network listener for Apache
for AJP protocol

2011 Oracle Corporation

35

Links
Coherence User Guide
http://coherence.oracle.com/display/COH35UG

Coherence*Web Session Management


http://coherence.oracle.com/display/COH35UG/Coherence*Web+Session+
Management+Module

Coherence*Web and WebLogic Server


http://coherence.oracle.com/display/COH35UG/Coherence*Web+and+Web
Logic+Server

Coherence*Web and WebLogic Portal


http://coherence.oracle.com/display/COH35UG/Coherence*Web+and+Web
Logic+Portal

2011 Oracle Corporation

36

<Insert Picture Here>

2011 Oracle Corporation

Anda mungkin juga menyukai