Sie sind auf Seite 1von 194

Weblogic Application Server

Presented by VAISHALI TAPASWI

FANDS INFONET Pvt.Ltd.


www.fandsindia.com fands@vsnl.com

Ground Rules

Turn off cell phone. If you cannot, please keep it on silent mode. You can go out and attend your call. If you have questions or issues, please let me know immediately. Let us be punctual.

www.fandsindia.com

Agenda

Weblogic Installation and Configuration, Network and Unattended Installs WLS as a Web Server Security Configuration (Users, Groups, Roles, Policies, SSL) Service Management (JMS, JNDI, JDBC, Transactions) Custom J2EE Class Loading Startup/Shutdown Classes Application Lifecycle Events
www.fandsindia.com

Agenda

Performance Tuning Development and Production Environment Configuration Node Manager SNMP WLS Clustering JRockit (Architecture, Features, Configuration, Monitoring)
www.fandsindia.com

Agenda

Monitoring (Application, Server) Backup and Restore Network Channel Configurations Administration Scripting Message Catalog JMX Config and Runtime MBeans Application Deployment Hardening the Production Environment
www.fandsindia.com

Day 1

J2ee Architecture Introduction to Weblogic Server Describe a high-level view of the WLS Architecture Install BEA Weblogic Platform 8.1

www.fandsindia.com

EIS Architecture

www.fandsindia.com

Enterprise System Requirements


High Availability Load-balancing Fail Over Scalability Security Maintainability


www.fandsindia.com

J2EE Architecture

www.fandsindia.com

Distributed Systems

Distributed Systems divide the work amongst several independent module Failure of a single module has less impact on the overall system which makes them more :
available scalable maintainable
www.fandsindia.com

How Standards Help

Many of the advantages of the distributed systems come from standards Standards
Provide seperation of the difficult problems to separate platforms Allow modularization of complex hardware and software Allow large portion of project costs to go toward solving business software needs.
www.fandsindia.com

The J2ee Standards

The platform2 enterprise edition (J2EE) helps to ovwercome distributed liabilities Applications deployed with the j2ee technologies are:
Standardized Adherent to specification guidelines Written in java Deployable in any complaint application server
www.fandsindia.com

The J2ee architecture

www.fandsindia.com

Java Servlets

A servlet is a java program that executes on the server, accepting client requests and generating dynamic responses The most prevalent type of Servlet is an HttpServlet that accepts HTTP requests and generates HTTP responses. Servlets:
do not just generate HTML can also be used to generate other MIME types, such as images
www.fandsindia.com

Java Server Pages (JSPs)

JavaServer Pages are HTML documents interweaved with Java. JSPs:


Provide a dynamic response that is based on the client's request Provide for the separation of responsibilities between Web pesentation and dynamic content Are portable (write once, run anywhere) compile and run as servlets
www.fandsindia.com

Enterprise Java Beans (EJBs)


EJBs are distributed components written in the Java programming language. EJBs: provide distributable and deployable business services (logic) to clients have well-defined interfaces are reusable across application servers execute within a container that provides management and control services WebLogic Server 9.X supports the EJB 2.1 specification.
www.fandsindia.com

JDBC (Java Database Connectivity)

JDBC is: a standard Java interface for accessing heterogeneous databases a specification that defines four different driver types for connecting to databases
www.fandsindia.com

Java Naming & Directory Interface (JNDI)

JNDI is:
a Java API for accessing naming and directory servers built as a layer over DNS, LDAP, etc.

www.fandsindia.com

Java Transaction API (JTA)


JTA is a standard Java API for demarcating transactions within a program. WebLogic Server supports local and distributed transactions.

www.fandsindia.com

Java Message Service (JMS)

JMS is a Java API for accessing message oriented middleware. The interface supports: the Point-to-Point domain the Publish/Subscribe domain guaranteed message delivery transactional participation dynamically configurable services application- or system-scoped resources interoperability with other messaging systems

www.fandsindia.com

Java Authentication and Authorization


Java Authentication and Authorization Service (JAAS) is a Java-based security management framework. JAAS supports: single sign-on a Pluggable Authentication Module (PAM) JAAS enables flexible control over authorization whether it is based on: users groups roles

www.fandsindia.com

JMX

The Java Management Extensions (JMX):

defines a standard infrastructure to manage a device from Java programs decouples the managed device from the management tools

The specification describes MBeans, which are the building blocks of JMX.

www.fandsindia.com

Web Client

A Web client interacts with WLS via HTTP using Servlets/JSPs. Types of Web clients include:
Browser Web Services (SOAP over HTTP)

www.fandsindia.com

Client Application

A client application interacts with WLS through JRMP/T3, IIOP, COM. Types of Clients include:

Standalone Java applications Applets within a browser

www.fandsindia.com

Introduction to Weblogic Server

Web and Weblogic Server Terms

Web Server

www.fandsindia.com

Application Server

www.fandsindia.com

Proxy Server
It forwards the request to other machines Can be used as level of indirection and security It can be used for load balancing Web Servers can act as proxy servers

www.fandsindia.com

Firewall

Provides filtering, authorization and authentication services helps keep hackers out Can act as a proxy server Decrease back-end network activity
www.fandsindia.com

A Web Application Server Configuration

www.fandsindia.com

Few Definitions

Server Machine Cluster Domain Administration Server Managed Server


www.fandsindia.com

Server

A server is an instance of weblogic.Server executing in a JVM A server


Runs on a designated WLS machine Has a dedicated amount of RAM Is multi-threaded

www.fandsindia.com

Machine

A machine is a computer that hosts Weblogic Server(s) A machine


Runs a supported operating system platform Can host multiple Weblogic Server instances

www.fandsindia.com

Cluster

A cluster is a logical group of WLS servers Weblogic clusters provide automatic:


Fault tolerance High Availability Load Balancing

A cluster is transparent to a client

www.fandsindia.com

Domain

A domain is a logicallyrelated group of Weblogic Server resources that you manage as a unit. A domain provides one point of administration A weblogic Server domain can logically separate
Development, test and production applications Organizational divisions

www.fandsindia.com

Administration Server

An administration (admin) server is the central point of control for a domain An admin server
Stores the configuration information and logs for a domain Runs the Weblogic Administration console

www.fandsindia.com

Managed Server

A managed server is any server in a domain that is not the admin server A managed server
Contacts the admin server for configuration information Runs business applications in a production environment
www.fandsindia.com

Install BEA Weblogic Server

Installation Methods

Graphical mode Console mode Silent mode

www.fandsindia.com

Graphical mode

An interactive, GUI-based method for installing WL Platform. It can be run on both Windows and UNIX systems.
If you want to run graphical-mode installation, the console attached to the machine on which you are installing the software must support a Java-based GUI. All consoles for Windows systems support Java-based GUIs, but not all consoles for UNIX systems do. If you attempt to start the installation program in graphical mode on a system that cannot support a graphical display, the installation program www.fandsindia.com automatically starts console-mode installation.

Console mode

Console-mode installation is an interactive, text-based method for installing WebLogic Platform, from the command line, on either a UNIX system or a Windows system.

www.fandsindia.com

Silent mode

Noninteractive method of installing WebLogic Platform that requires the use of an XML properties file for selecting installation options. You can run silentmode installation in either of two ways: as part of a script or from the command line. Silent-mode installation is a way of setting installation configurations only once and then using those configurations to duplicate the installation on many machines
www.fandsindia.com

Silent mode
<?xml version="1.0" encoding="UTF-8"?> <!-- Silent installer option: -mode=silent silent_xml=/home/me/silent.xml --> <domain-template-descriptor> <input-fields> <data-value name="BEAHOME" value="C:\bea" /> <data-value name="USER_INSTALL_DIR" value="C:\bea\weblogic81" /> <data-value name="INSTALL_NODE_MANAGER_SERVICE" value="no" /> <data-value name="COMPONENT_PATHS" value="WebLogic Server|WebLogic www.fandsindia.com Workshop|WebLogic Integration|WebLogic Portal" /> </input-fields>

Practice Session I

Create silent.xml file Install weblogic on your system with silent mode installation. Installation should happen in c:\beaSilent folder

www.fandsindia.com

After Installation - Observe

Folder hierarchy created after installation. See important batch files JVM arguments

www.fandsindia.com

Domain Configuration

Domain Configuration

Configure a Domain Configuration Wizard Administration Server Settings Create a Managed Server Create a Cluster Create a Machine JVM Selection
www.fandsindia.com

Templates

www.fandsindia.com

Practice Session II

Create a Weblogic Domain


Mydomain123

Create a Weblogic Server


MyServer123

Configure a Machine
Machine123

www.fandsindia.com

Weblogic Console

Starting Weblogic Server Stopping Weblogic Server Maintaining log for Server Configuration Files

www.fandsindia.com

Server State Diagram

www.fandsindia.com

Command Line Administration

www.fandsindia.com

Practice Session III

Modify logging properties


All informational messages should be displayed and stored Using command line administrations list all the JNDI names which are registered on the server Observe Domain log file and Server log file.
www.fandsindia.com

Day 2

JNDI JDBC JMS Servlet and JSP application EJB

www.fandsindia.com

JNDI

Understanding JNDI

Describe naming and directory services Detail the high-level architecture of JNDI Define basic terminology View the JNDI tree in WebLogic Server Use the Administration Console to deploy a startup or shutdown class
www.fandsindia.com

RoadMap

Introduction to JNDI What Are Directory and Naming Services and How Do They Work The High-level Architecture of JNDI Viewing JNDI Tree Via the Administration Console and the CommandLine Startup and Shutdown Classes
www.fandsindia.com

What Is JNDI?

The Java Naming and Directory Interface is an API for accessing different naming and directory services uniformly. This is a major step forward because: Different services use vastly different naming schemes Java applications will be able to navigate seamlessly across databases, files, directories, objects and networks
www.fandsindia.com

Why JNDI ?

In WebLogic Server, JNDI serves as a repository and lookup service for J2EE objects including: EJB home stubs JDBC DataSources JMS connection factories, queues and topics RMI stubs
www.fandsindia.com

JNDI Structure

www.fandsindia.com

Naming Service

A naming service provides a method for mapping identifiers to entities or objects:

www.fandsindia.com

Naming Service

Naming Service vocabulary:

www.fandsindia.com

A JNDI Tree

www.fandsindia.com

Contexts and Subcontexts

Subcontexts are referenced through dot delimiters (.) Subcontexts must be created before objects are placed into them

www.fandsindia.com

JNDI for Administrators

An administrator needs to understand JNDI because it will be their job to: verify objects are bound in the JNDI tree set security on contexts within the JNDI tree

www.fandsindia.com

Viewing the JNDI Tree

www.fandsindia.com

Listing JNDI Contents

WLST provides a command line utility for viewing JNDI bindings. jndi() changes to the jndi tree and ls() lists the bindings

www.fandsindia.com

Section Review

What directory and naming services are and how they work The high-level architecture of JNDI Viewing the JNDI tree via the Administration Console and the command line

www.fandsindia.com

Road Map

Introduction to JNDI Startup and Shutdown Classes What Are Startup and Shutdown Classes and How Do They Work Deploying a Startup or Shutdown Class Using the Administration Console

www.fandsindia.com

What Is a Startup Class?

A startup class is a class that is loaded and executed when WebLogic Server boots. You can use a startup class to: initialize objects in memory reconstruct a JNDI tree load critical values from the database recover the system to the state that existed before shutdown
www.fandsindia.com

What Is a Shutdown Class?

A shutdown class is a class which gets executed when WebLogic Server is shutting down. Shutdown classes are usually used to free resources obtained by startup classes.

www.fandsindia.com

Defining Startup/Shutdown Classes

www.fandsindia.com

Deploying Startup/Shutdown Classes

www.fandsindia.com

When Are Startup Classes Loaded?


By default, startup classes are loaded after the J2EE deployment units. J2EE deployment units load in this order: JDBC, JMS,Connectors, EJBs, Web Applications. If Run Before Application Deployments is checked,then startup class are loaded right before deploying JDBC Data Sources.

www.fandsindia.com

JDBC

JDBC

Java DataBase Connectivity JDBC is an application programming interface(API) for accessing databases in a uniform way Different Vendors give us jdbc drivers

www.fandsindia.com

JDBC Architecture

www.fandsindia.com

JDBC Configuration

Creating Connection Pool


Using JDBC Assistant Script

Testing Connection Pool Connection Configuration Properties


Basic Advance

Configure Statement Cache Monitor a Connection Pool


www.fandsindia.com

DataSource

DataSource object provides a way for a jdbc client to obtain a database connection from a connection pool A DataSource
Is stored in the WLS JNDI tree Contains a reference to a connection pool Can support transactions Must be created for each connection pool
www.fandsindia.com

DataSource

Why DataSource Create a JDBC DataSource Deploy a JDBC DataSource DataSource Vs Transaction DataSource
What is JTA Distributed Transactions

www.fandsindia.com

JDBC - Admin

Logging Monitoring How many Connection to establish Performance Tuning

www.fandsindia.com

Practice Session I

Configure a jdbc connection pool to communicate with oracle. When the wls starts 2 connections should be established and it can increase upto 10. Create a DataSource with jndi name as TestPool. Use existing jsp to open the connection. Monitor the connection pool for active connections.
www.fandsindia.com

JMS

JMS

Message-oriented middleware Messaging Fundamentals


P2P PS

JMS Architecture Configuring JMS

www.fandsindia.com

JMS

www.fandsindia.com

Point to Point

www.fandsindia.com

Publish Subscribe

www.fandsindia.com

JMS Flow

www.fandsindia.com

Message-Oriented Middleware
Message-oriented middleware refers to an infrastructure that supports messaging. Typical message-oriented middleware architectures define these elements: Message structure The way to send and receive messages Scaling guidelines

www.fandsindia.com

Point-to-Point (PTP) Queue

Many producers can serialize messages to multiple receivers in a queue.

www.fandsindia.com

Publish-Subscribe Topics

Publishing and subscribing to a topic decouples producers from consumers.

www.fandsindia.com

WebLogic Server JMS Features


WebLogic Server JMS supports: PTP and Pub/sub domains Guaranteed and transactional message delivery Durable subscribers Distributed destinations Recovery from failed servers

www.fandsindia.com

JMS Architecture: Connecting

www.fandsindia.com

JMS Architecture: Sending Messages

www.fandsindia.com

Transacted Messaging

A JMS client can use JTA to participate in a distributed transaction. Alternatively, a JMS client can demarcate transactions local to the JMS Session, through a transacted session. Participation in a transaction is optional.

www.fandsindia.com

Administrative Tasks
Administrative tasks include these: Creating and monitoring JMS Servers Creating connection factories Creating and monitoring destinations Creating JMS stores Configuring thresholds and quotas Configuring durable subscriptions Managing JMS service fail-over

www.fandsindia.com

WLS JMS Server


In WLS, the messaging service is implemented through a JMS Server. A JMS Server receives and distributes messages.

www.fandsindia.com

Create a JMS Server

www.fandsindia.com

Target a JMS Server

www.fandsindia.com

Configure a JMS Server

www.fandsindia.com

JMS Resources

JMS resources are managed as system modules, application modules, or packaged JDBC resource modules.

www.fandsindia.com

Modular JMS Resource Configuration and Deployment...


JMS configurations in WebLogic Server are stored as modules Defined by an XML file that conforms to the weblogicjmsmd.xsd schema Similar to standard J2EE modules An administrator can create and manage JMS modules as: Global system resources Global standalone modules Modules packaged with an enterprise application

www.fandsindia.com

Modular JMS Resource Configuration and Deployment


An advantage of modular deployment is simplified migration between environments, such as: From development to integration From system test to production You can migrate your application and the required JMS configuration: Without opening an EAR file Without extensive manual JMS reconfiguration

www.fandsindia.com

Connection Factory
A connection factory: Encapsulates connection configuration information Is used to create pre-configured connections Is stored in JNDI Can be targeted to servers or clusters WLS provides a default connection factory that is bound in JNDI to weblogic.jms.ConnectionFactory. When a new configuration is required, a new connection factory can be created.

www.fandsindia.com

Practice Session II

Configure
Connection Factory Queue Topic

www.fandsindia.com

Day 3

Web Applications JTA Security Runtime Configurations (for clustering)

www.fandsindia.com

Web Applications

Web Applications

Any web application is a group of server side resources


Servlets Java Server Pages (JSP) Static Documents (HTML, images) Server Side classes Client side applets and Beans Tag Libraries
www.fandsindia.com

Web Application

Packaging and Deploying a war file


Extracted folder deployment War deployment When to choose what

Configuring a war file


Weblogic.xml

www.fandsindia.com

Command-Line Deployment

Weblogic.deployer utility java weblogic.Deployer -adminurl http://localhost:7001 -user weblogic -password weblogic -name myapp -targets myserver -upload -deploy c:\localfiles\myapp.ear
www.fandsindia.com

Virtual Hosts

A virtual host
Has associated web addresses : domain name and IP address Lets you make one web server function as if it were multiple servers

User virtual hosting to allow one web server to host multiple internal and external corporate sites
www.fandsindia.com

Virtual Hosts

www.fandsindia.com

Configure a Virtual Host

Steps to configure a virtual host


Create the virtual host in the admin console Target the virtual host to a server Target applications to the virtual host Resolve DNS names in the system host file

www.fandsindia.com

Practice Session I

Try deploying a web application using


War deployment Folder deployment

Create a virtual host and test web application. Test virtual host
http://fands.com:7001/test
www.fandsindia.com

Java Transaction API (JTA)

JTA

What is distributed transaction


Resource Manager Local Transactions Transaction Manager Transaction Context

www.fandsindia.com

Two Phase Commit Protocol


2 steps to commit changes Phase 1 asks RMs to prepare to make the changes and if any of them cannot, the transaction is aborted Phase 2 asks RMs to commit and make the changes permanent A global transaction ID is used to track all changes associated with a distributed transaction
www.fandsindia.com

Role of Administrator

Configure transactions at the domain level Monitor transactions on a server


By resource By name

Transaction Log

www.fandsindia.com

Role of Administrator

Transaction Recovery after Server Failure Transaction Recovery Service Recovering Transactions for a failed nonclustered server
Move transaction log files from failed server to a new server Set transactionlogfileprefix Start new server searches for incomplete transactions and completes them
www.fandsindia.com

Security

Security

Weblogic Security Architecture User and Groups Roles Protecting Application Resources Protecting Communication Protecting against Attacks
www.fandsindia.com

Security Architecture

www.fandsindia.com

Providers

Authentication Provider
Authenticate users within a security realm Transport identity information

Authorization Provider
A process to control interactions between users and resources based on user identity Role Mapping

Adjudication Provider
Can be used to tally the results that multiple access decisions return to determine the final decision
www.fandsindia.com

Providers

Confidentiality
SSL Client Certificate and public ID

Credential Mapping
For accessing legacy system authentication mechanism to obtain a set of credentials

Auditing
Provides a trail of activity
www.fandsindia.com

Security Realm

Collection of System Resources and Security service providers One security realm can be active at a time Each user and group must be defined in security realm Creating a security realm is an administration task
www.fandsindia.com

Lets do it now

Setting Security settings Users, roles etc Realm Configuration User lockouts Protecting against attacks SSL Setting up security for applications
www.fandsindia.com

Day 4

Runtime Configurations Clustering

www.fandsindia.com

RUNTIME CONFIGURATIONS

RUNTIME CONFIGURATIONS

Node Manager Managed Server Independence Network Channels Startup and Shutdown Classes

www.fandsindia.com

Node Manager

Is an independent java program Monitors and acts on server health Runs on the same computers as the managed servers Receives its requests from the admin server through the console or Weblogic.admin Can be run automatically in the background, as a windows service or a Unix daemon
www.fandsindia.com

Node Manager Architecture

www.fandsindia.com

LETS DO IT

Set up node manager


Configure hosts Define machines Specify server start information Start node manager
At the command line With a start script As windows service or Unix daemon

Start/stop managed servers remotely


www.fandsindia.com

Server Status

Status of server can be monitored Server stdout can be viewed Starting all the servers in Domain Node Manager log files Using self-health with node manager

www.fandsindia.com

Self Health

Node manager can reboot failed server automatically No manual intervention required Health state is not visible through the console Can programmatically checked by JMX Configure using Console
www.fandsindia.com

Server Administration

What happens when admin server is down (managed Server independence) ? Console server tuning Replicating Domain config files Admin Server backup Discovery mode
For reconnecting to managed servers
www.fandsindia.com

Network Channels

Gives flexibility to network configurations


Multiple NICs (Network Interface Card) for a single WLS Server Multiple IP addresses for each server One IP address with each server Secure Channels
www.fandsindia.com

Startup and Shutdown Classes

A startup class is loaded and executed when Weblogic server boots Used to
Initialize objects in memory Modify JNDI tree Load critical values from database

Connector Modules
www.fandsindia.com

Clustering

Clustering

Concepts Hardware Load Balancers Web Server Plugins WLS J2EE Clustering

www.fandsindia.com

Concepts
A cluster is a collection of entities coordinating actions to provide scalable and highlyavailable services.
Scalable services
Add and remove servers as needed Load balance requests Concentrate communication

Highly available services


No single point of failure Transparent failover
www.fandsindia.com

Support

Services that can be clustered


Web Applications EJB and RMI objects JNDI Tree

Services where limited support is avaiable


JDBC Connections JMS Connection factories
www.fandsindia.com

Support

Services which can not be clustered


File Services Time Services

www.fandsindia.com

Cluster Architecture

www.fandsindia.com

Cluster Architecture

www.fandsindia.com

Hardware Load Balancer

Stateless services
Choose any load balancing policy available No need for server affinity
Server Server Server Server Server Server

Load balancer
Server

Server

Web Servers www.fandsindia.com

Application Servers

Hardware Load Balancer

Stateful services
Choose any load balancing policy for initial request Maintain server affinity based on HTTP cookies NO load balancing after session is established

www.fandsindia.com

Hardware Load Balancers

Passive Cookie Persistence


Server affinity based on cookie set by WebLogic server

Active Cookie Persistence


Server affinity based on cookie set by load balancer Shouldnt modify cookie set by WebLogic server
No support for URL rewriting.
www.fandsindia.com

www.fandsindia.com

www.fandsindia.com

Design of Web Server Plugins


Cookie based server persistence Active Cookie Persistence
IO NI D= sf1 d4 9;S GE er v T/ er= He Se llo rve wo r-1 rld

JS ES S

Add custom cookie to maintain persistence .jsp


Web Server/LB Server1 ServerServer 1 Server 2 Server 3
GE T llow / He orld

.js p

S JSE

N SIO

ID

9; D4 1 f =s

2 Server-3 3 rver GET e S r= erve S ; 0 z 31K a = ID ION S S JSE

x.jsp e d /in

GE T /i
JSE SSI O

nde x.js p

www.fandsindia.com

N ID =a3 1Kz 0;

Design of Web Server Plugins


Load Balancer Discovery Protocol Static Registration Dynamic Registration IP Multicast protocol Notification at startup/shutdown
F5 provides a SOAP based scheme to achieve this http://dev2dev.bea.com/codelibrary/code/f5_wls.js p
www.fandsindia.com

WLS J2EE Clustering

Multicast is used to
Derive cluster membership
Failure to receive 3 heartbeats mark server dead

Service advertisement

www.fandsindia.com

WLS J2EE Clustering


Naming Service Stateless Services


Stateless session beans

Stateful Services
HTTP Sessions Stateful session beans Entity Beans

JMS
www.fandsindia.com

WLS J2EE Clustering/Naming Service

DNS Based Naming Service OpenBSD Based Naming Service

www.fandsindia.com

WLS J2EE Clustering/Naming Service


DNS Based Naming Service DNS does initial connection load balancing Unique address per server 1 address that resolves to all server addresses
Limited to round-robin Performance dependent on DNS servers specs No health checks
www.fandsindia.com

WLS J2EE Clustering/Naming Service


OpenBSD based Naming Service
PacketFilter does initial connection load balancing

Unique address per server


Round-robin, source-address hash, bitmask, random Inexpensive to make redundant Flexible health checks

http://dev2dev.bea.com/codelibrary/code/openb sd_lb.jsp
www.fandsindia.com

Every server in the cluster provides the same JNDI tree view Changes to the local JNDI tree will be sent to the entire cluster via multicast. Objects bound in JNDI should either be Remote or Serializable to get replicated.
www.fandsindia.com

WLS J2EE Clustering/Naming Service

WLS J2EE Clustering/Naming Service

Prior to 8.1, JNDI service replication is only done using multicast In 8.1, it is a combination of multicast and point-to-point connection
JNDI tree synchronization is way faster No more multicast storms
www.fandsindia.com

WLS J2EE Clustering/Naming Service

Useful flags: Controlling JNDI object replication


RMI objects: Hashtable h = new Hashtable(); h.put(weblogic.jndi.replicateBindings, false); or h.put(WLContext.REPLICATE_BINDINGS, false); or Environment env = new Environment(); env.setReplicateBindings(false); www.fandsindia.com EJBs: clients-on-same-server=true in weblogic

WLS J2EE Clustering/Naming Service

Useful flags:
Cluster attribute MemberWarmupTimeoutSeconds
Discover & sync in 7.0 is 60 seconds Discover & sync in 8.1 is 30 seconds At most 30 seconds in Diablo.

www.fandsindia.com

WLS J2EE Clustering / EJBs


For high availability

Make your EJBs cluster-aware Mark business methods idempotent (where possible)
Duplicate requests has no negative side-effects weblogic.rmic flag -methodsAreIdempotent for RMI objects <!ELEMENT idempotent-methods (method*)> in weblogic ejb deployment descriptor. www.fandsindia.com

WLS J2EE Clustering / EJBs


For scalability
Choose appropriate load balancing policy Can be defined at the cluster level

Algorithms
Round robin Random Weight Server Affinity
www.fandsindia.com

WLS J2EE Clustering / EJBs


Server Affinity

The server affinity algorithms consider existing connections between an external Java client and server instances in balancing the client load among WebLogic server instances In the case of failure, causes the client to failover to a server instance to which it has an open connection
www.fandsindia.com

WLS J2EE Clustering / Stateless Services


Stateless Session Beans

Scales well Easy to provide multiple instances of the same service Easy to provide load balancing and failover The methods on stateless session bean home are marked idempotent weblogic.ejbc compiler
www.fandsindia.com

WLS J2EE Clustering / Stateful services


Stateful Session EJB

Pinned to one server May be replicated to improve fault-tolerance May lose some or all state in unusual failures If using replication, idempotent methods improve availability

www.fandsindia.com

WLS J2EE Clustering / Stateful services


Entity EJB

Use Optimistic Caching for EJBs When appropriate use read-only beans
EJBC tags all methods as idempotent
www.fandsindia.com

WLS J2EE Clustering / Stateful services


HTTP Session Persistence Algorithms

In Memory Replication Database based session persistence File based session persistence
www.fandsindia.com

WLS J2EE Clustering / Stateful services


In Memory Replication: State is replicated to secondary server in a cluster setAttribute(), removeAttribute() trigger state replication Pros:
Scales really well Reliable

Cons
Might lose state
www.fandsindia.com

WLS J2EE Clustering / Stateful services

Configuration Aspects
Replication Groups Assign server to machine

Criteria for secondary server selection


Different Machine, Preferred Replication Group Different Machine, Not in Preferred Replication Group Same Machine, Preferred Replication Group Same Machine, Not in Preferred Replication Group

Automatic secondary placement in next www.fandsindia.com release

WLS J2EE Clustering / Stateful services

Database based session persistence


Very reliable Slower than In Memory Replication Number of DB connections proportional to load

File based session persistence


As reliable as the file system Scalability might be a problem Slowest of all the persistent schemes
www.fandsindia.com

WLS J2EE Clustering / Stateful services

Diablo HTTP Session Debugging features


Size of each serializable/remote object in session Identify non-serializable objects in session.
www.fandsindia.com

WLS J2EE Clustering / Deployment


Single Tier Architecture
EJBs & Servlets are co-located in the same server. Advantages Easier to manage Simpler application design Increases availability by hosting each service on every server Best performance Disadvantages Scaling individual tiers is not possible
www.fandsindia.com

WLS J2EE Clustering / Deployment


Two Tier Architecture
EJBs & Servlets are in different servers. Advantages Allows individual tier scaling Disadvantages Less Locality More complex design Performance overhead
www.fandsindia.com

LETS DO IT

Set up node manager


Create a Cluster Add machines to Cluster Add Servers to Cluster Start Servers in Cluster Monitor Cluster Deploy a application in Cluster Proxy Server
www.fandsindia.com

Day 5

Monitoring (Application, Server) SNMP JMX Config and Runtime MBeans Backup and Restore Performance Tuning

www.fandsindia.com

Monitoring (Applications, Server)


Connection Pools JMS Applications Domain Cluster Reading and filtering log JRockit
www.fandsindia.com

SNMP

An Administration Server has the ability to function as a Simple Network Management Protocol (SNMP) agent. The Weblogic SNMP agent runs as a service that responds to requests from SNMP managers and sends SNMP trap notifications to SNMP managers. This page allows you to define the SNMP configuration of this Weblogic Server domain.

www.fandsindia.com

SNMP Agents Role in WLS Domain

www.fandsindia.com

JMX Config and Runtime MBeans


Resources on WebLogic Server instances use Java Management Extensions (JMX) Managed Beans (MBeans) to expose their management functions. An MBean is a concrete Java class that is developed in accordance with JMX specifications. It can provide getter and setter operations for each management attribute within a managed resource along with additional management operations that the resource makes www.fandsindia.com available.

JMX Config and Runtime MBeans


WebLogic Server MBeans that expose the configuration data of a managed resource are called Configuration MBeans while MBeans that provide performance metrics and other information about the runtime state of a managed resource are called Runtime MBeans. E.g. a ServerMBean Configuration MBean indicates the listen port for a server instance while the ServerRuntimeMBean Runtime MBean indicates the current lifecycle state of a www.fandsindia.com server instance.

Backup and Restore

Backup of Config file


Previous version Start of the server

Backing up security data


Import / export

Restarting Servers
Admin Managed
www.fandsindia.com

Performance Tuning

Basic Terminologies

Performance
Response Time a time metric Throughput A rate metric (requests per unit of time) e.g. requests per second Resource Utilization

Scalability
Users Data
www.fandsindia.com

Load and Stress Testing

Load Testing
Test the application for concurrent request loads

Stress Testing
Test systems limits E.g. max concurrent users, max data volume

Performance Testing
www.fandsindia.com

Benchmark

A benchmark is a performance measurement of a system meant for use in comparisons Benchmark should be as realistic as possible
Database access Test environment similar to production environment
www.fandsindia.com

Steps

Preparing a metrics Reporting the results in predefined, well-planned, tabular format Store it in the database Methodologies

www.fandsindia.com

Methodology

www.fandsindia.com

Tools

Performance Testing Tools Os-specific monitoring tools The Grinder

www.fandsindia.com

Performance Testing Tools


Load Runner E-load Silk performer

www.fandsindia.com

Os-specific monitoring tools

Windows
Windows Task Manager Windows Performance Monitor

Unix
sar Mpstat Vmstat,Netstat,Iostat
www.fandsindia.com

The Grinder

Typical general purpose load testing Open Source Installing and load testing grinder See example

www.fandsindia.com

JVM Tuning and JRockit

JVM tuning
Parameters
-ms384m -mx400m

Monitoring JVM memory JRockit


Advantages Monitoring
www.fandsindia.com

QUESTION / ANSWERS

www.fandsindia.com

THANKING YOU !

www.fandsindia.com

Das könnte Ihnen auch gefallen