Last Updated: September 19th, 2024

You had some unique business ideas. You jot those down, think about days after day, nights after night! Then, you hired a talented bunch of developers, web designers, and UX specialists. They built it using a great framework, say, Ruby on Rails, and you could see it in action that you had been dreaming of for months.

Your site is live now! Unfortunately, you do not have millions of dollars on servers (like Google or Facebook). You deployed it on a Linux box with limited memory. After months of excitement, you realized that users are encouraging enough regarding visits, but not enough to earn revenue. To make it worse, you found that, the bounce rate is higher than anticipated. You ran some surveys to see that users had some specific sets of expectations about the responsiveness of the application, that your site couldn’t just meet. They wanted it to be quick, reliable, and responsive — all your site isn’t.

Well, you didn’t consider this aspect when you assigned the project to the RoR development company. What to do now?

This is where performance enhancement comes into place. To dig further, you need to start gathering data about the performance of your system because people are quite bad at predicting which part of a computer program has the biggest performance problems. Once you find bottlenecks, you can solve your problem easily. Other than you can hire an expert Ruby on Rails software company to take care of the rest.

How to measure performances of a rails application

Here are some tips for you to measure and monitor performance in a Ruby on Rails application. Some tools and tips are equally applicable to other web applications.

1. Rails Performance Test – Benchmarking

Through the Rails performance test, the source of the application’s memory or speed bottleneck can be found. Benchmarking helps find out how fast each performance test runs. Each test case is run 4 times in benchmarking mode.

2. Rails Performance Test – Profiling

Profiling helps you to see the details of a performance test and provides an in-depth picture of the slow and memory-hungry parts. Each test case is run 1 time in profiling mode.

3. Rails logger

The simplest way to get performance information is to analyze the rails log. It will provide you with information on the time spent processing each request, broken down into rendering and SQL time. You can also find whether a particular part is cached or the occurrence of cache expiry.

4. Rails analyzer

The Rails Analyzer project contains a collection of tools (The Production Log Analyzer, The Action Profiler, Rails Analyzer Tools, The SQL Dependency Grapher) for Rails that let you discover the biggest slow spots in your applications allowing you to best focus optimization efforts.

5. Rails footnote

It is a rails plugin that displays footnotes in your application for easy debugging, such as sessions, request parameters, cookies, filter chain, routes, queries, etc. Even more, it contains links to open files directly in your editor including your backtrace lines.

6. Query Reviewer

Query Reviewer is an advanced SQL query analyzer. It generates a page with an explanation output of all SELECT queries, rates a page’s SQL usage, and displays an interactive summary on a page.

7. Slim Scrooge

SlimScrooge is an optimization layer to ensure your application only fetches the database content needed to minimize wire traffic, and excessive SQL queries and reduce conversion overheads to native Ruby types.

SlimScrooge implements inline query optimization, automatically restricting the columns fetched based on what was used during previous passes through the same part of your code.

8. New Relic

New Relic is the all-in-one web application performance tool that lets you see performance from the end-user experience down to the line of application code. It will also list the errors if such occurrences occur.

rails performance monitoring

Ruby on Rails performance monitoring

9. Rack-bug

It is a debugging toolbar for Rack applications implemented as middleware.

10. Firebug

Firebug is a Firefox plugin and a very powerful tool. Thanks to Joe Hewitt for this lifesaver. Apart from many outstanding features, it helps to monitor network performance. You can see the load time of each file (when they started to load and when they are completed), filter it by type (e.g. javascript or CSS), and examine HTTP headers.

That’s it! You can suggest more. These are a mere introduction. You can try those out and examine the health of your application. I have a plan to write another one with tips regarding enhancing performance based on the generated health report of a web application. Stay tuned for that!

Contributor: Fuad Bin Omar, COO, Nascenia

Categories: Ruby on Rails