Jonathan Maron Principal Product Manager Oracle Corporation.

Slides:



Advertisements
Similar presentations
Question examples. Session 1 Objectives Why certify? Positioning of the non-technical version What is Java? Key advantages of Java Java Applications vs.
Advertisements

January 30, 2014 Copyright Jim Farley Beyond JDBC: Java Object- Relational Mappings Jim Farley e-Commerce Program Manager GE Research and Development
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
3 Copyright © 2005, Oracle. All rights reserved. Designing J2EE Applications.
Module 13: Performance Tuning. Overview Performance tuning methodologies Instance level Database level Application level Overview of tools and techniques.
Web Performance Tuning Lin Wang, Ph.D. US Department of Education Copyright [Lin Wang] [2004]. This work is the intellectual property of the author. Permission.
Web Services Development made easy Olivier Le Diouris Principal Product Manager.
J2EE Architecture Overview
Apache Struts Technology
An architecture for webb applications, J2EE
Integrating SOA and the Application Development Framework Shaun O’Brien Principal Product Manager – Oracle JDeveloper / ADF.
BICS546 Client/Server Database Application Development.
Enterprise Applications & Java/J2EE Technologies Dr. Douglas C. Schmidt Professor of EECS.
Time Scalability Single User Unlimited Users 100s of Users Several Users PC based Single user Late 1980sNow PC based, file-level locking Single user or.
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
Layers & Tiers Umair Javed Lec - 41.
J2EE vs..NET Nigam Patel. Topics Background –Web Services, J2EE and.NET Similarities Differences Conclusion –Pros and Con (J2EE and.NET)
Advanced Distributed Software Architectures and Technology group ADSaT 1 Application Architectures Ian Gorton, Paul Greenfield.
Introduction to EJB INFORMATICS ENGINEERING – UNIVERSITY OF BRAWIJAYA Eriq Muhammad Adams J
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
Web-based Software Development - An introduction.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
1 INTRO TO BUSINESS COMPONENTS FOR JAVA (BC4J) Matt Fierst Computer Resource Team OracleWorld Session
EJB Overview Celsina Bignoli Distributed Business Applications Server DB Client DB Server DB.
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
How to Deploy, Monitor and Manage Middle-Tier Applications Lars Ewe, Principal Product Manager Valerie K. Kane, Group Manager Oracle Corporation Session.
PowerTier EJB in High-Performance Applications John Killoran European Technical Services Manager Persistence Software.
Ing. Ignacio Roqueta ARTech GeneXus and J2EE.
Oracle9 i JDeveloper for Database Developers and DBAs Brian Fry Principal Product Manager Oracle JDeveloper Oracle Corporation.
Modern Software Technologies Java™, J2EE™, JSP™, JDBC™ by Radoslav Tr. Ivanov
Gregory Leake Microsoft Corporation May 15, 2009.
Enterprise JavaBeans. What is EJB? l An EJB is a specialized, non-visual JavaBean that runs on a server. l EJB technology supports application development.
Introduction to J2EE Architecture Portions by Kunal Mehta.
Session Beans INFORMATICS ENGINEERING – UNIVERSITY OF BRAWIJAYA Eriq Muhammad Adams J
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
The New Enterprise Manager: End to End Performance Management of Oracle Solutions Julie Wong Principal Product Manager Arsalan Farooq Senior Development.
Managing the Oracle Application Server with Oracle Enterprise Manager 10g.
Deploy With Confidence Minimize risks Improve business output Optimize resources.
Measuring Application Server Performance using ECperf David Lucas President Lucas Software Engineering, Inc
CENTRALISED AND CLIENT / SERVER DBMS. Topics To Be Discussed………………………. (A) Centralized DBMS (i) IntroductionIntroduction (ii) AdvantagesAdvantages (ii)
1 Copyright © 2004, Oracle. All rights reserved. Oracle Application Development Framework.
© 2006 by IBM and Naci Dai; made available under the EPL v1.0 | Santa Clara | Mar. 20, 2006 Java™ Web Application Development with Eclipse WTP - WTP Quick.
1 Distributed System using J2EE. 2 What is J2EE?  J2EE (Java2 Enterprise Edition) offers a suite of software specification to design, develop, assemble.
EJB Enterprise Java Beans JAVA Enterprise Edition
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
Building J2EE Applications Based on Design Patterns with Business Components for Java Olivier LE DIOURIS Principal Product Manager Oracle Corporation.
2 Copyright © Oracle Corporation, All rights reserved. Basic Oracle Net Architecture.
J2EE Platform Overview (Application Architecture)
Web-based Software Development - An introduction
SPECjAppServer2004 Scott Oaks Java Enterprise Performance.
Java Servlets By: Tejashri Udavant..
EADD – Introduction Chapter -1.
Introduction to J2EE Architecture
Design and Maintenance of Web Applications in J2EE
Web-Services-based Systems Architecture, Design and Implementation
Distributed System Using Java 2 Enterprise Edition (J2EE)
Computer Based Adaptive Testing
Java™ Web Application Development with Eclipse WTP - WTP Quick Tour
End-user measurement combined with deep technical visibility
Web Application Server 2001/3/27 Kang, Seungwoo. Web Application Server A class of middleware Speeding application development Strategic platform for.
Java™ Web Application Development with Eclipse WTP - WTP Quick Tour
Knowledge Byte In this section, you will learn about:
Java™ Web Application Development with Eclipse WTP - WTP Quick Tour
Component-based Applications
Component Technology Bina Ramamurthy 2/25/2019 B.Ramamurthy.
Enterprise Java Beans.
Knowledge Byte In this section, you will learn about:
Presentation transcript:

Jonathan Maron Principal Product Manager Oracle Corporation

Tuning J2EE Applications Tier by Tier

Agenda Background Methodology J2EE Optimizations Performance Monitoring

Agenda Background Methodology J2EE Optimizations Performance Monitoring

Performance Issues Abound! 2003 Wily Benchmark Survey shows 60% of time Java applications fail to meet user expectations Only 42% of applications perform as planned during deployment 57% of application performance spent in data access 2004 Forrester 66% of time developers find out about performance problems from user calls!

J2EE Application Complexity Enterprise Information Systems Client Side Presentation Desktop Java Application Device J2EE Client Browser Pure HTML Java Applet J2EE Platform Web Server Server-Side Presentation JSP Servlet JSP J2EE Platform EJB Container Server-Side Business Logic EJB

Premature optimization is the root of all evil - Professor Sir Charles Anthony Richard Hoare There are two rules for when to optimize: 1. Don't do it. 2. (For experts only) Don't do it yet. There are two rules for when to optimize: 1. Don't do it. 2. (For experts only) Don't do it yet. - Michael Jackson, Principles of Program Design

Test driven design can lead to emergent optimization and code that is readily optimizable. If programmers develop test first, many of their upfront concerns about performance can be deferred. - Michael Feathers, Emergent Optimization in Test Driven Design

Agenda Background Methodology J2EE Optimizations Performance Monitoring

Methodical approach to performance evaluation Develop Identify Design Test Evaluate

Approach Tuning Issues Logically and Iteratively Java Virtual Machine Application Server Hardware and Operating System Applications Component Database Tuning and debugging are ongoing iterative processes. There are no magic bullets.

Dont Forget That There are Tools to Help Profilers Debuggers Code audits and metrics Load testing tools Vendor performance and configuration guidelines

Agenda Background Methodology J2EE Optimizations Performance Monitoring

Tuning JDBC Performance: Start with the Obvious Use connection pooling – Connection objects are expensive – Tailor min and max connections to your application Avoid cycling physical database connections – Look for database connections timing out Tune statement caching – Cache distinct SQL statements

No Connection Pooling RacingFacade J2EE Container create teamOrders... Make connection, do Query Return result and disconnect (unless application itself does connection pooling)

With Connection Pooling RacingFacade J2EE Container create teamOrders... Application uses available connections Connection Pooling From the Container

Tune Your SQL! Easier said than done – What is the real SQL running in CMP EJB? Look at the SQL on the wire – Tools like P6Spy, Oracle Enterprise Manager Become good friends with your DBA – Tune using traditional techniques Explain plan Tools like SQLPlus and Oracle9 i JDeveloper

D E M O N S T R A T I O N JDBC Performance

EJB - Locking-Mode and Isolation Pessimistic locking is generally slower – May be required for applications where data collisions are likely Increasing isolation decreases performance – Evaluate your data consistency requirements

Transactions and Performance Entity beans load/store data at transaction boundaries – Transactions settings affect how often database is accessed – Poor performance can be caused by transaction settings Rules of thumb – Always use transactions for entity bean methods – Scope the unit of work from a session bean

Session Bean - Tx:None Entity Bean - Tx:Required TopicSessionFacade createTopicSet printTopicSet deleteTopicSet Topic create findBy getTopicId getTopicDesc getTopicName setTopicId setTopicDesc setTopicName tx:Nonetx:Required System.out.println( "); for(int i=0;i<3;i++) { TopicLocal topic = topicHome.create( new Integer(i),("topic " + i)); topic.setDesc("desc" + i); } System.out.println( ");

Resulting Transactional Activity TopicBean: ejbCreate id = 0 TopicBean: ejbStore id = 0 TopicBean: ejbLoad id = 0 TopicBean: ejbStore id = 0 TopicBean: ejbCreate id = 1 TopicBean: ejbStore id = 1 TopicBean: ejbLoad id = 1 TopicBean: ejbStore id = 1 TopicBean: ejbCreate id = 2 TopicBean: ejbStore id = 2 TopicBean: ejbLoad id = 2 TopicBean: ejbStore id = 2 Tx create Tx setDesc Tx create Tx setDesc Tx create Tx setDesc Requires: 12 lifecycle calls

Session Bean - Tx:Required Entity Bean - Tx:Required TopicSessionFacade createTopicSet printTopicSet deleteTopicSet Topic create findBy getTopicId getTopicDesc getTopicName setTopicId setTopicDesc setTopicName tx:Required System.out.println( "); for(int i=0;i<3;i++) { TopicLocal topic = topicHome.create( new Integer(i),("topic " + i)); topic.setDesc("desc" + i); } System.out.println( ");

Resulting Transactional Activity TopicBean: ejbCreate id = 0 TopicBean: ejbCreate id = 1 TopicBean: ejbCreate id = 2 </Create Test TopicBean: ejbStore id = 0 TopicBean: ejbStore id = 1 TopicBean: ejbStore id = 2 Tx : createTopic Same code: 6 lifecycle calls

Take Advantage of Your EJB Container Configuration Specifies how long to keep stateless sessions cached in the pool.Stateless Session cache- timeout Specifies whether the container updates only modified fields or all fields to when ejbStore is invoked. Default true. CMP update- changedfield -only Multiple users can execute the entity bean in parallel. The container does not allow any updates to the bean's state. CMP read-only Recommend setting to false to avoid the extra select before insert which checks if the entity already exists before doing the insert. This will then detect a duplicate, if there is one, during the insert. CMP do-select- beforeinsert max-tx- retries Specifies the maximum time to wait for any resource that the EJB container needs before the container calls the EJB method (excluding DB). Session & Entity call- timeout Performance Characteristic ImpactedTypeExample Parameter Session & Entity Specifies the number of times to re-try a transaction that was rolled back due to system level failures.

Tuning Servlet Performance: Load on Startup Increases application start-up time but decreases first-request latency for servlets How? – Add sub-element in http-website.xml to load the entire web module on startup – Add sub-element to the element in web.xml to load the servlet on startup

Tuning JSP Performance: Pre-Translation Pre-compile JSPs into.class files ahead of time In Oracle Application Server, ojspc provides this functionality – jsp, and.java – Batch compilation of war, jar, ear and zip files % ojspc -dir /myapp/mybindir -srcdir /myapp/mysrcdir MyPage.sqljsp MyPage2.jsp % ojspc -deleteSource myapp.war

Use HTTPSession Appropriately Minimize the objects you store in HTTPSession – Takes up memory – Expensive serialization/deserialization if you use persistence/replication – Use transient variables to reduce serialization overhead Reduce default session timeout by using HttpSession.setMaxInactiveInterval() Remove session objects when no longer in use Use in JSP pages where you do not need a session

Look for Bottlenecks with Load Testing Tools Mercury Loadrunner Open source – Apache JMeter – Grinder Altaworks Panorama …

Scalability under varying load

Manage Application Server JVMs and Requests Per Application Load balance across server instances OC4J Process 2 JVM OC4J Process 1 JVM OC4J Instance HTTP Requests......

D E M O N S T R A T I O N Apache JMeter

Threads – more arent necessarily better! The optimum number of threads required will probably vary based on application makeup and load Reduction of thread contention is key – Iterative process Dont get discouraged!

More threads – more contention!

Objects – be economical! Object creation is expensive – Especially exceptions Assess whether unnecessary object creation is occurring

JVM Tuning A number of hotspot VM options are available for tuning – -Xms, -Xmx, -Xmn, -XX:SuvivorRatio,… Some platform vendors provide additional options – HP: -XX:+ForceMmapReserved Some platforms are not properly tuned out of the box for Java processing

Garbage Collection Change the JVM Heap size – java –jar –Xms256m –Xmx256m oc4j.jar Monitor collection cycles – verbose:gc – Profiling of heap JDK 1.5 Jconsole Intel Vtune HPJtune...

Agenda Background Methodology J2EE Optimizations Performance Monitoring

Optimization doesnt end with deployment Monitoring tools key to continued application responsiveness – Oracle Enterprise Manager – HP OpenView –...

Oracle Enterprise Manager

Final Thoughts Performance tuning is an iterative process An object pool is not always faster Do not add threads haphazardly Exceptions are expensive

Shameless Self Promotion