Acunote is online project management and Scrum software. Acunote is fast and easy to use. It shows actual progress, not just wishful thinking. Click here to learn more.
« Back to posts

Advanced Performance Optimization of Rails Applications Presentation at RailsConf 2009

RailsConf 2009

Things have never been so exciting! We come to RailsConf again and this time not to spectate, but to speak! I will be giving a talk on advanced performance optimization of Rails applications on May 5th at 14:50 PDT in Pavilion 9-10, Las Vegas Hilton, Las Vegas, NV.

When I started working with Rails, little did I know that optimization doesn't end with speeding up my Ruby code (or Rails itself). The performance of production application heavily depends on its environment - server filesystems, databases, l oad balancing solutions. The browser plays the crucial role as well

In my talk I hope to not just share my knowledge about different aspects of performance optimizations, but put together all these pieces of the performance puzzle. I'll show with numbers what's important and what's not and share with you the performance-oriented practices and processes we developed in Pluron for the last 3 years.

Let me outline some examples to give you a taste of what I'll be talking about. It turned out that:

  • when deploying on shared databases you need to optimize for cold database state in order to have 14x speedups for your SQL queries!
  • using Date class with some of its functions rewritten in C can give you 2.5x speedup for free!
  • inaccurate usage of $() and $$() functions on large pages will make your application in Internet Explorer 13x slower!
  • proper load balancing will make your application perfectly usable without any optimizations in code at all!

Already curious? Join me at RailsConf and you'll learn even more. If you haven't registered yet, by all means do so here and don't forget the 15% discount code RC09FOS I have for you.

If you're interested in the talk, please leave a comment and let me know what you think of the topics I'm going to discuss. I'd love to hear what I'm missing, what you think is boring and what is particularly interesting for you.

Please also watch for updates in this blog. I'll be sharing slides here after the conference ends and I plan to write more detailed posts on each performance optimization topic.

See you at RailsConf!


PS: here's my presentation abstract for your reading pleasure:

Advanced Performance Optimization of Rails Applications

Alexander Dymo (Pluron, Inc.), 2:50pm Wednesday, 05/06/2009, Location: Pavilion 9 - 10

In this session Alexander covers steps of performance improvement process necessary to make real-world production Rails application fast and keep it so.

To start, your application is slow. Make it faster:

  • optimizing common hotspots in Ruby code, including Date class, String::+=, BigDecimal comparisons and more
  • preloading has_many/belongs_to associations when Rails eager loading can’t (custom joins and selects)
  • optimizing template rendering, especially when including multiple small partials
  • tips for faster PostgreSQL queries: manually pushing down conditions into subqueries, using arrays instead of joins and more
  • performance characteristics of JRuby and Ruby 1.9

Two new plugins to make it faster faster:

  • Virtual Attributes AR plugin
  • Template Inliner plugin

Your application is fast on development boxes, but is still slow in production. Some things to look into:

  • impact of filesystem performance
  • shared database performance under severe memory restrictions
  • debugging live production applications (strace, dtrace, oprofile)
  • debugging performance problems caused by load-balancing solutions commonly used with Rails

Your application is fast on the server, but is still slow for the users. Optimizing in-browser performance:

  • HTTP optimization basics, managing browser cache
  • optimizing JavaScript performance, efficient drag-and-drop
  • IE-specific optimizations

Your application is fast. Here are the best practices and processes to keep it fast:

  • performance-aware coding and unit testing
  • continuous performance integration testing
  • memory profiling
  • techniques for realistic database profiling
  • production performance monitoring

Need to justify performance work to your boss? Alexander will use the data he gathered from production Rails application to demonstrate how quickly the performance degrades when you don’t care about it. You will understand that the continuous work on performance should be the integral part of your development and deployment process.