There are different ways to start your application out right. Some work on TDD methods, some equip their teams with good QAs, the others rely on extremely efficient project management and strong system administration. But the building of a good rails application does not only depend on code alone and its processes.

In my experience and opinion, building an application entails the following:

  • Assemble a competent team of developers
  • Designate a product manager that is separate from the developers
  • Practice creation of product specs
  • Develop a good process of development cycle (scrum, etc). Good scheduling is the key
  • Improve the skillset of developers in testing
  • Train QA for better testing and use of good tools (selenium, etc)
  • Develop good infra tasks (cron, deploy, restart)
  • Prepare for contingencies
  • Measure performance continuously and assess

All these steps/processes have already been defined by different teams in different permutations and sequence. All of these have been defined by a predefined set of rules/agreement depending on the product type and the team involved. For rails, since applications built on rails are relatively young compared to the mature Java and the rampant PHP, some of the set of rules and practices for each item involved is still being discovered one by one.

For measuring Rails performance, there has been a handful of ideal ways. Some of them are:

Although we've pretty much made do with some of these things, but the one that I really like the most is Rubyrun gem. Usually, after some profiling, performance measuring etc, the hardest part is conveying the analysis of the results. But what I really love is that I can get the results without giving so much effort. I can immediately pinpoint some of the stuffs that I needed to see.

RubyRun is a gem that is very simple to install. You can download the gem from Rubysophic site, or simply a gem install in your console. You have the option to turn it on or off depending on your call to start your server. Run your application with RubyRun profiling on by:

cd your-rails-app
ruby -rubyrun script/server

I took a sample application for a test drive using RubyRun gem. This application is a big one, but it was running on my localhost alone therefore, there were limited requests. I was doing some random usage of the application according to the expected usage of an end user on a social networking site. After considerable amount of time, found below are snapshots of the beautiful outputs of RubyRun.

I got the following results:

http://coderkitty.sweetperceptions.com/assets/2008/11/15/throughput.jpeg
http://coderkitty.sweetperceptions.com/assets/2008/11/15/slowest_requests.jpeg
http://coderkitty.sweetperceptions.com/assets/2008/11/15/perf_breakdown.jpeg

The measurements were tantamount to what I have experienced. Best of it all, I don't have to work on the reports themselves. The data were right in my face and ready for analysis. I can quickly work on straigthening out some code or refactoring the slow ones. :) I really love it.

Go ahead and try it out! This is really cool. Go pull your admin's leg for once and give them the reports afterwards. ;)