So your Rails app is taking up a lot of RAM. What else is new? But perhaps this isn't just the way things are. Perhaps your application's memory footprint is being enlarged by one or more bloated gems.

I recently stumbled across a very cool project by Richard Schneeman. It's called derailed, and is a collection of automatic benchmarking tools. Here's the github repo.

All you need to do is add it to your gemfile like so:

gem 'derailed', group: :development
gem "stackprof", group: :development

Then you can see exactly how much memory each of your gems requires at compile time:

Use the bundle:mem command to see how much ram each of your gems uses at compile time Use the bundle:mem command to see how much ram each of your gems uses at compile time

You can also see how many objects are allocated by your gems at load time.

Use the bundle:objects to see information about object allocation at load time Use the bundle:objects to see information about object allocation at load time

There are even tools for measuring memory usage as your application runs. I haven't had a chance to check these out personally yet, since you have to be able to run your app in production mode on your development computer.

Get the Honeybadger newsletter

Each month we share news, best practices, and stories from the DevOps & monitoring community—exclusively for developers like you.
    author photo
    Starr Horne

    Starr Horne is a Rubyist and Chief JavaScripter at Honeybadger.io. When she's not neck-deep in other people's bugs, she enjoys making furniture with traditional hand-tools, reading history and brewing beer in her garage in Seattle.

    More articles by Starr Horne
    An advertisement for Honeybadger that reads 'Turn your logs into events.'

    "Splunk-like querying without having to sell my kidneys? nice"

    That’s a direct quote from someone who just saw Honeybadger Insights. It’s a bit like Papertrail or DataDog—but with just the good parts and a reasonable price tag.

    Best of all, Insights logging is available on our free tier as part of a comprehensive monitoring suite including error tracking, uptime monitoring, status pages, and more.

    Start logging for FREE
    Simple 5-minute setup — No credit card required