You are previewing Rails 3 in Action.

Rails 3 in Action

Cover of Rails 3 in Action by Ryan Bigg... Published by Manning Publications

Chapter 16. Basic performance enhancements

This chapter covers

  • Implementing pagination for resources with the Kaminari gem
  • Improving database query speeds with Active Record features
  • Caching pages and fragments of pages
  • Using the Delayed Job gem with background workers

When an application is written, it may be done in such a way that it will not perform ideally. A common situation is that an application with a small database will perform quickly because there is less data to retrieve, but starts to slow as the database grows larger. This problem can be fixed in many different ways.

The first way is to limit the amount of data retrieved in any one call to a fixed limit, a process known as pagination. At the moment, for example, you’re not ...

The best content for your career. Discover unlimited learning on demand for around $1/day.