High Performance Ruby on Rails and MySQL

MySQL is among the fastest relational databases commonly available today; unfortunately, the database alone is only part of the picture. For today’s web applications, the one weak link in the entire performance chain – from the network to the web application and ending in the database – can cause an entire application to seem slow.

Unfortunately, Ruby on Rails on exacerbates this problem: Rails makes it easy to develop complicated web applications fast, but it also makes it easy to access your databases in an extremely inefficient manner. Thousands of queries may be generated when just a few are necessary. Even if you can get past that problem, ActiveRecord itself can be a problem: it may create thousands or even millions of objects, and in many situations – such as bulk loading or updating data – this can cause a serious performance problem. Replacing ActiveRecord in key situations can result in the length of batch process going from days to minutes.

This talk will demonstrate the following for your attendees:

What kind of performance problems am I likely to run into with Rails?

How can I tell if Rails is responsible for my performance problems?

What specific techniques can I use to reduce the number of queries and the size of ActiveRecord objects returned?

What are some real world examples of ActiveRecord speedup using these techniques?

David Berube

Berube Consulting

David Berube is a Ruby developer, trainer, author, and speaker. He’s used both Ruby and Ruby on Rails for several years, starting in 2003 when he became a Ruby advocate after he wrote about the language for Dr Dobb’s Journal. He is the author of “Practical Ruby Gems,” “Practical Reporting with Ruby and Rails”, and the coauthor of the book “Practical Rails Plugins.”

His professional accomplishments include creating the Ruby on Rails engine for The Casting Frontier, which has been used to cast commercials for companies ranging from AT&T and Bank of America to Verizon and Wal-Mart. If a commercial has been cast with digital auditions recently, it probably used his code to do it. He also worked with ThoughtBot (www.thoughtbot.com) on the Rails engine that powers Sermo America’s Top Doctor contest. Additionally, he has worked on numerous other Ruby projects, including the engine powering CyberKnowHow’s BirdFluBreakingNews site.

David’s journalism has been in print in over 65 countries, in magazines such as Linux Magazine, Red Hat Magazine, Dr Dobb’s Journal, and PHP International Magazine. He’s also taught college courses and given lectures at various colleges and universities, notably including Harvard University’s Extension School.