Building High Performance Websites With Rails
"80-90% of the end-user response time is spent on the front-end. Start there."
Inspired by the book High Performance Web Sites by Steve Souders, Richard Gonzales, one of our Senior Ruby on Rails developers, gave a lightning talk on 14 principles of building high performance web sites and how to implement them using Rails in one of our recent internal Rails Meetup.
"It's very exciting that today a lot of the principles of high performance web sites are already built into Rails through its new features," said Richard.
To give an overview of the 14 principles outlined in the book, Richard gave three best practices which you can easily implement using Rails:
1. Asset Management
Manage the placements of the assets in your page. Put stylesheets at the top, put the scripts at the bottom. Get the HTML structure and CSS to the user as soon as possible. Render the page before the scripts have initialized to avoid a blank page where user have to wait for scripts to download.
Caching plays an important role in the performance of a website. The objective of caching is to minimize the round trip. Steve Souders, the author of the book explained that caching is easily achieved by giving resources an expiration date far in the future using the Cache-Control response header.
Rails Implementation: Rails has its own caching facilities. It provides three types of caching techniques by default. If you were able to optimize it more, the better. For example, you can cache rarely updated data such as your website’s header or images to reduce response times by 50% or more.
3. Make Fewer HTTP Requests
Looking to build high performance website or web application? We love to hear about your project. Start a conversation with our team today.