Quantcast
Channel: Sam Saffron's Blog - Latest posts
Browsing all 150 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Debugging memory leaks in Ruby

At some point in the life of every Rails developer you are bound to hit a memory leak. It may be tiny amount of constant memory growth, or a spurt of growth that hits you on the job queue when certain...

View Article


Image may be NSFW.
Clik here to view.

Fixing Discourse performance regressions

Recently, I discovered a performance regression on a very common page on Discourse. I spent a fair amount of time debugging and optimizing. I follow a certain methodology while I do this kind of work....

View Article


Image may be NSFW.
Clik here to view.

WebSockets, caution required!

When developers hear that WebSockets are going to land in the near future in Rails they get all giddy with excitement. But your users don't care if you use WebSockets:Users want "delightful realtime...

View Article

Image may be NSFW.
Clik here to view.

The current state of Brotli compression

Chrome recently pushed out support for Brotli, in this post I will cover what this means to you. In late May 2016 Chrome pushed out Chrome 51, unlike many releases of Chrome which are complete...

View Article

Fastest way to profile a method in Ruby

What is the fastest and most elegant way to instrument a method in Ruby? Lately I needed to add some instruments into Discourse. I wanted every request to measure: How many SQL statements and Redis...

View Article


Image may be NSFW.
Clik here to view.

Debugging 100% CPU usage in production Ruby on Rails systems

How do you go about debugging high CPU usage in a production Rails system?Today I noticed one of our customer containers was running really high on CPU.# top -bn1 190 discour+ 20 0 2266292 205128 15656...

View Article

Image may be NSFW.
Clik here to view.

Instrumenting Rails with Prometheus

How we instrument Rails at Discourse and how you can, too.People following me have occasionally seen me post graphs like this:image.png1400x391 74.2 KBUsually people leave this type of instrumentation...

View Article

Image may be NSFW.
Clik here to view.

Reducing String duplication in Ruby

It is very likely your Rails application is full of duplicate strings, here are some tricks you can use to get rid of them.One very common problem Ruby and Rails have is memory usage. Often when...

View Article


Image may be NSFW.
Clik here to view.

Managing db schema changes without downtime

How we manage schema changes at Discourse minimizing downtimeAt Discourse we have always been huge fans of continuous deployment. Every commit we make heads to our continuous integration test suite. If...

View Article


Image may be NSFW.
Clik here to view.

An analysis of memory bloat in Active Record 5.2

Current patterns in Active Record lead to enormous amounts of resource usage. Here is an analysis of Rails 5.2One of the very noble goals the Ruby community which is being spearheaded by Matz is the...

View Article

Image may be NSFW.
Clik here to view.

Ruby's external malloc problem

In this post I would like to cover a severe, extremely hard to debug vector for memory bloat in Ruby which can be triggered by the PG gem.I have blogged a bit about the Ruby GC previously and covered...

View Article

Finding where STDOUT/STDERR debug messages are coming from

Often in development we have an annoying message in our console that we simply can not find the source of, here is a little trick you can use to hunt messages like this down.Recently, we have been...

View Article

Image may be NSFW.
Clik here to view.

Logster and our error logging strategy at Discourse

I have always been somewhat fascinated with logs. I tend to see the warning and error logs in production as a valuable heartbeat of an application. Proper handling of error logs is a very strong...

View Article


Image may be NSFW.
Clik here to view.

Why I stuck with Windows for 6 years while developing Discourse

I made this tweet that got reasonably popular:We benchmarked how long it takes to run the Ruby test suite for Discourse across our various dev machines. I can not believe what a crazy tax I have paid...

View Article

Image may be NSFW.
Clik here to view.

My i3 window manager setup

I have been a long time i3 window manager user. But not really.My old Windows 10 based setup involved doing all my console work in an Ubuntu VM running i3. However, the lion’s share of the non console...

View Article


Image may be NSFW.
Clik here to view.

Tests that sometimes fail

wolf.jpg695×564 286 KB A liar will not be believed, even when he speaks the truth. : AesopOnce you have a project that is a few years old with a large test suite an ugly pattern emerges.Some tests that...

View Article

Image may be NSFW.
Clik here to view.

Debugging hidden memory leaks in Ruby

In 2015 I wrote about some of the tooling Ruby provides for diagnosing managed memory leaks. The article mostly focused on the easy managed leaks.This article covers tools and tricks you can use to...

View Article


Image may be NSFW.
Clik here to view.

Claude 3 Opus - First impressions

Disclaimers and technical detailsIf you are looking for comprehensive benchmarks, head over the Anthropic announcement blog post, or to the fantastic LMSYS leaderboard.My goal with this blog post is to...

View Article

Tests that sometimes fail - flaky test tips

Regarding the conflict between hardcoded ids and database sequences, I would propose a better solution. The trick is easy, you could just set a minimal value for every sequence before starting tests....

View Article

Image may be NSFW.
Clik here to view.

Tests that sometimes fail - flaky test tips

We went on a similar journey with flakey tests a while back. Most of them were database state issues, or race conditions in feature specs. Keith posted some of the tools we added to help identify and...

View Article
Browsing all 150 articles
Browse latest View live