Takeaways

It takes the same techniques we learned in Chapter 2, Fix Common Performance Problems to make your Rails application faster:

  • Optimize memory taken by ActiveRecord by aggressive preloading, selective attribute fetching, and data processing in batches.

  • Replace explicit iterators in views with render collection, which takes both less time and memory.

  • Let your database server do your data manipulation.

This and the two previous chapters contain all the advice I can give you to make your Ruby and Rails code faster. Go ahead, apply it, and reap your performance benefits. So why, you may ask, is this not the end of the book? Because any cookbook-style advice is only good for well-known situations. And it leaves you unprepared when performance degrades for an entirely different reason that I did not experience, or could not predict.

It’s time to learn what to do if none of the advice works. When that happens, you’ll need to profile your application, understand what can go wrong, optimize, measure, and make sure slowdown never happens again. In the next three chapters you’ll learn how to do all that.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.106.233