July 01, 2010
If you’ve ever had to track down a memory leak in a Rails application (and who hasn’t forgotten to use
will_paginate occasionally), you’re probably already familiar with the excellent Oink plugin by Noah Davis. Oink spits out the actions that are leaking the most.
Oink is a huge help when tracking down a memory leak. However, it doesn’t overcome my laziness. Tracking memory usage is extremely important – talk to any dedicated Rails host and they’ll tell you memory leaks are behind many crashed servers. To make monitoring memory usage less involoved, I needed 3 additions to Oink.
Adding Oink-formatted log parsing to Request Log Analyzer ended up being the Aspirin for my memory headache. The smart guys at Rails Doctors helped me add the Oink format to RLA.
Just follow steps 1-4 here.
To generate a report:
So with RLA, I’ve got all of my Rails monitoring metrics in one report. However, I need incremental analysis and alerts on large leaks. I want to catch a large leak before it brings down a server. For that, I’ll use Scout.
Using Oink with Scout is easy – just follow the steps here. It’s the same steps for using Oink+RLA outside of Scout, with an additional step for updating/installing your Scout plugin.
By default, you’ll get an alert when a request results in a memory increase of 50 MB. You can change this threshold in the plugin settings.
The summary memory data is automatically added to your daily Rails performance report.
Scout comes with a free 30 day trial, so you take it for a spin and see if it meets your needs. View our pricing information here.
If you run into any issues we want to hear about it. You can email us at firstname.lastname@example.org or just submit a support request within Scout.