take advantage of memory analyzer tool inside your continuous integration

Post on 24-May-2015

797 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

During this presentation, I will demonstrate how to generate an automatic custom memory report integrated in a Continuous Integration. It detects memory leaks very early in development process and provides a preliminary report. The Bonitasoft team implemented such a solution with the Hudson continuous integration server and the Memory Analyzer Tool (MAT) on our Eclipse RCP application. This talk will be an opportunity to share our experience and present the steps to achieved the goal: Take a Heap Dump programmatically at the end of Test execution Create a custom MAT report or use the ones provided Launch MAT reports analysis on the Heap Dump Integrate reports analysis in the Hudson/Jenkins job

TRANSCRIPT

Take advantage of Memory

Analyzer Tool inside your

Continuous Integration

Aurélien Pupier R&D Engineer, Studio Development Leader

@apupier

©2014 Bonitasoft

Agenda

• Why using MAT?

• How to

– Programmatic Heap Dump

– Choose your report

– Headless report generation

– CI integration

• Going further

©2013 Bonitasoft 2

Why using MAT?

©2013 Bonitasoft 3

Before – how we detect Memory Leak? (1/3)

• Manual QA tests

©2013 Bonitasoft 4

Before – how we detect Memory Leak? (2/3)

• Client

©2013 Bonitasoft 5

Before – how we detect Memory Leak? (3/3)

• Dumb performance tests

– Dedicated test suite

– Open 100 diagrams

– Only very big OOM

– Check no crash

©2013 Bonitasoft 6

Unit Test Integration

Test Performance

Test Manual QA

Test Client

Detect early

©2013 Bonitasoft 7

It’s

complicated It’s

com

plic

ate

d

How to

©2013 Bonitasoft 8

Required materials

©2013 Bonitasoft 9

Programmatic Heap Dump

©2013 Bonitasoft 10

Heap Dumper Java code

• Mbean

– com.sun.management:type=HotSpotDiagnostic

• JVM-specific

©2013 Bonitasoft 11

When?

• All tests played and finished

– Memory should be clean

– Take care to close everything

• End of Test Suite

©2013 Bonitasoft 12

When? Afterclass

©2013 Bonitasoft 13

Plug-in specificity

• Extension point used

– Avoid JVM dependency

• Extract interface for HeapDumper

• Close project Eclipse compiler mic-mac

©2013 Bonitasoft 14

Global picture

©2013 Bonitasoft 15

MBean provider

Heap Dumper Extension point

Test suite executor

Heap Dumper Provider

Choose your report

Find your happiness… or create it

©2013 Bonitasoft 16

Provided

©2013 Bonitasoft 17

Custom report

• AllTests_custom_html\index.html

©2013 Bonitasoft 18

Headless report generation

MAT – “There’s an app for that”

©2013 Bonitasoft 19

Headless report generation

• Generate report

– org.eclipse.mat.api.parse <dumpFile> <reportId>

– Leak suspects id: org.eclipse.mat.api:suspects

• Unzip reports

– Keep <report-name>_html

– Clean folder

• *.zip

• *.index

• *.threads

©2013 Bonitasoft 20

CI Integration

©2013 Bonitasoft 21

Build steps – Generate report

©2013 Bonitasoft 22

Build steps – Use reports

©2013 Bonitasoft 23

Reports availability

©2013 Bonitasoft 24

Fail the build

• Custom script parsing report

– Custom for each report

– Define your own thresholds

• Last build step

• Return value != 0

©2013 Bonitasoft 25

Going further

©2013 Bonitasoft 26

Possible improvements

• Provide an Hudson/Jenkins plugin for MAT

– Download

– Pre-defined list of available reports

– Pre-defined thresholds to fail the build

– Conditional Launch (only for Nightly?)

– Group reports

• MAT

– Allow to return a status code when generating report

– Handle thresholds

– Use compare feature

©2013 Bonitasoft 27

©2013 Bonitasoft 28

Evaluate This Session

Sign-in: www.eclipsecon.org

Select session from schedule

Evaluate:

1

2

3

top related