Profiling JSON request in Rails using Rack Mini Profiler

by Luke, Founder

I often use the rack-mini-profiler gem while developing my Rails applications. It's a ruby gem which provides information in-page about the speed of processing the request. It shows the number of queries and what parts of your code take the longest. I like running it in my dev environment as it helps me to quickly review the performance of each page.

I've needed to review the performance of API requests in the past but have struggled for a recent project it came up again. After a bit of searching, I found out that, if rack mini profiler can't display the results, it will collect them until it can on the next HTML page. So, the solution that I am using is to:

  • make the JSON request and
  • then hit an HTML page of my choice.
  • The results will appear, along with the most recent HTML profile.

It's a little clunky but does the job. I hope it helps someone else.

More articles

What AI changes for software consultancies, and what it does not

AI gives strong software teams more leverage, but it does not replace judgement, accountability, or the need to build around the real problem.

Read more

Quotation Bank App | GCSE & A-Level English Revision

We’re excited to share that **The Quotation Bank App** — developed in partnership with *The Quotation Bank* — is now live on the **App Store and Google Play**.

Read more
The Azuki team smiling and gathered together, ready to build and collaborate with clients.

Ready when you are

Let’s build something together

Whether you’re starting fresh or looking to improve things, we’re ready to talk.