Rails Performance Tool Box

Posted by Jake Good
on Oct 24, 06

When I left my last company, I was just finishing up some performance increasing fixes for a Windows Forms application…



And when I hopped onto space150, I immediately walked onto a project that already had some major iterations and most development work was done. So guess what… more performance testing / fixing.



This is Ruby on Rails though… shouldn’t it just magically be done for you? / sarcasm



In Windows Forms (or .Net in general), you can attach traces and watch logs… and attached perf monitoring tools. In Ruby on Rails, the standard toolset comes with a few pieces of data, but with the addition of some great tools… you can easily pinpoint problems and fix inefficiencies.



Here’s what I use:



tail: standard *nix file tailing application… tail -f <filename>



query_analyzer: puts “explain” statements in your log files for SQL queries. Awesome.



mtop: it’s like top, but for mysql…



Slow Query Log: logs all slow queries over a threshold for a MySQL



query_trace: query traces in your log files… nice



Siege: lay Siege on your web application… perf test it! Love the name!



A few things to watch out for with Rails?




  • Add indexes to your tables: add_index :table, :column

  • Use fragment caching intelligently, but use it.

  • Watch your log (use tail) and check for actions that require a lot of queries and bring that down.

  • It’s relatively easy to keep your rendering down… just be careful about MySQL

  • use some memcache, it’s pretty fast :)



What does everyone else use? What things do you guys look for?

Comments

Leave a response

Comment