26

JUDCon Berlin 2010 - practical enterprise java performance tuning

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: JUDCon Berlin 2010 -  practical enterprise java performance tuning
Page 2: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Practical Enterprise Java Performance Tuning

Matt BrasierPrincipal Consultant, C2B2 Ltd

Page 3: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Agenda

• Introduction• Performance tuning toolbox• Examples• Summary

Page 4: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Introduction

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

Page 5: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Introduction• This talk

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

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

Page 6: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Performance consultant’s toolbox

Page 7: JUDCon Berlin 2010 -  practical enterprise java performance tuning

JBoss admin console

Page 8: JUDCon Berlin 2010 -  practical enterprise java performance tuning

JBoss admin console

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

Page 9: JUDCon Berlin 2010 -  practical enterprise java performance tuning

JBoss jmx-console

Page 10: JUDCon Berlin 2010 -  practical enterprise java performance tuning

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

Page 11: JUDCon Berlin 2010 -  practical enterprise java performance tuning

VisualVM

Page 12: JUDCon Berlin 2010 -  practical enterprise java performance tuning

VisualVM

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

Page 13: JUDCon Berlin 2010 -  practical enterprise java performance tuning

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

Page 14: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Testing Tools

Page 15: JUDCon Berlin 2010 -  practical enterprise java performance tuning

JMeter

Page 16: JUDCon Berlin 2010 -  practical enterprise java performance tuning

JMeter

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

Page 17: JUDCon Berlin 2010 -  practical enterprise java performance tuning

The Grinder

Page 18: JUDCon Berlin 2010 -  practical enterprise java performance tuning

The Grinder

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

– Jython based• Better for extreme testing

Page 19: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Live Demo

Page 20: JUDCon Berlin 2010 -  practical enterprise java performance tuning

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

Page 21: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Hot method

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

Page 22: JUDCon Berlin 2010 -  practical enterprise java performance tuning

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

Page 23: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Synchronization

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

Page 24: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Key techniques

• Load testing• Thread dumps• Visual VM

– Swiss army knife of Java consultants

Page 25: JUDCon Berlin 2010 -  practical enterprise java performance tuning

QUESTIONS?

Page 26: JUDCon Berlin 2010 -  practical enterprise java performance tuning

Thank you