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 profilerNow, I have TuneUp available to me only when I'm looking to optimize performance.
{ 1 trackback }
{ 2 comments… read them below or add one }
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.
Great post Calvin, thanks for sharing this workaround and glad TuneUp is meeting your needs.