Take advantage of Memory
Analyzer Tool inside your
Continuous Integration
Aurélien Pupier
R&D Engineer, Studio Development...
Agenda
• Why using MAT?
• How to
–Programmatic Heap Dump
–Choose your report
–Headless report generation
–CI integration
•...
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 ...
Unit Test
Integration
Test
Performance
Test
Manual QA
Test
Client
Detect early
©2013 Bonitasoft 7
It’s
complicated
It’scom...
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 B...
When? Afterclass
©2013 Bonitasoft 13
Plug-in specificity
• Extension point used
– Avoid JVM dependency
• Extract interface for HeapDumper
• Close project Ecli...
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_htmlindex.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.ecl...
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
• Re...
Going further
©2013 Bonitasoft 26
Possible improvements
• Provide an Hudson/Jenkins plugin for MAT
– Download
– Pre-defined list of available reports
– Pre-...
©2013 Bonitasoft 28
Evaluate This Session
Sign-in: www.eclipsecon.org
Select session from schedule
Evaluate:
1
2
3
Upcoming SlideShare
Loading in …5
×

Take advantage of memory analyzer tool inside your continuous integration

1,136 views
951 views

Published on

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

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,136
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Take advantage of memory analyzer tool inside your continuous integration

  1. 1. Take advantage of Memory Analyzer Tool inside your Continuous Integration Aurélien Pupier R&D Engineer, Studio Development Leader @apupier ©2014 Bonitasoft
  2. 2. Agenda • Why using MAT? • How to –Programmatic Heap Dump –Choose your report –Headless report generation –CI integration • Going further ©2013 Bonitasoft 2
  3. 3. Why using MAT? ©2013 Bonitasoft 3
  4. 4. Before – how we detect Memory Leak? (1/3) • Manual QA tests ©2013 Bonitasoft 4
  5. 5. Before – how we detect Memory Leak? (2/3) • Client ©2013 Bonitasoft 5
  6. 6. 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
  7. 7. Unit Test Integration Test Performance Test Manual QA Test Client Detect early ©2013 Bonitasoft 7 It’s complicated It’scomplicated
  8. 8. How to ©2013 Bonitasoft 8
  9. 9. Required materials ©2013 Bonitasoft 9
  10. 10. Programmatic Heap Dump ©2013 Bonitasoft 10
  11. 11. Heap Dumper Java code • Mbean – com.sun.management:type=HotSpotDiagnostic • JVM-specific ©2013 Bonitasoft 11
  12. 12. When? • All tests played and finished – Memory should be clean – Take care to close everything • End of Test Suite ©2013 Bonitasoft 12
  13. 13. When? Afterclass ©2013 Bonitasoft 13
  14. 14. Plug-in specificity • Extension point used – Avoid JVM dependency • Extract interface for HeapDumper • Close project Eclipse compiler mic-mac ©2013 Bonitasoft 14
  15. 15. Global picture ©2013 Bonitasoft 15 MBean provider Heap Dumper Extension point Test suite executor Heap Dumper Provider
  16. 16. Choose your report Find your happiness… or create it ©2013 Bonitasoft 16
  17. 17. Provided ©2013 Bonitasoft 17
  18. 18. Custom report • AllTests_custom_htmlindex.html ©2013 Bonitasoft 18
  19. 19. Headless report generation MAT – “There’s an app for that” ©2013 Bonitasoft 19
  20. 20. 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
  21. 21. CI Integration ©2013 Bonitasoft 21
  22. 22. Build steps – Generate report ©2013 Bonitasoft 22
  23. 23. Build steps – Use reports ©2013 Bonitasoft 23
  24. 24. Reports availability ©2013 Bonitasoft 24
  25. 25. Fail the build • Custom script parsing report – Custom for each report – Define your own thresholds • Last build step • Return value != 0 ©2013 Bonitasoft 25
  26. 26. Going further ©2013 Bonitasoft 26
  27. 27. 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
  28. 28. ©2013 Bonitasoft 28
  29. 29. Evaluate This Session Sign-in: www.eclipsecon.org Select session from schedule Evaluate: 1 2 3

×