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):
1 2 3 4 |
|
Next, copy the development configuration block in config/database.yml and create a new block called profiler:
1 2 3 4 5 6 7 |
|
Finally, create your profiler environment configs by copying your development configs:
1
|
|
You’re all set! Now, to run the server with TuneUp on, just run the server in the profiler environment:
1
|
|
Now, I have TuneUp available to me only when I’m looking to optimize performance.