RSSAmplifier

Blog

Ruby and Rust developer specializing in backend performance - Paweł Urbanek

Backend developer with over 10 years of experience. Specializing in Ruby on Rails, Rust, PostgreSQL, and backend performance.

pawelurbanek.comRSS feed ↗10 posts

Latest posts

Using LLMs and MCP to Debug PostgreSQL Performance in Rails

I’ve recently automated a large portion of my Rails performance audits. In this tutorial, I’ll describe how to configure an AI-powered PG performance debugging. We will cover using LLMs with custom MCP (model context protocol) n8n integration. We will also discuss the legal and security implications of connecting AI to the production database. How to optimize PostgreSQL performance with AI? I’m…

My puts Debugging Workflow in Rails Apps

Puts debugging is the best. In this tutorial, I’ll walk you through my workflow for debugging Rails codebases using a custom toolkit inspired by Rust. We will also discuss how to smuggle your debug tools, through even the most rigorous code review process. Why and how to puts debug Ruby code? I’ve never been a fan of (or properly learned) using debug breakpoints. While I sometimes use ruby debug ,…

Lessons Learned Migrating my SAAS to Rails 8

My side project Abot for Slack , has been around for ~7 years, i.e., since Rails 5.1 . It’s now yielding passive income while running on an almost complete autopilot. But I’m still keeping its dependencies up-to-date. The recent migration to Rails 8 was arguably the most impactful in the app’s lifetime. In this blog post, I’ll describe features introduced in the newest version of the framework and…

How to Improve Rails Caching with Brotli Compression

Caching is an effective way to speed up the performance of Rails applications. However, the costs of an in-memory cache database could become significant for larger-scale projects. In this blog post, I’ll describe optimizing the Rails caching mechanism using the Brotli compression algorithm instead of the default Gzip. I’ll also discuss a more advanced technique of using in-memory cache for…

Five Easy to Miss Performance Fixes for Rails Apps

Improving the performance of a Rails application can be a challenging and time-consuming task. However, there are some config tweaks that are often overlooked but can make a significant difference in response times. In this tutorial, I will focus on a few “quick & easy” fixes that can have an immediate impact on the speed of your Rails app. Eliminate request queue time Request queue time means…

How to Freeze ETH and ERC20 Tokens using Smart Contract

I’m still the kind of person that buys $500 worth of Dogecoin, and one day later, panic sells with a 30% loss. That’s why, I’ve developed Ethereum smart contracts that make speculating on cryptocurrencies less stressful. Locker smart contracts allow me to freeze crypto assets and only release them when enough time has passed or the price has reached a predefined value. This approach sacrifices…

How to Find, Debug and Fix N+1 Queries in Rails

Fixing N+1 issues is often the lowest-hanging fruit in optimizing a Rails app performance. However, for non-trivial cases choosing a correct fix could be challenging. Incorrectly applied eager loading does not work or even worsens response times. In this blog post, I describe tools and techniques I use to simplify resolving N+1 issues. How to simulate N+1 issues in development I doubt the Rails…

How to Subscribe to YouTube Channels Without an Account

I’m extremely cautious with YouTube. I’ve lost countless hours because of their flawless recommendation algorithms. In one of my previous posts, I describe how to “cripple” YouTube recommendations UI and start using it more deliberately. I also prefer to use YouTube without logging in, but it makes following my favorite channels difficult. So in this tutorial, I describe how to over-engineer your…

Easy to Overlook Way to Break Eager Loading in Rails Apps

In theory, configuring eager loading to avoid N+1 issues is straightforward. Chaining includes method is usually enough to ensure that all the relations data is fetched efficiently. However, this rule breaks for some easy-to-overlook edge cases. In this blog post, I’ll describe how to eager load ActiveRecord relations using custom SQL ORDER BY sorting. How to use eager loading with ORDER BY in…

How to Monitor and Fix PostgreSQL Database Locks in Rails

PostgreSQL database locks usually work seamlessly until they don’t. Before your Rails app dataset and traffic reach a certain scale, you’re unlikely to face any locks-related issues. But if your app suddenly slows down to a crawl, deadlocks likely are to blame. In this blog post, I’ll describe how to monitor database locks and propose best practices to prevent them from causing issues. PostgreSQL…