Wednesday, May 7, 2008

Performance issues in Ruby on Rails based Apps

Of course my RoR based app had performance issues and there is a great deal of help available to identify and rectify the same. You can read Stefan Kaes to get the whole bunch of information in one go.

Always bear in mind that Ruby is slow (Pankaj). Still fortunately enough,  there is a lot you can do about it.

“”Framework Related:”" Rails as compared with other frameworks (Django-python, Symfony-PHP) looks to be decent with performance. (http://wiki.rubyonrails.org/rails/pages/Framework+Performance). Some  patches though, should boost rails performance.

“”Server related:”" Webrick v/s Mongrel v/s NGinx

”’DB related:”’ See that all the table columns used in the rails queries are indexed. Primary and Foriegn keys are automatically indexed so dont worry about them as much. To find out what columns are indexed use ’show index from ‘. Just as an experience I can say that you ‘d find most of the queries on ‘name’ and ‘type’ columns in your table. It would be good to take a few cautions before going on an indexing drive on an existing database.

Secondly, you can count on removing unnecessary DB calls. Check to see if you are searching the same table through a loop. If a queries are used several times in the entire App, you can also, with caution, use environment variables.
Third, Make sure you are not flashing too much information on one screen. Sometimes its a feature in your application that forces you to bring everything on a common interface. Here, a lilttle out-of-the-box thinking is required. Believe me, there will be things that can be ‘reduced’ if not completely avoided. How about providing links instead of showing the whole list?

“”OS Related: “” 64 Bit OS is considerably faster than 32 bit, of course if hardware is not a limitation.

Posted by Ujjwal Trivedi at 08:08:58
Comments

Leave a Reply