Slow Actions in Rails Projects

March 13th, 2009 by Nick Gauthier

MySQL’s slow query log is a very handy tool to detect which SQL queries are running slowly in a production app.

So what about rails applications? Often, test data only contains a small amount of data. Over time more users use the site and generate more data. A page that usually renders in 100ms could be taking 3-5 seconds, or more!

I present, SlowActions. The goal was to analyze a standard log file to detect actions that render slowly. It had to be easy to use and also not require modification of rails’ logging mechanism. Observe:

  $> slow-actions --actions development.log
             Cost    Average Max
  - UsersController : game_history (22 entries, 0% Error)
    Total:   11275.447 3642.437 12728.0
    Render:  7.20300 2.32700 17.2450
    DB:      10.5020 3.39200 10.0000

  - QuestionsController : refresh_index_table (89 entries, 0% Error)
    Total:   908.494 202.348 307.000
    Render:  0.00000 0.00000 0.00000
    DB:      32.5880 7.25800 10.0000

More info after the break ….
Read the rest of this entry »

Recap of the First Baltimore Angels Meetup

March 5th, 2009 by John Trupiano