Performance Analysis for Java™ Web Sites

Book description

How well a Web site performs while receiving heavy user traffic is an essential factor in an organization's overall success. How can you be sure your site will hold up under pressure?

Performance Analysis for Java™ Web Sites is an information-packed guide to maximizing the performance of Java-based Web sites. It approaches these sites as systems, and considers how the various components involved, such as networks, Java™ Virtual Machines, and backend systems, potentially impact overall performance. This book provides detailed best practices for designing and developing high-performance Java Web applications, and instructions for building and executing relevant performance tests to gauge your site's ability to handle customer traffic. Also included is information on how to use the results of performance testing to generate accurate capacity plans.

Readers will find easy-to-understand explanations of fundamental performance principles and terminology. The book runs through performance profiles for common types of Web sites, including e-commerce, B2B, financial, and information exchange. Numerous case studies illustrate important ideas and techniques. Practical throughout, the book also offers a discussion on selecting the right test tools and troubleshooting common bottlenecks frequently revealed by testing.

Other specific topics include:

  • Performance best practices for servlets, JavaServer Pages™, and Enterprise JavaBeans™

  • The impact of servlets, threads, and queuing on performance

  • The frozen Web site danger

  • Java™ Virtual Machine garbage collection and multithreading issues

  • The performance impact of routers, firewalls, proxy servers, and NICs

  • Test scenario and script building

  • Test execution and monitoring, including potential pitfalls

  • Tuning the Web site environment

  • Component monitoring (servers, Java™ Virtual Machines, and networks)

  • Symptoms and solutions of common bottleneck issues

  • Analysis and review of performance test results

  • Performance Analysis for Java™ Web Sites not only provides clear explanations and expert practical guidance, it also serves as a reference, with extensive appendixes that include worksheets for capacity planning, checklists to help you prepare for different stages of performance testing, and a list of performance-test tool vendors.



    0201844540B08142002

    Table of contents

    1. Copyright
    2. Figures and Listings
      1. Listings
    3. Foreword
    4. Introduction
    5. Acknowledgments
    6. 1. Basic Performance Lingo
      1. Measurement Terminology
        1. Load: Customers Using Your Web Site
          1. Traditional Store
          2. On-Line Store
          3. Concurrent Load: Users Currently Using the Web Site
            1. Traditional Store
            2. On-Line Store
          4. Active Load: Customers Making Requests of the Web Site
            1. Traditional Store
            2. On-Line Store
          5. Peak Load: Maximum Concurrent Web Site Customers
            1. Traditional Store
            2. On-Line Store
        2. Throughput: Customers Served over Time
          1. Traditional Store
          2. On-Line Store
          3. Throughput Curve: Finding the Throughput Upper Bound
            1. Traditional Store
            2. On-Line Store
            3. Hit
            4. Transaction Rate
            5. Page Rate
            6. User Rate
        3. Response Time: Time to Serve the Customer
          1. Traditional Store
          2. On-Line Store
          3. Think Time
          4. Response Time Graph
            1. Traditional Store
            2. On-Line Store
          5. Steady State
            1. Traditional Bookstore
            2. On-Line Store
      2. Optimization Terminology
        1. Path Length: The Steps to Service a Request
          1. Traditional Store
          2. On-Line Store
        2. Bottleneck: Resource Contention under Load
          1. Traditional Store
          2. On-Line Store
        3. Scaling: Adding Resources to Improve Performance
          1. Vertical Scaling
            1. Traditional Store
            2. On-Line Store
          2. Horizontal Scaling
            1. Traditional Store
            2. On-Line Store
          3. Linear Scaling
            1. Traditional Store
            2. On-Line Store
      3. Summary
    7. 2. Java Application Server Performance
      1. Web Content Types
      2. Web Application Basics
        1. The Model-View-Controller Design Pattern
        2. Servlets
          1. Servlet Scope
          2. Servlet Operation
          3. Servlets, Threads, and Queuing
          4. The Frozen Web Site Danger
          5. Servlet Performance Tips
            1. Use Servlets to Control Application Flow
            2. Acquire Static Resources at Initialization
            3. Manage Servlet Logging
          6. File-Serving Servlets
        3. JavaServer Pages (JSPs)
          1. Basic JSP Runtime Operation
          2. JSP Performance Tips
            1. Reload Intervals
            2. HTTP Session Created by Default
            3. Precompile or Preclick
          3. Using JavaBeans and Custom Tags
            1. JavaBean and Custom-Tag Performance Tips
              1. Avoid bean.instantiate()
              2. Use a Database If You Need to Persist Bean Data
              3. Use Custom Tags in Your JSPs
            2. JSPs and XML/XSL
        4. Assorted Application Server Tuning Tips
          1. Load at Startup
          2. Web Container Thread Pool Size
          3. Servlet Reload
      3. Beyond the Basics
        1. HTTP Sessions
          1. HTTP Session Memory Usage
            1. HTTP Session Memory-Management Tips
              1. Preserve Data That Must Persist
              2. Perform Code Reviews
              3. Use Code-Profiling Tools
              4. Serialize the HTTP Session to a Stream
              5. Reduce HTTP Session Timeout
              6. Support a Logout Function
              7. Keep the HTTP Session Working Set in Memory
          2. Sharing HTTP Sessions
            1. HTTP Session Sharing Tips
              1. Keep HTTP Sessions Small
              2. Keep HTTP Session Data Serializable
              3. Avoid Nontransferable Data
        2. Enterprise JavaBeans (EJBs)
          1. EJB Performance Tips
            1. Use Stateless Session Beans as Façades
            2. Use Direct JDBC Calls
            3. Avoid Fine-Grained EJB Data Models
            4. Mark Methods as Read-Only
            5. Consider Scalability Issues of Stateful Session and Entity Beans
            6. Cache Bean Contents in Custom Finders
            7. Avoid EJB Passivation
            8. Cache Homes for EJBs
          2. Tuning EJB Containers
            1. Pool Size
            2. Cleanup Interval
            3. Transaction Isolation Level
            4. Local versus Remote Interfaces
            5. Message-Oriented Middleware (MOMs)
        3. Database Connection Pool Management
          1. Database Connection Management Tips
            1. Return the Database Connection to Its Pool Quickly
            2. Return Connections No Matter What Happens
            3. Use the Connection Pooling Feature
            4. “Custom” Connection Pool Managers versus Data Sources
        4. Web Services
          1. Use UDDI (Universal Description, Discovery and Integration) with Care
          2. Minimize SOAP Data Transfers
          3. Monitor Changing Web Site Usage Patterns
      4. Other Features
        1. Built-in HTTP Servers
        2. General Object Pool Management
          1. General Object Pool Management Tips
            1. Use Configurable Limits
            2. Never Wait Indefinitely Inside the Pool
            3. Set Pool Maximums
            4. Set a Maximum Wait for Thread Execution
        3. Multiple Instances: Clones
          1. Cloning Performance Tips
            1. Too Many Clones, Too Little Resource
            2. Scale Your Resources as You Add Clones
      5. Summary
    8. 3. The Performance Roles of Key Web Site Components
      1. Network Components
        1. Routers
        2. Firewalls
        3. Proxy Servers
        4. Network Interface Cards (NICs)
      2. Load Balancers
        1. Affinity Routing
      3. HTTP Servers
        1. Threads or Processes (Listeners)
        2. Timeouts
        3. Logging
        4. Keep-Alive
        5. Operating System Settings
          1. TCP/IP Timeouts
          2. File Descriptors
        6. SSL/HTTPS
        7. Plug-Ins
      4. Application Servers
        1. Security
      5. Databases and Other Back-End Resources
      6. Caching
      7. Web Site Topologies
        1. Vertical Scaling
        2. Horizontal Scaling
        3. Choosing between a Few Big Machines or Many Smaller Machines
          1. Get More of What You Already Have
          2. More Machines Means More Labor
          3. Machine Selection Impacts Licensing Fees
          4. Don't Forget Failover Costs
        4. Best Practices
      8. Summary
    9. 4. Java Specifics
      1. The Java Virtual Machine
        1. Heap Management
          1. Minimum and Maximum Heap Settings
          2. Tuning the Heap Settings
        2. Garbage Collection
          1. Minimizing Garbage
          2. Memory Leaks
      2. Java Coding Techniques
        1. Minimizing Object Creation
          1. String Usage
          2. Unused Local Variables
          3. Pooling
        2. Multi-Threading Issues
          1. Multi-Threaded Servlets
          2. Synchronization
      3. Summary
    10. 5. Performance Profiles of Common Web Sites
      1. Financial Sites
        1. Caching Potential
        2. Special Considerations
          1. Security
          2. Traffic Patterns
          3. Auditing
        3. Performance Testing Considerations
      2. B2B (Business-to-Business) Sites
        1. Caching Potential
        2. Special Considerations
          1. User Pressure
          2. Asynchronous Interactions
        3. Performance Testing a B2B Site
      3. e-Commerce Sites
        1. Caching Potential
        2. Special Considerations
          1. Traffic Patterns
          2. Security
        3. Performance Testing an e-Commerce Site
      4. Portal Sites
        1. Caching Potential
        2. Special Considerations: Traffic Patterns
        3. Performance Testing a Portal Site
      5. Information Sites
        1. Caching Potential
        2. Special Considerations: Traffic Patterns
        3. Performance Testing an Information Site
      6. Pervasive Client Device Support
        1. Caching Potential
        2. Special Considerations
          1. Traffic Patterns
          2. Conversion Overhead
        3. Performance Testing Sites That Support Pervasive Devices
      7. Web Services
      8. Summary
    11. 6. Developing a Performance Test Plan
      1. Test Goals
        1. Peak Load
        2. Throughput Estimates
          1. Hits per Day Estimates
            1. What Is a Hit?
            2. What Is a Day?
            3. Determining Peak Throughput from Hits per Day
          2. Users per Day Estimates
            1. What Is a User?
            2. Users as Hits
            3. All Day Visitors
            4. User Visits
            5. User Scenarios
            6. User Visit Projections
        3. Response Time Measurements
      2. Defining the Test Scope
        1. Building the Test
          1. Setup
          2. Simple-to-Complex Strategy
      3. Scalability Testing
      4. Building the Performance Team
        1. Quality Assurance People
        2. Web Application Programmers
        3. Web Application Architect
        4. System Administrators
        5. Network Administrators
        6. Systems Analysts
        7. Database Administrators
        8. Legacy Application Programmers
      5. Summary
    12. 7. Test Scripts
      1. Getting Started
        1. Pet Store Overview
        2. Determining User Behavior
        3. A Typical Test Script
      2. Test Scripts Basics
        1. Model the Real Users
        2. Develop Multiple, Short Scripts
        3. Write Atomic Scripts
        4. Develop Primitive Scripts
      3. Making Test Scripts Dynamic
        1. Support Dynamic Decisions
          1. Select from File
          2. Select Link by Random Number
        2. Dynamically Created Web Pages
          1. Using Link Numbers
          2. Using Link Names
        3. Dynamic Data Entry
        4. Provide Sufficient Data
          1. Exercise a Reasonable Percentage of the Dynamic Selections
          2. Choose from a Wide Selection of Dynamic Data Entry Values
      4. Building Test Scenarios
        1. Putting Scripts Together
        2. Use Weighted Testing
        3. Exercise the Whole Web Site
      5. Common Pitfalls
        1. Inaccuracies
        2. Hard-Coded Cookies
        3. Unsuitable Think Times
        4. No Parameterization
        5. Idealized Users
        6. Oversimplified Scripts
        7. Myopic Scripts
      6. Summary
    13. 8. Selecting the Right Test Tools
      1. Production Simulation Requirements
        1. Financial Web Site
        2. B2B Web Site
        3. e-Commerce Web Site
        4. Users
          1. Think Time
          2. Ability to Control User Load and Ramp-Up
          3. Browser Simulation and Caching
          4. Network Address Management
          5. Cookie Support
          6. Hardware and Platform Support
        5. Scripts
          1. Dynamic Data Support
          2. Parsing Dynamic Web Pages
          3. Scripting Language and Skills
          4. Building and Weighting Scenarios
          5. Reusing Test Scripts in Production
        6. Automation and Centralized Control
          1. Controlling Multiple Client Drivers
          2. Running Tests via Command Line or Remotely
        7. Pricing and Licensing
          1. Licensing Costs
          2. Ability to Share Users across Multiple Controller Machines
          3. Short-Term Licenses
          4. Existing Vendor Relationships
      2. Tool Requirements for Reproducible Results
        1. Reporting
          1. Key Results
          2. Steady-State Measurements
          3. Real-Time Reporting
          4. Multiple Runs
        2. Verification of Results
          1. Data Verification
          2. Log Verification
        3. Real-Time Server Machine Test Monitoring
          1. Integration with Performance Test Reporting
          2. Price
          3. Detailed Analysis and Problem Isolation
          4. Reusability in the Production Environment
      3. Buy versus Build
      4. Summary
    14. 9. Test Environment Construction and Tuning
      1. The Network
        1. Network Isolation
        2. Network Capacity
        3. e-Commerce Network Capacity Planning Example
        4. Network Components
        5. Network Protocol Analyzers and Network Monitoring
      2. The Servers
        1. Application Server Machines
        2. Database Servers
          1. Poor Database Software Configuration: Indexing
          2. Poor Database Software Configuration: Internal Resources
          3. Poor Database Software Configuration: Caching
          4. Poor Database Hardware Configuration: I/O Management
        3. Legacy Servers
          1. Host Database
      3. The Load Generators
        1. Master/Slave Configurations
        2. After the Performance Test
      4. Hardware and Test Planning
      5. Summary
    15. 10. Case Study: Preparing to Test
      1. Case Study Assumptions
      2. Fictional Customer: TriMont Mountain Outfitters
      3. An Introduction to the TriMont Web Site
        1. Site Requirements
        2. Initial Assessment
          1. The e-Commerce Profile
          2. Peak Site Users
        3. Next Steps
      4. Detailed TriMont Web Site Planning Estimates
        1. Calculating Throughput (Page Rate and Request Rate)
          1. Page Rate
          2. Network Traffic Mix
        2. Network Analysis
          1. Calculating Network Analysis Components
            1. User Arrival Rate
            2. Outbound Sustained Traffic
            3. Inbound Sustained Traffic
            4. Database Transfer
            5. HTTP Session Transfer
            6. Applet Transfer
            7. Total Transfers
          2. Using the Network Planning Worksheet
          3. Dial-up User Considerations
        3. HTTP Session Pressure
          1. Using the JVM Sizing Worksheet
        4. Test Scenarios
          1. Potential Test Scripts
          2. Test Scenario Considerations
        5. Moving Ahead
      5. Summary
    16. 11. Executing a Successful Test
      1. Testing Overview
      2. Test Analysis and Tuning Process
        1. Test and Measure
        2. Validate
          1. What Can Go Wrong?
            1. Shared Environment
            2. Short Runs
            3. Database Growth
            4. Too Much Variation in Workload Simulation
        3. Analyze
        4. Tune
      3. Test Phases
        1. Phase 1: Simple, Single-User Paths
          1. Exit Criteria
          2. What Can Go Wrong?
        2. Phase 2: User Ramp-Up
          1. Exit Criteria
          2. What Can Go Wrong?
            1. Removing Bottlenecks
            2. System Resources
            3. Middleware and Application Resources
            4. Application Implementation
      4. Test Environment Configurations
        1. Start Simple
        2. Add Complexity
          1. Core Web Site Features
            1. HTTP Session Sharing
            2. Security
          2. Vertical Scaling
          3. Horizontal Scaling
            1. Test Each Server Individually
            2. Quantify Load Balancing Overhead
            3. Cluster Performance and Analysis
            4. Add Another Server and Repeat Step 3
      5. Summary
    17. 12. Collecting Useful Data
      1. CPU Utilization
        1. Monitoring CPU on UNIX Systems
        2. Monitoring CPU on Windows Systems
        3. Monitoring CPU with a Test Tool
      2. Java Monitoring
        1. Verbose Garbage Collection
        2. Thread Trace
      3. Other Performance Monitors
        1. Network Monitoring
        2. Software Logs
        3. Java Application Server Monitors
      4. Summary
    18. 13. Common Bottleneck Symptoms
      1. Underutilization
        1. Insufficient Network Capacity
          1. How to Diagnose
          2. How to Resolve
        2. Application Serialization
          1. How to Diagnose
          2. How to Resolve
        3. Insufficient Resources
          1. How to Diagnose
          2. How to Resolve
        4. Insufficient Test Client Resource
          1. How to Diagnose
          2. How to Resolve
        5. Scalability Problem
          1. How to Diagnose
          2. How to Resolve
      2. Bursty Utilization
        1. Application Synchronization
          1. How to Diagnose
          2. How to Resolve
        2. Client Synchronization
          1. How to Diagnose
          2. How to Resolve
        3. Back-End Systems
          1. How to Diagnose
          2. How to Resolve
        4. Garbage Collection
          1. How to Diagnose
          2. How to Resolve
        5. Timeout Issues
          1. How to Diagnose
          2. How to Resolve
        6. Network Issues
          1. How to Diagnose
          2. How to Resolve
      3. High CPU Utilization
        1. High User CPU
          1. How to Diagnose
          2. How to Resolve
        2. High System CPU
          1. How to Diagnose
          2. How to Resolve
        3. High Wait CPU
          1. How to Diagnose
          2. How to Resolve
      4. Uneven Cluster Loading
        1. Network Issues
          1. How to Diagnose
          2. How to Resolve
        2. Routing Issues
          1. How to Diagnose
          2. How to Resolve
      5. Summary
    19. 14. Case Study: During the Test
      1. Update
      2. Test Environment
        1. Hardware Configuration
        2. Input Data
        3. Calculating Hardware Requirement Estimate (Pre-Test)
        4. HTTP Session Pressure
      3. Testing Underway
        1. Burstiness
          1. Symptoms
          2. Problem Isolation
          3. Problem Resolution
          4. Other Considerations
        2. Underutilization
          1. Symptoms
          2. Problem Isolation
          3. Problem Resolution
        3. Next Steps
      4. Summary
    20. 15. Capacity Planning and Site Growth
      1. Review Plan Requirements
        1. Review Load, Throughput, and Response Time Objectives
        2. Incorporate Headroom
      2. Review Performance Test Results
        1. Single-Server User Ramp-Up
        2. Scalability Data
        3. Processor Utilization
      3. Projecting Performance
        1. Projecting Application Server Requirements
        2. Projecting Hardware Capacity
          1. Projecting Processor Utilization
          2. Identify Server Ratios
        3. Scaling Assumptions
      4. Case Study: Capacity Planning
        1. Review Plan Requirements
        2. Review Performance Test Results
        3. Project Capacity
      5. Ongoing Capacity Planning
        1. Collecting Production Data
        2. Analyzing Production Data
      6. Summary
    21. A. Planning Worksheets
      1. Capacity Sizing Worksheet
        1. Input Data
        2. Calculating Peak Load (Concurrent Users)
        3. Calculating Throughput (Page Rate and Request Rate)
      2. Network Capacity Sizing Worksheet
        1. Input Data
        2. Calculating Network Requirements
        3. Network Sizing
      3. JVM Memory HTTP Session Sizing Worksheet
        1. Input Data
        2. Calculating HTTP Session Memory Requirement
      4. Hardware Sizing Worksheet
        1. Input Data
        2. Calculating Hardware Requirement Estimate (Pre-Test)
      5. Capacity Planning Worksheet
        1. Part 1: Requirements Summary
        2. Part 2: Performance Results Summary
          1. Single-Server Result
          2. Cluster Scalability Results
          3. CPU Utilization Data
        3. Part 3: Capacity Planning Estimates
          1. Cluster Scaling Ratio
          2. Estimate Scaling Ratio
          3. Estimate Throughput and Load
          4. Estimate CPU Utilization
            1. CPU Utilization per Additional Server
            2. HTTP Server CPU Utilization Projections
            3. Database Server CPU Utilization Projections
            4. Other Server Utilization Projections
            5. Summary CPU Utilization Data
    22. B. Pre-Test Checklists
      1. Web Application Checklist
        1. Servlets
        2. Java Server Pages
        3. JavaBeans
        4. XML/XSL
        5. Static Content
        6. Logging
        7. HTTP Session
        8. Enterprise JavaBeans
        9. Web Services
        10. Database Connection
        11. Object Pools
        12. Garbage Collection
      2. Component Checklist
        1. Routers
        2. Firewalls
        3. Proxy Servers
        4. Network Interface Cards
        5. Operating System
        6. HTTP Servers
        7. Web Container
        8. Thread Pools
        9. Enterprise JavaBean Container
        10. JVM Heap
        11. Application Server Clones
        12. Database Server
        13. Legacy Systems
      3. Test Team Checklist
        1. Test Team
        2. Support Team
        3. Web Application Developers
        4. Leadership and Management Team
      4. Test Environment Checklist
        1. Controlled Environment
        2. Network
        3. Hardware
        4. Prerequisite Software
        5. Application Code
        6. Back-End
      5. Test Simulation and Tooling Checklist
        1. Performance Test Tool Resources
        2. Test Scripts and Scenarios
        3. Tools
    23. C. Test Tools
      1. Performance Analysis and Test Tool Sources
        1. Java Profilers
          1. IBM WebSphere Application Developer Workbench
          2. Sitraka JProbe Suite
          3. VMGEAR Optimizeit
          4. Java Profiler Product Summary
        2. Performance Test Tools
          1. Apache's ApacheBench
          2. Apache Jmeter
          3. Compuware QALoad
          4. Empirix e-Load
          5. Mercury Interactive Astra LoadTest
          6. Mercury Interactive LoadRunner
          7. Quest Benchmark Factory
          8. Rational Suite TestStudio
          9. RadView Software WebLOAD
          10. Segue SilkPerformer
          11. Load Driver Summary
        3. Java Application Performance Monitoring
          1. Precise Indepth for J2EE
          2. Sitraka PerformaSure
          3. Wily Technologies Introscope
          4. Java Application Performance Monitoring Summary
        4. Database Performance Analysis
          1. Database Performance Monitoring Summary
        5. Network Protocol Analyzers
          1. Network Protocol Analyzer Summary
        6. Product Capabilities
          1. Product Capabilities Summary
        7. Production Monitoring Solutions
          1. Production Monitoring Summary
      2. Load Driver Checklist
      3. Sample LoadRunner Script (© 2002 Mercury Interactive Corporation)
        1. LoadRunner Initialization Section
        2. LoadRunner Action1 Section
        3. LoadRunner End Section
      4. Sample SilkPerformer Script © 2002 Segue Corporation
        1. Sign-in, Browse, and Purchase Script
        2. Search Script
        3. New Account Script
    24. D. Performance Test Checklists and Worksheets
      1. Performance Test Results Worksheet
      2. Results Verification Checklist
      3. Tuning Settings Worksheet
        1. Hardware
        2. Operating System
        3. HTTP Server
        4. Application Server
        5. JVM
        6. Application Parameters
        7. Database Server
      4. Bottleneck Removal Checklist
        1. Underutilization
        2. Bursty Utilization
        3. High CPU Utilization
        4. Uneven Cluster Loading
      5. Summary Test Results Graph
    25. Bibliography

    Product information

    • Title: Performance Analysis for Java™ Web Sites
    • Author(s): Stacy Joines, Ruth Willenborg, Ken Hygh
    • Release date: September 2002
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 0201844540