A simple Rails performance tuning workflow

September 23, 2008 by Derek

no comments Comments

I really like Dan Mange’s workflow for Rails performance tuning:

  1. Use curl for benchmarking. It’s good enough (and damn simple).
  2. Use the ruby-prof gem along with an optional request parameter so you can profile any action, any time.

Dan also does a solid job explaining CPU time and what if means for your Rails app. A snippet:

At CarePages we have an Apache log that logs the controller, action, and Rails runtime. We run a script that groups the runtimes by controller and action, and then calculates the total runtime for a controller/action divided by the total runtime for all requests. What we found the first time we did this was that one of our pages was taking nearly 40% of the overall CPU time. It wasn’t the slowest page, but it was the most frequently hit page. We had two other pages that were taking about 19% and 13% of the overall CPU time. This gave us a good place to start – if we could make the 40% page twice as fast, we would lower our overall CPU usage by 20%.

Comments

(leave url/email »)

  

Featured Plugins

  • Process Usage
    Monitors the memory usage of a process, generating an alert if it exceeds a specified threshold.
  • URL Monitoring
    Monitors the availability of a URL, sending an alert if the URL is not reachable.
  • Ruby on Rails Request Monitoring
    Monitors ALL requests to a Ruby on Rails web application, alerting when slow web requests occur. Reports the total number of requests, the number of slow requests, and the average execution time.
  • Server Load
    Monitors the load on server, generating an alert if the load over the last minute is greater than a specified amount.


Categories

Already have a Scout account?   Where do I login? Highgroove Studios Powered By Rails Machine