J2EE: Best Practices for Application Development and Achieving High-Volume Throughput. Michael S Pallos, MBA Session: 3567, 4:30 pm August 11, 2003

Similar documents
J2EE Development. Course Detail: Audience. Duration. Course Abstract. Course Objectives. Course Topics. Class Format.

The team that wrote this redbook

IBM WebSphere Application Server 8. Clustering Flexible Management

IBM WebSphere Application Server V4.0. Performance. 10/02/01 Copyright 2001 IBM Corporation WS40ST11.prz Page 248 of of 28

WebSphere 4.0 General Introduction

Introduction. Enterprise Java Instructor: Please introduce yourself Name Experience in Java Enterprise Edition Goals you hope to achieve

WebSphere Application Server - Overview

Vision of J2EE. Why J2EE? Need for. J2EE Suite. J2EE Based Distributed Application Architecture Overview. Umair Javed 1

GlassFish v2.1 & Enterprise Manager. Alexis Moussine-Pouchkine Sun Microsystems

TUTORIAL: WHITE PAPER. VERITAS Indepth for the J2EE Platform PERFORMANCE MANAGEMENT FOR J2EE APPLICATIONS

Fast Track to Java EE 5 with Servlets, JSP & JDBC

Oracle 10g: Build J2EE Applications

WAS: WebSphere Appl Server Admin Rel 6

WebSphere Performance

Fast Track to Java EE

Websphere Server 8.5 Best Practices Oracle FLEXCUBE Universal Banking Release [December] [2016]

SUN Sun Certified Enterprise Architect for J2EE 5. Download Full Version :

Market leading web application server product

WebSphere Application Server V7: Session Management

In the most general sense, a server is a program that provides information

1Z Oracle. Java Enterprise Edition 5 Enterprise Architect Certified Master

Inside WebSphere Application Server

Distributed Multitiered Application

Performance Best Practices Paper for IBM Tivoli Directory Integrator v6.1 and v6.1.1

WebSphere Application Server, Version 5. What s New?

status Emmanuel Cecchet

Administering the JBoss 5.x Application Server

NetBeans IDE Field Guide

Contents at a Glance. vii

Rational Application Developer 7 Bootcamp

It Is a Difficult Question! The Goal of This Study. Specification. The Goal of This Study. History. Existing Benchmarks

IBM. Enterprise Application Development with IBM Web Sphere Studio, V5.0

Implementing a Web Service p. 110 Implementing a Web Service Client p. 114 Summary p. 117 Introduction to Entity Beans p. 119 Persistence Concepts p.

index_ qxd 7/18/02 11:48 AM Page 259 Index

Chapter 6 Enterprise Java Beans

Exam Name: IBM Certified System Administrator - WebSphere Application Server Network Deployment V7.0

WEBSPHERE APPLICATION SERVER

Deccansoft Software Services. J2EE Syllabus

J2EE DIAGNOSING J2EE PERFORMANCE PROBLEMS THROUGHOUT THE APPLICATION LIFECYCLE

ClearPath Secure Java Overview For ClearPath Libra and Dorado Servers

ORACLE IDENTITY MANAGER SIZING GUIDE. An Oracle White Paper March 2007

WA2097 WebSphere Application Server 8.5 Administration on Linux EVALUATION ONLY

GemStone Systems. GemStone. GemStone/J 4.0

Sun Java System Application Server 8.1: Administration & Deployment

JAVA Training Overview (For Demo Classes Call Us )

Adapter for Mainframe

White Paper. Major Performance Tuning Considerations for Weblogic Server

Data Management in Application Servers. Dean Jacobs BEA Systems

EJB ENTERPRISE JAVA BEANS INTRODUCTION TO ENTERPRISE JAVA BEANS, JAVA'S SERVER SIDE COMPONENT TECHNOLOGY. EJB Enterprise Java

ORACLE DATA SHEET KEY FEATURES AND BENEFITS ORACLE WEBLOGIC SUITE

Course Content for Java J2EE

COPYRIGHTED MATERIAL

/ / JAVA TRAINING

SPEC Enterprise Java Benchmarks State of the Art and Future Directions

ManageEngine Applications Manager 9. Product Features

Type of Classes Nested Classes Inner Classes Local and Anonymous Inner Classes

J2EE - Version: 25. Developing Enterprise Applications with J2EE Enterprise Technologies

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

Architecting Java solutions for CICS

BEAWebLogic Server. Introduction to BEA WebLogic Server and BEA WebLogic Express

WebSphere Application Server for z/os I'm Not a Dummy But...

As you learned in Chapter 1, the architectural variations you can construct using

Appendix A - Glossary(of OO software term s)

Application Servers in E-Commerce Applications

Developing Java TM 2 Platform, Enterprise Edition (J2EE TM ) Compatible Applications Roles-based Training for Rapid Implementation

Advanced Java Programming

WebSphere Portal Application Development Best Practices using Rational Application Developer IBM Corporation

Appendix C WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

COURSE DETAILS: CORE AND ADVANCE JAVA Core Java

Index. Note: Boldface numbers indicate illustrations; t indicates a table. 771

Diplomado Certificación

Oracle WebLogic Server 12c: Administration I

ive JAVA EE C u r r i c u l u m

Oracle9iAS Tech nicaloverview

Server for IBM i. Dawn May Presentation created by Tim Rowe, 2008 IBM Corporation

Java Enterprise Edition

Oracle Enterprise Manager. 1 Before You Install. System Monitoring Plug-in for Oracle Unified Directory User's Guide Release 1.0

BlackBerry Enterprise Server for IBM Lotus Domino Version: 5.0. Administration Guide

X100 ARCHITECTURE REFERENCES:

Enterprise Java Unit 1-Chapter 2 Prof. Sujata Rizal Java EE 6 Architecture, Server and Containers

High availability deployment scenario for WebSphere Information Integrator Content Edition

Enterprise Software Architecture & Design

... HTTP load balancing for Oracle s JD Edwards EnterpriseOne HTML servers using WebSphere Application Server Express Edition

Overview p. 1 Server-side Component Architectures p. 3 The Need for a Server-Side Component Architecture p. 4 Server-Side Component Architecture

Vendor: SUN. Exam Code: Exam Name: SUN Certified ENITRPRISE ARCHITECT FOR J2EE(tm)TECHNOLOGY. Version: Demo

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

iseries & WebSphere Express

WebSphere Application Server - Overview

Services Oriented Architecture and the Enterprise Services Bus

Java Performance: The Definitive Guide

1 Performance Optimization in Java/J2EE

IBM Operational Decision Manager Version 8 Release 5. Configuring Operational Decision Manager on WebLogic

Component-Based Software Engineering. ECE493-Topic 5 Winter Lecture 26 Java Enterprise (Part D)

Process Choreographer: High-level architecture

JAVA & J2EE UNIT -1 INTRODUCTION

Leverage Rational Application Developer v8 to develop Java EE6 application and test with WebSphere Application Server v8

[Course Overview] After completing this module you are ready to: Develop Desktop applications, Networking & Multi-threaded programs in java.

PSD1B Advance Java Programming Unit : I-V. PSD1B- Advance Java Programming

SPECjAppServer2002 Statistics. Methodology. Agenda. Tuning Philosophy. More Hardware Tuning. Hardware Tuning.

Index. attributes, visual modeling of, , 565, 566, 567, 568 authentication, Authorization Constraint wizard, , 396

Transcription:

J2EE: Best Practices for Application Development and Achieving High-Volume Throughput Michael S Pallos, MBA Session: 3567, 4:30 pm August 11, 2003

Agenda Architecture Overview WebSphere Application Server scalability A proven design pattern Servlets and Java Server Pages Sessions Memory usage

Agenda (continued) Enterprise Java Beans Connecting to legacy systems and databases Connection Pooling Prepared Statements Session Database Java Database Connector (JDBC) Systems Management

Architectural Overview WebSphere Application Server 3.5 & 4.x 5.x

WAS Architecture (3.5 & 4.x) GUI Client PC Web Browser HTTP(S) WAS Admin Console Java Admin Console http://localhost:9090/admin HTTP(S) HTTP Server Plug-in plugin-cfg.xml IIOP Embedded HTTP Server Servlet JSP Web Container Admin Server EJB EJB Container Application Server - JVM Application Database Administration Repository CMD WebSphere Control Program (WSCP) XMLConfig Admin Server - JVM Node (machine)

WAS Architecture (5.x) Client PC HttpServer1 AppServerX Web Browser HTTP(S) HTTP Server Application Instance (JVM) Servlet Container Plug-in plugin-cfg.xml HTTP(S) Embedded HTTP Server Servlet JSP Application Database WAS Administrative Console Standard J2EE 1.3 Web App wsadmin Scripting command line Tool (BSF & JMX based) EJB EJB Container XML Configuration Files

Application Server Clones Server Groups Templates Application server and contents Changes to group propagate to all clones Not JVMs and Not Application Servers Clones Exact Copy configured/functional application server Managed by parent server group Vertical Clones Additional running copy of Application Server on same node Horizontal Clone Additional running copy of Application Server on different node

Vertical Cloning Web Browser Client HTTP(S) Servlets JSPs Web Container EJBs EJB Container Application Server #1 Clone A - JVM Application Database HTTP Server Plug-in plugin-cfg.xml Machine #1 Servlets JSPs Web Container EJBs EJB Container Application Server #1 Clone B - JVM Admin Server - JVM Node (machine #2) Administration Repository

Vertical Cloning Strengths Improved throughput on large machines Easy to maintain and support Weaknesses Limited available resources on single machine Threats Single point of failure Memory/CPU overhead if have too many clones Opportunities Can be combined with other topologies

Horizontal Cloning Web Browser Client HTTP(S) Servlets JSPs Web Container EJBs Application Server #1 Clone A - JVM Admin Server - JVM Node (machine #2) EJB Container Application Database HTTP Server Plug-in plugin-cfg.xml machine #1 Servlets JSPs Web Container EJBs EJB Container Application Server #1 Clone A - JVM Admin Server - JVM Node (machine #3) Administration Repository

Horizontal Cloning Strengths Distribution of load among machines Failover support if one machine goes down More machines provide more CPU power Weaknesses More difficult to setup and maintain More $$ for hardware and software Threats Requires session persistency Increased network traffic between machines Opportunities Can increase number of machines as needed, highly scalable

Design Pattern Model View Controller

Design Pattern MVC Model responsible for the data or business process (persistence/business logic) View responsible for the user s display (CUI/GUI) Controller is responsible for the flow of the application (traffic cop)

Model-View-Controller View Controller Model HTML Request Servlet Beans Cookie Submit Forward DB HTML Response JSP Beans

Servlets & Java Server Pages (JSP)

Servlets & JSP Small, thin Servlets 50 < Lines of code Avoid single-threaded Avoid System.Out.Println() Avoid string concatenation Use Java StringBuffer Avoid Serialization Synchronize statements are costly

Synchronize statements 60 HTTP Requests/Sec (Hundreds) 50 40 30 20 10 0 www.developer.ibm.com No synchronization Synchronization

Sessions

Sessions Keep session objects small < 2k Designing session data Life of Session Persistent session as dedicated data source Single row persistence Multi row persistence w/ a large field Keep large object graphs out

Sessions (continued) Do not create HttpSession objects by default on JSPs Even though it is part of J2EE spec Use <%@page session= false %> Writing your own JDBC calls

Data Source & Backend Systems Data Source Connection Pooling Prepare Statements Session Database Java Database Connector (JDBC)

Data Source Set up data-source once Object initialization phase Servlet.init(), ejbactive() Release to connection pool

Data Source Caching HTTP Requests/Sec (Hundreds) 80 70 60 50 40 30 20 10 www.developer.ibm.com 0 Cached Datasource Non-cached Datasource

Connection Pooling Obtain and close the connection in the same method JNDI lookups are expensive Do not declare connections as static objects Do not close connections in the finalize method If you open a connection, close the connection Do not manage data access in Container Managed Persistence (CMP) beans

Connection Pooling HTTP Requests/Sec (Hundreds) www.developer.ibm.com 80 70 60 50 40 30 20 10 0 Conn. Pooling No Conn. Pooling

Prepared Statements Statement Compiled prior to execution Prepared Statement Separates the compilation process and adding substitution variables Use this one! Callable Statement Removes SQL entirely by making a Stored Procedure Call

How is SQL effecting CPU?

Session Persistence Enable session persistence Reduce session size Release HttpSession when finished Choose persistence options Avoid creating HttpSession by JSP default <%@page session= false %> Tune the cache size

Session Persistence Cache Exceeded (1000 Default) Yes Overflow Configured (Default) Yes Add Until Heap is Exceeded No Cache! No Persistence No Input Waits Until Sessions Expire In-memory cache overflow algorithm. Yes Persist!

Session Persistence (continued) Tune the cache size Add additional application server clones Tune the session timeout interval Tune multi-row persistence management Simplified multi-row session representation. Session Web Property Small Value Big Value ID Application AB12345 CandleDemo CandleDemo.First.Name Michael AB12345 CandleDemo CandleDemo.last.Name Pallos AB12345 CandleDemo CandleDemo.String A huge string

JDBC Choose your driver wisely JDBC API levels supported JDBC 1.0 is the default JDBC 2.0 is required by WAS Select a Type 2 JDBC driver When incorporating distributed transactions and cataloged databases, Type 2 JDBC driver offers the best performance.

DB Connections

Memory Usage

Memory Usage Allocation Avoid dynamic allocation Hidden object creation Streams Print writer Garbage collections Pool and reuse objects Servlet guideline < 50 lines of code Health checks Watch for memory usage growth Small page size Small message size

Enterprise Java Beans (EJB)

Enterprise Java Beans One size DOES NOT fit all Ensure you need distributed objects Alternative to Entity beans Tactical Non-Scalable Access Entity beans from Session beans Triple performance as opposed to accessing directly from client Reduces the number of remote method calls Single transaction context

Accessing Entity Beans 30 HTTP Requests/Sec (Hundreds) 25 20 15 10 www.developer.ibm.com 5 0 Access from Client Code Access via Session Bean

Enterprise Java Beans Read-Only getter methods / Access Intent Reduce Tx Level TRANSACTION_READ_UNCOMMITTED TRANSACTION_READ_COMMITTED TRANSACTION_REPEATABLE_READ TRANSACTION_SERIALIZABLE Cache EJB Home Reduce JNDI calls

EJB Caching HTTP Requests/Sec (Hundreds) www.developer.ibm.com 70 60 50 40 30 20 10 0 Client Code Home Caching Session Bean

Thread Pools Create thread pool funnel Minimize the size of thread pools Web Browser Client Request for Static Pages & Listener Threads Pool Servlet/JSP Thread Pool Database Connection Pool Dynamic Pages Queue Queue 100 20 10 Static Pages Dynamic Pages Servlet Threads Requesting DB Connections Application Database HTTP Server & plug-in Application Server Web Container EJB Container Data Source

Monitoring Tools What to look for. Analyst Recommendations.

Monitoring Tools Customer (End-User) Experience End-To-End (More than just J2EE environment) Latency Time WebSphere Application Server Instrumentation (class loader hooks) Workflow Analysis IBM API (PMI) Application Server Log SMF 120 Records (mainframe)

Monitoring Tools (continued) Legacy Systems CICS IMS Database Connection Pools DBMS

WebSphere Application Server Source:

Summary Distributed Applications are Complex A proven design pattern Servlets and Java Server Pages (JSP) Sessions Connecting to legacy systems and databases Connection Pooling Prepared Statements Session Database Java Database Connector

Summary Distributed Applications are Complex Memory usage Enterprise Java Beans Solid Monitoring Tool Hire Experience (consultants) Follow road to success Architecture Development Testing Deployment (Migration) Monitoring Best Practices

Questions E-mail: Michael_Pallos@candle.com

Thank you for your participation WebSphere Advisor, Nov/Dec 2002 Best Practices: Application Performance http://advisor.com/doc/10050 WebSphere Advisor, April 2003 5 Java Performance Best Practices http://advisor.com WebSphere Developers Journal, May/June 2003 Best Practices: WAS / DBMS Persistence http://www.candle.com (Link from home page, Aug 03) Webinar expoq Dailey Best Practices: J2EE http://www.ebizq.net/expoq/events/event22.html

A note from Legal This presentation represents customer's use of Candle's products. Because each customer's systems, uses and needs are different, Candle does not guarantee comparable results. Candle does not warrant the accuracy of information provided by customers or Candle's business partners. If a product mentioned herein is not yet generally available to Candle's commercial customers, Candle has no obligation to develop the product, to commercially release it, or to incorporate any features or functionalities of the product into any future commercially released product. Other product names and terms in this document may be trademarks of their respective companies. -- Candle Corporation Legal Department