5 hard-earned lessons from a decade of Rails performance work

The last 3,650 days of my professional life have been focused on making Rails apps faster. Below are five lessons I've learned the hard way. 1. Facts alone won't convince the business folk to care about performance The typical pitch to prioritize making an app faster & more reliable goes ... Read more

How to Start Using Counter Caches in Rails

Learn how to use counter cache in your rails app, parent-child associations, counter cache best practice. Read more

A Complete Guide to Rails Caching

A Complete Guide to Rails Caching. Application performance is always a concern when building in the modern, competitive web and mobile space. At Scout, it’s why we created application performance monitoring tools in the first place. That said, there are steps you can take to build a more ... Read more

What’s new in Rails 6?

With the official release of Rails 6 just around the corner, we round up all the major new features coming your way. It is an exciting release due to some big features coming upstream from the Basecamp and GitHub projects. Amongst the many minor updates, useful tweaks and bug fixes, Rails 6 will ship with two completely new frameworks: ActionText and ActionMailbox, and two big scalable-by-default features: parallel testing and multiple database support. So set your Gemfile to get Rails 6.0.0.rc1 and let’s get started! Read more

Making sense of ActiveRecord joins, includes, preload, and eager_load

Like a pair of jumper cables, ActiveRecord's joins , includes , preload , and eager_load methods are incredibly useful, but also very dangerous when used incorrectly. Knowing when and where to use each approach - and even when to combine them - can save you considerable trouble. Read more

Debugging with Rails Logger

If you’re a Rails developer, then you’ve probably used Rails Logger on at least one occasion or another. Or maybe you have used it without even realizing, like when you run ‘rails server’ and it prints information to the terminal window, for example. Rails Logger provides us with a powerful way of debugging our applications and gives us an insight into understanding errors when they occur. But are you using all of the Rails Logger features? There’s a good chance you are not! So let’s take a more in-depth look at the logging system in Rails, look at some of its more unknown features, and establish some best practices for our log creation in the future. Read more

Building Docker Containers for our Rails Apps

How can we take our existing Ruby on Rails applications and run them inside a Docker Container? In a recent post, we talked about Docker containers, and what you should know about them. Hopefully we cleared up any confusion you might have had about the Docker ecosystem. Perhaps with all that talk, it got you thinking about trying it out on one of your own applications? Well in this post we’d like to show you how easy it is to take your existing Ruby on Rails applications and run them inside a container. So, let’s assume you have an existing Rails project with a PostgreSQL database, and let’s walk you through the steps it would take to run this in a container instead. It’s a lot easier than you probably think! Read more

ActiveRecord: biting the hand that feeds you

Richard Schneeman (better known as Schneems) recently wrote about how he reduced his database server load by 80% ...with one simple trick . In the Hacker News discussion that followed, much of the debate was on the merits of using an ORM like ActiveRecord...or not: In every case I can ... Read more

The danger of Rails.env.production?

When I do a code review, one of the scariest things I see is logic like this: if Rails.env.production? do_additional_work end Why? Your beautiful tests and tightly integrated CI system won't execute that code. You won't see that code execute as you refresh your browser in development. From syntax errors ... Read more

Part I: How not to structure your database-backed web apps

Most scientific papers are unlikely to change your day-to-day approach as a Rails web developer. How not to structure your database-backed web applications: a study of performance bugs in the wild Yang et al., ICSE'18 is the exception to that rule. This study examined 12 popular, mature, opensource Rails apps ... Read more

Start your free 14-day trial today.
No credit card needed.