InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Find Memory Leaks in Your Rails Application with BleakHouse

Posted by Sebastien Auvray on May 10, 2007

Sections
Development
Topics
Ruby ,
Ruby on Rails
Tags
Memory Leaks ,
Rails

While the agility of Rails has never been in doubt, there is often controversy about its performance.

DTrace is a nice dynamic framework to analyze the behavior of your application as the Twitter team proved recently. A new tool in the battle for memory issues is the Rails plugin BleakHouse by Evan Weaver. One of the advantages of a dynamic language like Ruby is its ability to introspect: examining the state of your application from within the application itself. But one has to be careful when using ObjectSpace (the Ruby garbage collected object heap explorer). Indeed, BleakHouse in a first version took advantage of ObjectSpace to take snapshots of Rails application, but Evan Weaver found out ObjectSpace is not quantum: using it changes its own state.

BleakHouse now comes with a leak-free C implementation that directly instruments the heap. The advantage is that it now charts actual memory usage (swap, real, and combined) and it’s faster than before.

It produces charts of references by controller, by action, and by object class.

Bleakhouse needs gruff (and therefore rmagick). Since it is a C implementation, BleakHouse also needs a patched Ruby binary to monitor your application. Once the plugin installed and your environment set as production, your application will be tracked. At the end, you will run a rake goal to generate the graphs:

Bleakhouse reminds InfoQ of the fifth suggestion from Charles Nutter about making Ruby better: getting rid of ObjectSpace, all the more when at the end one has to patch its vm to do some monitoring.

ObjectSpace harms Ruby by limiting the flexibility of its garbage collecting and threading subsystems, and should be eliminated.

Java has a lot of efficient heap analyser, you could wonder where are all the RProbe, RProfiler for Ruby? I guess with time, new VMs, more companies involved, such tools should arrive...

Been looking for a tool like this by Jan Fredrik Øveraasen Posted
Tools for Ruby by Stephen Kellett Posted
  1. Back to top

    Been looking for a tool like this

    by Jan Fredrik Øveraasen

    can`t wait for using this for my work in progress ruby application:)

  2. Back to top

    Tools for Ruby

    by Stephen Kellett

    The article has the question "Where are all the RProbe, RProfiler for Ruby?".

    There have been coverage, memory, profiler and flow tracer tools for Ruby for several years now. Software Verification provide them. They have the same user interface as their tools for other languages, so if you know the C++ or JavaScript version of one of the tools you automatically know how to use the Ruby version.

    Stefan Kaes wrote about Ruby Performance Validator in his InfoQ article on Ruby Performance. The other tools are Ruby Memory Validator, Ruby Coverage Validator and two in beta for flow tracing and thread analysis.

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.