11
Vladimir Pavlov Dimitar Giormov SAP Labs Bulgaria The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer Memory Analyzer

The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Embed Size (px)

DESCRIPTION

Presentation given at Java2Days 2010 in Sofia, Bulgaria, about using Eclipse Memory Analyzer for troubleshooting JRuby memory and thread issues. Session abstract at http://2010.java2days.com/agenda/the-right-pill-for-jruby-memory-and-thread-issues-eclipse-memory-analyzer

Citation preview

Page 1: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Vladimir PavlovDimitar GiormovSAP Labs Bulgaria

The Right Pill for JRuby Memory and Thread Issues:Eclipse Memory Analyzer

Memory Analyzer

Page 2: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

AGENDA

Ruby and JRuby The Headaches Eclipse Memory Analyzer The Pill Further Enhancements Q & A

© SAP 2010 / Page 2

Page 3: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

We are not experts in Ruby/JRuby Although we have (some) experience with those

However, we have quite a lot of experience and track in Java and Eclipse Or at least we think so ;-)

DISCLAIMER

© SAP 2010 / Page 3

Page 4: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Ruby is… Dynamic scripting language Object-oriented Focus on simplicity and productivity Elegant syntax, natural to read and easy to write

JRuby is… 100% Java implementation of the Ruby programming language Interpreter running atop the JVM Generating Java bytecode (JIT compilation mode) Tight integration with Java

RUBY AND JRUBY

© SAP 2010 / Page 4

Page 5: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Memory leaks Hard to debug and find the root cause Eventually lead to OOM errors

Brings your system down Often not reproducible

Thread issues Deadlocks Exhausted threads Waiting for an external resource – e.g. DB connection

Application does not respond Whole system hangs

THE HEADACHES

© SAP 2010 / Page 5

Page 6: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Adding JRuby into the picture…

THE HEADACHES – AGGRAVATED

© SAP 2010 / Page 6

Page 7: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Eclipse Memory Analyzer (MAT) is… Java heap analyzer Helps find memory leaks and reduce memory consumption Query heap dumps via OQL Multi-Gigabyte Java Heap Dumps Are Nothing to Fear Now Soooo much faster than other tools, e.g. jhat Very little memory “overhead” for processing heap dumps (again – cf. jhat) Provides a report with automatically extracted leak suspects Supports Sun, SAP, HP, IBM JDKs 1.4.2 and above Could also process thread dumps and correlate data to provide additional details Highly extensible Open source

ECLIPSE MEMORY ANALYZER

© SAP 2010 / Page 7

Memory Analyzer

Page 8: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

JRuby extension plugin for Eclipse Memory Analyzer Plugs into the heap dump processing by means of extension points

<extension point="org.eclipse.mat.api.requestResolver">

<resolver

impl="org.eclipse.mat.extension.jruby.RubyStacktraceDumper">

</resolver>

<resolver

impl="org.eclipse.mat.extension.jruby.JRubyScriptResolver">

</resolver>

</extension>

Looks for specific JRuby implementation objects in the heap@Subject("org.jruby.internal.runtime.RubyRunnable")

@Subject("org.jruby.runtime.ThreadContext")

Produces readable Ruby stack traces Memory Analyzer 1.1 snapshot/preview download

THE PILL

© SAP 2010 / Page 8

Page 9: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Producing hybrid Ruby/Java stack traces Thread dumps analysis Specific use case information, e.g. session data Automation …

Feedback… Ideas…

Contributions…… always welcome!

https://dev.eclipse.org/mailman/listinfo/mat-devhttp://www.eclipse.org/projects/project_summary.php?projectid=tools.mat

FURTHER ENHANCEMENTS

© SAP 2010 / Page 9

Page 10: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

© SAP 2010 / Page 10

Page 11: The Right Pill for JRuby Memory and Thread Issues: Eclipse Memory Analyzer

Memory Analyzer

THANK YOU!

in: vpavlovt: @giormov