Running FiveRuns TuneUp in a Separate Environment

by Calvin on October 5, 2008

FiveRuns’ TuneUp is a great tool for profiling your Rails app, but by default it is always running in development. This causes two issues 1) every request is slower in development as it is always collecting profiling data, and 2) the TuneUp bar can mess with the layout of your application, especially if you’re rendering content in iframes like we do with Skribit. So instead of having TuneUp always run in development mode, I’ve changed it to run only when the server is started in a new environment called ‘profiler’. Here’s how I did it.

First, you need to tell TuneUp to only run in the profiler environment. You do this by modifying config/tuneup.rb (create this file if it doesn’t already exist):

Fiveruns::Tuneup.config do |config|
  config.environments.delete('development')
  config.environments << 'profiler'
end

Next, copy the development configuration block in config/database.yml and create a new block called profiler:

profiler:
  adapter: mysql
  encoding: utf8
  database: YOUR_DATABASE
  username: YOUR_USERNAME
  password: YOUR_PASSWORD
  socket: /tmp/mysql.sock

Finally, create your profiler environment configs by copying your development configs:

cp config/environments/development.rb config/environments/profiler.rb

You’re all set! Now, to run the server with TuneUp on, just run the server in the profiler environment:

script/server -e profiler

Now, I have TuneUp available to me only when I'm looking to optimize performance.

{ 1 trackback }

Full-time Startup: Skribit Week 12 (Scaling) — PaulStamatiou.com
August 4, 2009 at 7:51 am

{ 2 comments… read them below or add one }

Paul Stamatiou October 5, 2008 at 9:34 pm

Nicely done.. it got kind of annoying when refreshing pages to look for little changes and having tuneup push down the site a few seconds after page load and I’d have to move around what i was looking for.

Al Baxter October 8, 2008 at 9:38 am

Great post Calvin, thanks for sharing this workaround and glad TuneUp is meeting your needs.

Leave a Comment