3 easy and obvious ways to start improving performance in production

by Federico Aldunate, software engineer

1. Performance should be measured

Implement a tool to measure your performance and track bugs. Options include NewRelic, AppSignal, or DataDog. Please add one of these tools to your stack and start monitoring. This is applicable to all tech stacks and is not specific to Ruby on Rails. With these tools, you can identify weak points, expensive queries, costly endpoints, and overused APIs.

Top tip

Install one of these monitoring tools. If the volume of requests makes this expensive, consider using middleware to log only 10% of requests.

2. Keep your software dependencies up to date and with decent configuration.

If your Ruby or PostgreSQL versions are outdated, you might face vulnerabilities and performance issues. Please keep your software up to date. PLEASE! Upgrading from an old version of Ruby to a newer one can significantly boost your performance. For instance, once I upgraded Ruby from 3.1.x to 3.2.x, enabled YJIT (along with Jemalloc), and experienced a 40% performance boost.

3. Understand Pareto's Rule

Using a monitoring tool can help you identify which queries are causing the most strain on your servers. For example, I once reduced memory consumption by half simply by adding memoization to a method and improving its SQL query. This one-line pull request made my client extremely happy. According to Pareto's Rule, 80% of your performance problems come from 20% of the issues. Focus on these critical issues, don't waste time on unimportant stuff, and please use monitoring tools to track and address them effectively.

More articles

Easiest way to add robots.txt and sitemap.xml in Next Js to improve SEO

Simplest way to add robots.txt and sitemap.xml in Next Js to improve SEO

Read more

Tell us about your project

Our offices

  • Remote
    Fully remote
    ADT (Atlantic Daylight Time) Time zone.
    UTC -3