atlascamp 2010: jira plugin performance tuning - alex hennecke

30
Everyone likes fast things

Upload: atlassian

Post on 18-May-2015

1.894 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Everyone likes fast things

Page 2: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Alex Hennecke

Senior Java Dev

GreenHopper JIRA Plugin

Page 3: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

JIRA Plugin Performance Tuning

Why tune a plugin?

Server Side Profiling

Client Side Profiling

Performance Pitfalls

Page 4: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Why tune a plugin?JIRA is optimised for own use cases

Plugins may do crazy, unexpected things with JIRA's data

Slow applications suck

Page 5: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Server Side Profilingallows you to...

find long-running code

find code waiting for locks

but...

profiling can have deceptive overhead

depends on external factors like GC, I/O, ...

Page 6: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

JIRA and JProfileradd profile option to catalina.sh

watch the console for when to connect the profiler

Page 7: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

JProfiler CPU View

identify long-running call

see the chain of calls that leads to slow methods

Page 8: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Profiling under LoadKeep an eye on memory usage and GC times

jconsole

Page 9: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Profiling under LoadWatch for pool size limits

server.xml

Page 10: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Wrap-Up

Setting up JIRA for Profiling is not hard

Profiling saves time pinning down performance problems

Page 11: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Client Side Profilingwhy?

rich UIs are heavy on JavaScript

JS frameworks can hide performance traps

allows to...

identify reasons for slow page load

find performance hotspots in JavaScript

Page 12: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

JIRA and dynaTraceinstall a VM with Windows and target IE Version

install dynaTrace AJAX Edition

login and remember-me to JIRA from IE

add the URL you're testing to dynaTrace

Page 13: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Profiling Result - Overview

Page 14: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

JavaScript Details

identify hotspots

script callstack

script source

Page 15: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Wrap-Up

Use client side profiling as a starting point

Tune JavaScript and page load time

Page 16: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Performance PitfallsJQLs vs HitCollector: Example from GreenHopper for a 50% gain

Dangerous convenience: CSS selectors in IE

Page 17: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

JQL vs HitCollectorFor statistics, both use Lucene

LuceneSearchProvider.searchCount is faster for few queries

Single search with a HitCollector is faster than many JQL queries

Page 18: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Why is that?Creating a JQL query does permission checking

Page 19: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

HitCollectorJIRA offers DocumentHitCollector

Page 20: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

HitCollectorDocumentHitCollector has to load the document from Lucene, not just count the index

Custom logic is required to do the actual counting

But it still beats many JQL queries

Page 21: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

GreenHopper 5.0

Statistics performance on the server increased by 50%

Page 22: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

CSS Selector in IEIE has no native way to find nodes by class

Attribute selectors or selectors with wildcards have to walk the DOM tree

Prototype's extension mechanism is slow on IE

Page 23: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Bad examples

$('.myCssClass')

$('div[class*=myCssClass]')

$('div#myId')

Page 24: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Good examples

$('#myId div.myCssClass')

$('#myId div[class*=myCssClass]')

$('#myId')

Page 25: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Prototype CSS Selector in IETimeline view in the profiler

slow method

Page 26: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Prototype CSS Selector callsprototype element

extension

prototype CSSselector

Page 27: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

CSS Selector after tuningModified Prototype with switch for element extension

hotspot is gone

Page 28: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

There's a lot moreCache data that's expensive to fetch

Use Web Resources, they give you

no cache expiry (no more 304's)

batched mode (less requests)

Page 29: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Further Readinghttp://confluence.atlassian.com/display/ATL/Alex+Hennecke

JIRA Web Resource

http://confluence.atlassian.com/display/JIRA/Web+Resource+Plugin+Module

jQuery Performance Rules

http://www.artzstudio.com/2009/04/jquery-performance-rules/

dynaTrace Application Performance Almanac

http://blog.dynatrace.com/2010/01/12/dynatrace-application-performance-almanach-2010/

Kirk Pepperdine

http://www.javaperformancetuning.com/

Page 30: AtlasCamp 2010: JIRA Plugin Performance Tuning - Alex Hennecke

Performance is King

[email protected]