JUDCon Berlin 2010 - practical enterprise java performance tuning

Post on 07-Dec-2014

1,063 views 0 download

description

 

transcript

Practical Enterprise Java Performance Tuning

Matt BrasierPrincipal Consultant, C2B2 Ltd

Agenda

• Introduction• Performance tuning toolbox• Examples• Summary

Introduction

• Who Am I?– Matt Brasier– Principal Consultant at C2B2 Consulting– 10 years Java EE experience– 6 years as a consultant

Introduction• This talk

– Introduction to tools used– Practical demonstrations– Download the example application

• www.c2b2.co.uk/judcon/sampleapp.zip

Performance consultant’s toolbox

JBoss admin console

JBoss admin console

• http://localhost:8080/admin-console• Since JBoss 5• Cut-down version of RHQ

JBoss jmx-console

JBoss jmx-console

• http://localhost:8080/jmx-console• Dynamic view of JMX mbeans• Information overload• Fast if you know what you are looking

for

• A few really useful features

VisualVM

VisualVM

• Distributed with JDK 6• Successor to jconsole• Install all the plugins!• jvisualvm from the command line

Command line JDK tools

• jps– Process IDs of Java processes

• jstat– JVM statistics for things such as GC

• jstack– Thread dumps

• jhat– Heap dump analysis

Testing Tools

JMeter

JMeter

• http://jakarta.apache.org/jmeter/• Load testing tool• Easy to produce scripts• Can record scripts from a browser• Can run in distributed mode

The Grinder

The Grinder

• http://grinder.sourceforge.net/• Load testing tool• More complex scripts than Jmeter

– Jython based• Better for extreme testing

Live Demo

Summary

• The JVM and JMX make a lot of information available– The tools to get at the information are

readily available– All that you have to do is understand what

it is telling you

Hot method

• Repeated Thread dumps reveals one method appears frequently– It is either occuring a lot or running slowly

System.gc

• Frequent major garbage collections• jstat shows a large GCT and System.gc

as the previous GC cause• VisualVM shows large proportion of

CPU time spent garbage collecting

Synchronization

• Thread dump reveals large number of threads blocked waiting for the same lock

Key techniques

• Load testing• Thread dumps• Visual VM

– Swiss army knife of Java consultants

QUESTIONS?

Thank you