Chapter 3
Make Rails Faster

In principle, you already know how to make Rails faster: the same performance optimization strategies that we’ve discussed in the previous chapter will work for any Rails application. Use less memory, avoid heavy function calls in iterators, and write less Ruby and Rails. These are the big things that make Rails applications faster, and you’ll learn how to apply them in this chapter.

But before we start, make sure you have at least a bare Rails application set up and running. All the examples you’ll see in this chapter require a Rails 4.x application with a database connection. I’ll also assume we are both using a PostgreSQL 9.x database. PostgreSQL is my preferred choice not only because it is one of the best-performing freely available databases. I choose it specifically because I will need a lot of random data for the examples, and that’s easy to generate with the Postgres-specific generate_series function. That lets us start with an empty database and add schema and data in migrations as necessary.

So, take the Rails app (bare or your own), and let’s optimize it.

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

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