56
LOAD & PERFORMANCE TESTING FOR J2EE Alexandru Ersenie Senior Load & Performance Test Engineer Edict eGaming GmbH, Hamburg [email protected] http://www.alexandru-ersenie.com TESTING, MONITORING, ANALYSING AND REPORTING USING OPEN SOURCE TOOLS

Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

Embed Size (px)

DESCRIPTION

A presentation of how load and performance testing can be done in the J2EE world using open source tools You will find things like Performance Basics (scope, metrics, factors on performance, generating load, performance reports), Monitoring (Monitoring types, active and reactive monitoring, CPU, Garbage Collection monitoring, Heap and other monitoring) and Tools (open source tools for monitoring, reporting and analysing)

Citation preview

Page 1: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

LOAD & PERFORMANCE TESTING FOR J2EE

Alexandru Ersenie

Senior Load & Performance Test Engineer

Edict eGaming GmbH, Hamburg

[email protected]

http://www.alexandru-ersenie.com

TESTING, MONITORING, ANALYSING AND REPORTING USING OPEN SOURCE TOOLS

Page 2: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 2

AGENDA

SAMPLING/PROFILING

3 TIER TUNING

VIRTUALIZATION

TESTING IN THE CLOUD

SECURITY

LOGGING

BEST PRACTICES

NETWORKING

........

PERFORMANCE BASICS

Scope

Metrics

Factors on Performance

Performance Reports

Generating Load

I

MONITORING

Monitoring types

CPU Monitoring

Other Performance Monitors

Reactive Monitoring/Reporting

II

JVM GC and Heap Monitoring

TOOLS

Monitoring

Reporting

Analysis

III

Page 3: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 3

PERFORMANCE BASICS

1.1

Page 4: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 4

1.1 DEFINITION AND SCOPE

PERFORMANCE

Short response time for a given piece of work

High throughput (rate of processing work)

Low utilization of computing resources

High availability of the computing system or application

Efficient usage of hardware resources;

Storage

Continue to operatedespite errors

SCALABILITY

Handle growing amountof work;

Ability to enlargeto accommodate more

work

EFFICIENCY RELIABILITY

Recover after failure;

Mean time between failures

ROBUSTNESS

Non functionalrequirements

Page 5: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 5

1.1 REAL WORLD NUMBERS

1 second of slower performance on pages could cost Amazon $1.6 billion in sales each year

25% of users will leave a site if a page takes more than 4 seconds to load.

http://performance-testing.org/performance-testing-statistics

http://en.wikipedia.org/wiki/BigTable

RESPONSE TIMES

Facebook serves more than 2 million ‘Like’ buttons per second (June 2010).

Facebook held a clear lead in total page views during March 2011, recording about 85 billion. This was more than three times as many as number two Google, which had about 25.6 billion

THROUGHPUT

Google uses a compressed, high performance, proprietary data storage file system, (...) designed to scale into the petabyte range (1000 terabytes)

EFFICIENCY

Page 6: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 6

METRICS

1.2

Page 7: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 7

1.2 METRICS

OPTIMISTIC

SLA are already definedConcurrent usersTransactions / SecondResponse TimesStorage

Concurrent users10 000 logged in users50 000 visitors

Transactions / Second1 000 business transactions / second4 000 web requests / second

Response TimesLanding page total load time less than 8 seconds for 70 % of the usersTransaction Response time less than 2 seconds for 90 % of all transactions

StorageMaximum 100 bytes per transaction

TEST TO ACCHIEVE DEFINED SOFTWARE LEVEL AGREEMENTS

How many transactions can the system handle

How many sessions can the system handle

What is the average response size

What is the 90 % value / business case

How much space will a transaction use in the database

REAL WORLD PROJECTS

SLA are not definedConcurrent usersTransactions / SecondResponse TimesStorage

?TEST TO DEFINE

SOFTWARE LEVEL AGREEMENTS

?

Page 8: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 8

RESPONSE TIMES

What are the response times that users are receiving when performing specific transactions in the system:

Minimum / Maximum / Average response time50 to 90 percent line

1.2 METRICS

THROUGHPUT

How many users can the system handle, and how many transactions can the system handle in a unit of time

Transactions per second

As the number of users using the system increases,the throughput increases as well. The system is busysatisfying user requests

When the systems limit is reached, the throughput decreases, and waiting occurs, since the system is busy managing itself in order to satisfy all user requests

Page 9: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 9

FACTORS ON PERFORMANCE

1.3

Page 10: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 10

SOFTWARE

Software design, architecture and configuration have great impact on performance:

PROGRAMMING CONFIGURATION

JVMConfig

ThreadPool

EJBcontainer

JDBCMax-connections=”5”;jdbc-connection-timeout=”5”

Sync.errors

Deadlocks

Race conditions

Arithmeticerrors

Buffer overflow

Arithm. exceptions

Redundantoperations

Dead code

Redundant assign

Other

-Xmx:2G-XX:NewSize:1.8G-XX:NewSize:1.8G

max-threadpoolsize=”5”

Max-cachesize=”512”; cache-timeout=3600

Memoryleaks

80 % of all performanceproblems in JAVA

1.3 FACTORS ON PERFORMANCE

Page 11: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 11

HARDWARE

WINDOWS5000cons

LINUX1024Openfiles

Database Server and Hardware

Hardware /Configuration

OS / File System

1 Server

APPServer

WebServer

DBServer

Single 3 Tier Server

DB Server /Hardware

Oracle Standard

CPU

CPU

Oracle Enterprise

CPU

CPU

CPU

CPU

CPU

CPU

●No partitioning●Limited online operations●Limited indexing

MSSql MySQL

●Different lockingimplementation

●DifferentIndex performance

●default range for dynamic ports in Windows is 1024 to 5000●Unix systems have a default maximum open files limit of 1024

1.3 FACTORS ON PERFORMANCE

Shared resources:●CPU●Memory●Network●DiskVirtualization

Page 12: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 12

GENERATING LOAD

1.4

Page 13: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 13

Web &

ApplicationServer

LOADAGENT

LOADAGENT

LOADAGENT

LOADAGENT

LOAD DISPATCHER

1.4 GENERATING LOAD

WHAT DO WE NEED?

Test ResultsDB

ReportingServer

Reports

MONITORS

Page 14: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 14

1.4 GENERATING LOAD

IMPLEMENTATIONMODEL

Web &

ApplicationServer

JMETER

JMETER

JMETER

JMETER

JMETERCONTROLLER

MY SQLDB

JASPERSERVER

JASPERREPORTS

JMX;REST

MONITORS

Page 15: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 15

LOAD AGENTS

Virtual Users

Ramp up time

Pause times

Number of transactions

Number of repetitions

Increasing rate/repetition

Server and Port

MONITORSObject usage

EJB Resources

JDBC Resources

CPU Time

HEAP Monitoring

REPORTINGProcess for DB Import

Process for Maven

Process for other formats

Generate Load

Collect Response Times

Monitor Hardware Resources

Monitor System Resources

Process Results

Import results into database

Generate Reports

DISPATCHER

1.4 GENERATING LOAD

'users=200 ramptime=200 pausetime=2000 pausetimedev=500 transactions=100 repeats=1 loopsinrepeat=1 warmup=no' 'hostname=myserver port=8080 protocol=https'

'trace_objects=yes monitor_server=yes'

'generatereport=yes '

/start_test.sh

Page 16: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 16

FUNCTIONS

configure_serverempty_logs

monitor_resources

generate_report

start_test

server_warmupJMETER DISPATCHER FOLDER

/includes

/scripts

SCRIPT REPO

PLACE ORDER

EXPORT

LOGIN

HOMEPAGE

REGISTRATION

Scripts call functions to control the test workflow

/testplans

TESTPLAN REPO

T_Place_Order

T_Export

T_Login

T_Homepage

T_Registration

Scripts start test plans by using functions

/resultsRESULTS

Results are stored here

MY SQLDB

Processed results are exported to a database

JASPERREPORTS

Reports are generated from the DB

1.4 GENERATING LOAD

IMPLEMENTATIONMODEL

Page 17: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 17

PERFORMANCEREPORT

1.5

Page 18: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 18

1.5 Performance Report

SUMMARY METRICS / TRANSACTION JVM CONFIGURATION

CPU USAGE HEAP USAGETHROUGHPUT & RESPONSE TIMES

Page 19: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 19

MONITORING

2

Page 20: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 20

Allows real time monitoring of critical resources

Active MonitoringCPU UsageCPU Usage Heap UsageHeap Usage

Thread UsageThread UsageAllows real time interfering with the system:

Execute Garbage Collection

Generate Thread Dump

Analyze thread activity

Generate Heap Dump

Enables monitoring the system's limits

Allows a better understanding of how the system behaves depending on the load scenario, and theuser behavior, thus enabling to determine what the system can perform

Allows quickly modifying either the test configuration,or the software/hardware configuration, repeat thetest and compare the results

Allows parallel analysis of the system and the load scenario, thus enabling to identify root causes andbehaviors quickly

JDBC Usage EJB Cache Usage

2.1 Monitoring Types

AJP Thread UsageAJP Thread Usage

Page 21: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 21

Object Usage

Reactive Monitoring

2.1 Monitoring Types

Throughput Response Times

Resource StatisticsGarbage Collection

Allows reactive analyze and detailed interpretation ofcollected dataData collectors can easily be extended using a modular approach (function based):●Monitor JDBC; Monitor EJB; Monitor Thread Usage; Monitor Heap; etc

1. Enables monitoring the system's behavior and resources over aprolonged period of time

2. Easily extendable by adding collectors

3. Storable information for future comparing

4. Tool independent

5. High definable granularity

6. Automated

ADVANTAGES

1.High amount of data and complexity in analyzing the results2.Requires high proficiency with tools,monitors, collectors for the purposeof extending the monitoring system

DISADVANTAGES

Page 22: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 22

REACTIVE MONITORING

2.2

Page 23: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 23

2.2 Reactive Monitoring

RESPONSE TIMESWhat are the for specific transactions

THROUGHPUTWhat is the maximum for specific transactions

RESOURCE USAGEWhat is the for a load scenario

GARBAGE COLLECTIONHow efficient is the for a load scenario

50% line60% line70% line80% line90% lineMin

RespTime

AvgRespTime

MaxRespTime

No. oftransactions

AverageTrans /Second

MaxTrans /Second

CPU HEAP JDBC EJB WEB OTHER.................

.............

.............

NO OFYOUNG

GC

NO OFOLDGC

DURATIONOF GC

% IN GC

OTHER.................

OTHER

OTHER

Page 24: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 24

RESPONSE TIMES

THROUGHPUT

2.2 Reactive Monitoring

Page 25: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 25

RESPONSE TIMES DRILL

THROUGHPUT DRILL

2.2 Reactive Monitoring

Page 26: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 26

RESOURCES

CPU HEAP

JDBC CONNECTIONS

2.2 Reactive Monitoring

Page 27: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 27

GARBAGE COLLECTION

2.2 Reactive Monitoring

Page 28: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 28

GARBAGE COLLECTION STATISTICS

2.2 Reactive Monitoring

Page 29: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 29

OBJECT USAGE

2.2 Reactive Monitoring

See the behavior of objects in time

Drill down on the object to see detailed information like Instances and Bytes occupied

Page 30: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 30

2.2 Reactive Monitoring

OBJECT USAGE - PRIMITIVES

See the behavior of objects in time

Drill down on the object to see detailed information like Instances and Bytes occupied

Page 31: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 31

JMXJava Management Extensions

Supplies tools for managing/monitoring:● Applications●,System objects● Devices● Service oriented networks.

Resources are represented by objects called MBeans

REST MONITORING

Monitoring and management data

Exposed by the application server

(example: Glassfish)

SYSTEM

●Top●Vmstat●Iostat●jmap

SERVER LOGS

Garbage Collection Logs

COLLECTORS

LOAD GENERATOR

●Transactions●Response Times●Response Codes●Response Sizes

MY SQLDB

2.2 Reactive Monitoring

Page 32: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 32

ACTIVE MONITORINGCPU

2.3

Page 33: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 33

INSERT MOVIE WITH RUNNING TEST ANDMONITORING

Page 34: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 34

●Represents the first input in identifying throughput decrease

Allows real time monitoring of CPU usage

Allows identifying hotspots(spikes) and relate them in time using graphical timestamp representation

Identify Garbage Collections and their effects on CPU Usage

Allows creating “Snapshots” and future reactive analysis based on CPU usage patterns

Allows identifying outside contributors (Database, JMS, I/O)

2.3 Monitoring Types – CPU Monitoring

Page 35: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 35

Server resources properly configured – EJB Cache, EJB Pool, Thread Pool, JDBCConnection Pool

OPTIMAL BEHAVIOR

2.3 Monitoring Types – CPU Monitoring

Load configuration adapted for optimum usage of resources: Requests are being Processed, JDBC connections are used optimally

Page 36: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 36

Depending on the configured Garbage Collection Strategy, on the Heap usage of your application, and the properly configuration of the Heap according to business scenarios and memory footprints, Garbage Collection can have a huge impact on throughput

GARBAGE COLLECTION

Parallel Collections with only two CPU

Stop the world strategy instead of CMS

Poor Heap Configuration (too small, too big, wrong rations of young to old

Manual Garbage Collections

2.3 Monitoring Types – CPU Monitoring

Page 37: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 37

Long running queries – Occupying the JDBC resource for too long. Requests are being queued, translatingin decreased throughput and increased response times

Oracle Redo Log failed checkpoints – Database stops servicing for satisfying internal needs

Pause

Redo Log Statistics

Average of 1 Redo Log File / Minute : Redo Configuration needs update

DATABASE WAITS

2.3 Monitoring Types – CPU Monitoring

Page 38: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 38

Number one cause for thread contention: wait times induced by synchronized methods (threads have to wait in a queue for acquiring the lock)

Contention

THREAD CONTENTION

2.3 Monitoring Types – CPU Monitoring

Page 39: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 39

ACTIVE MONITORINGHEAP

2.4

Page 40: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 40

Allows real time monitoring of HEAP usage

Allows identifying memory leak trends

Correlate Garbage Collection with CPU Usage:CPU usageTime in GCOverall system behavior on GC

Determine Garbage Collection rates and durations

2.4 Monitoring Types – HEAP Monitoring

HEAP MONITORING

Page 41: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 41

PERMANENTGENERATION

YOUNGGENERATION OLD GENERATION

●Internal representations of the JAVA classes●Objects describing classes and methods●Information used for optimization by the JIT compilers

●Initially objects are allocated in the Young Generation●When collected, objects are moved between survivors (default 32 collections)

●Objects that have survived the maximum allowed number of collections●Dead objects waiting to be collected

S1 S2

1 1617 32

JVM HEAP STRUCTURE

2.4 Monitoring Types – HEAP Monitoring

Page 42: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 42

JVM HEAP STRUCTURE

2.4 Monitoring Types – HEAP Monitoring

Page 43: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 43

HEAP MONITORINGEXAMPLES

2.4

Page 44: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 44

MEMORY LEAK ?

Used Memory increases as the number of live objects surviving collections increases (particularly under load)

An increasing trend is not necessarily a memory leak. Objects can survive several collections (max threshold), and can be already dead, waiting for the old collector

In test systems wait for several full garbage collections and build a trend line in order to see if a memory leak is showing

Wait for a full garbage collection to see if the memory decreases

Test systems can be provided with the option of manually triggering a garbage collection to see if objects are being released after the test is over

2.4 Monitoring Types – HEAP Monitoring

Page 45: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 45

A full Garbage Collection goes over all generations, parsing the entire object structure to identify removable objects

Usually the old generation is at least twice the size of the young generation

Collection time for the old generation significantly increased (object tree parsed)

Dead or marked for GC objects are removed

Space is reclaimed

Garbage Collection strategy of critical importance: Parallel or Concurrent GC

NO LEAK

2.4 Monitoring Types – HEAP Monitoring

Page 46: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 46

Objects that cannot be collected are moved to the old generation

Old Garbage Collections cannot remove the objects; space cannot be reclaimed

Total Heap used increases constantly

Eventually the system performs only Garbage Collection

Used Memory increases as the number of live objects surviving collections increases (particularly under load)

The system is busy managing itself, instead of running your application

Both throughput and response times affected

Server restart is required

MEMORY LEAK

The right time to trigger a HEAP DUMP and see what objects are leaking

ACTION

2.4 Monitoring Types – HEAP Monitoring

Page 47: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 47

ACTIVE MONITORINGOTHER MONITORS

2.5

Page 48: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 48

User Profile Session Information File contents

Caching shared data in a Hash Map

Every request will want to acquire and hold the lock on the hash map, becoming a bottleneck

Brian Goetz: Threading lightly : Reducing Contention

Synchronized Methods

One thread is executing a synchronized method for an object, all other threads that invoke synchronized methods for the same object block (suspend execution) until the first thread is done with the object.

Java Tutorials - Concurrency

Contention

Threads can be monitored, and blocking or long running threads can be identified

THREAD CONTENTION

2.5 Monitoring Types – Other Monitors

Page 49: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 49

^

Most often contention problems appear only under load, due to concurrency effects (more requests on the same

object/method)

The right time to trigger a thread dump and see the root cause of contention

ACTION

BEHAVIOR

CPU usage drops dramatically, for it is busy with solving the locks instead of satisfying business requests

Several threads in “Monitor” state, at the same time, indicate thread contention

THREAD CONTENTION

2.5 Monitoring Types – Other Monitors

Page 50: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 50

Allows quickly identifying blocked/blocking threads

Lists all existing threads and their state when the thread dump was triggered

Threads are listed together with their stack traces, allowing identifying of:

What resource is being lockedWho locks the resource?What is the locking thread doing?

THREAD DUMPS

2.5 Monitoring Types – Other Monitors

Page 51: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 51

THREAD DUMPS

2.5 Monitoring Types – Other Monitors

Kill -3 PID : writes stack trace to jvm.log

jvm.log can be imported into IBM Thread Analyzer

Page 52: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 52

Actively monitor the number of JDBC resources in use, and other statistics like:

● Connections created● Connections removed● Connections in pool

JDBC MONITORING

Actively monitor the number of EJB Beans in cache and other statistics like:

● Cache hits● Passivation statistics● Number of beans created● Number of beans removed

EJB MONITORING

Actively monitor the number of requests, and other statistics like:

● Error count● Max request time

WEB MONITORING

2.5 Monitoring Types – Other Monitors

Page 53: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 53

Database Call on each Transaction – In this case each transaction checks if the user is valid, by creatingand using a new JDBC Connection / check;

2.5 Monitoring Types – Case Study

Page 54: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 54

TOOLS

3

Page 55: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 55

3. Tools

MONITORING

VISUAL VM

CheckJMX

REST Interface

System Interfaces

PROCESSING

PENTAHO

Shell Scripts

LOAD

JMeter

Shell Scripts

REPORT DESIGN

IReport

REPORTS

Jasper Reports

HEAP ANALYSER

MAT

YourKit

THREAD ANALYSER

VisualVM

IBM Thread Analyzer

GARBAGE COLLECTION

HP Jmeter

PROFILING

YourKit

Page 56: Load and Performance Testing for J2EE - Testing, monitoring and reporting using Open Source Tools

07/25/12 Alexandru Ersenie - Load & Performance Testing for J2EE 56

THANK YOU FOR LISTENING

?