All Stories

Safe Multi-threading inside Rails Controllers with Concurrent Ruby

The classic slow controller is a dashboard that aggregates three independent services. Balance from billing, usage from the analytics service, unread count from notifications. Called sequentially, a request that should...

Database Sharding in Rails: Implementing Multi-Database Architectures

There’s a point in every growing service where the primary database becomes the bottleneck, and it’s not about reads. Read replicas solved reads. The pain is writes: one node, one...

Understanding the Go Memory Allocator: Arenas, Spans, and MCaches

Every object you allocate passes through the runtime allocator, and in a latency-sensitive Go service it is quietly responsible for more of your p99 than almost anything else. It decides...

Implementing Lock-Free Concurrent Data Structures in Go using `sync/atomic`

A shared index-update queue on one of our workers was the wall in every profile: sixteen goroutines contending on a single mutex, and the flame graph showing sync.(*Mutex).Lock as a...

Writing Custom Rack Middleware for Prometheus and OpenTelemetry instrumentation

Rails logs measure the controller. They don’t measure the queue, the auth middleware, the rate limiter, or the request as the client actually experienced it. That gap is exactly where...

Zero-Allocation Parsing and Serialization in High-Throughput Go Services

Our ingest path parses text records off a network buffer and indexes them. At 1.2M events/s, the parser was the hottest function in the service – not because parsing is...