Top Banner
26

JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

Dec 05, 2014

Download

Documents

C2B2 Consulting

presentation by

Matt Brasier
Head of Consulting, C2B2 Ltd
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning
Page 2: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

Practical Enterprise Java Performance Tuning

Matt Brasier

Principal Consultant, C2B2 Ltd

Page 3: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

Agenda

• Introduction• Performance tuning toolbox• Examples• Summary

Page 4: JudCon 2010 Berlin: 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 2010 Berlin: 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 2010 Berlin: Practical Enterprise Java Performance Tuning

Performance consultant’s toolbox

Page 7: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

JBoss admin console

Page 8: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

JBoss admin console

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

Page 9: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

JBoss jmx-console

Page 10: JudCon 2010 Berlin: 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 2010 Berlin: Practical Enterprise Java Performance Tuning

VisualVM

Page 12: JudCon 2010 Berlin: 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 2010 Berlin: 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 2010 Berlin: Practical Enterprise Java Performance Tuning

Testing Tools

Page 15: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

JMeter

Page 16: JudCon 2010 Berlin: 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 2010 Berlin: Practical Enterprise Java Performance Tuning

The Grinder

Page 18: JudCon 2010 Berlin: 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 2010 Berlin: Practical Enterprise Java Performance Tuning

Live Demo

Page 20: JudCon 2010 Berlin: 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 2010 Berlin: 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 2010 Berlin: 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 2010 Berlin: Practical Enterprise Java Performance Tuning

Synchronization

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

Page 24: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

Key techniques

• Load testing• Thread dumps• Visual VM

– Swiss army knife of Java consultants

Page 25: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

QUESTIONS?

Page 26: JudCon 2010 Berlin: Practical Enterprise Java Performance Tuning

Thank you