Tag go

Serialization Benchmarks: Go JSON vs. Protobuf vs. FlatBuffers

Why serialization keeps topping your pprof

Multi-tenant Database Routing and Connection Pooling in Go microservices

The simplest multi-tenant design in Go is also the most dangerous: one *sql.DB per tenant, looked up from a map at request time. It works beautifully for ten tenants and...

Go Scheduler Deep Dive: Work-Stealing, Preemption, and OS Thread Matching

Go’s concurrency story rests on one runtime component most engineers never look at: the scheduler. If you have ever seen a service with 300,000 goroutines and 12 cores stay responsive,...

Go Generics under the Hood: Performance Costs and Monomorphization

When Go 1.18 shipped generics, the design had to thread a needle: be fast like C++ templates without their binary bloat, and be ergonomic without Java’s boxing tax. The answer...

Detecting and Debugging Goroutine Leaks in Production Go Applications

A goroutine leak is the sneakiest way to lose memory in Go, because the memory is not garbage: it is a live stack, referenced by a blocked goroutine, unreachable to...

Go Concurrency Patterns: Channels vs. Mutexes in High-Performance Applications

The advice “share memory by communicating” has done more damage than good. It was written for clarity, not throughput, and teams have shipped channel-based counters and caches that run 5-10x...

Building a High-Performance JSON Parser using Go Code Generation

Every few months someone on the team proposes “we should just use a faster JSON library” and benchmarks encoding/json against a dropped-in replacement, sees a 2x, and ships it. That’s...

Go Compiler Internals: Escape Analysis, Function Inlining, and devirtualization

The difference between a handler that does 40 allocations per request and one that does four is usually not your data structures. It is whether the compiler managed to keep...

Designing a Low-Latency API Gateway Routing Tree in Go using Radix Trees

An API gateway sits in front of every upstream call, so its router is the hottest code path in the fleet. A linear scan over registered patterns is O(N) in...

Go Garbage Collector Tuning: GOGC and GOMEMLIMIT Deep Dive

A 2GB Kubernetes pod running a Go service with default GOGC=100 has a GC that will happily let the heap double before it starts collecting. That is by design: the...

Structured Logging Performance: Custom zap and slog Configurations in Go

Logging is the last thing anyone profiles and the first thing that sinks a latency budget. A service doing 10k req/s with two or three log lines per request is...

Writing eBPF Programs in C and Loading Them with Go: System Telemetry at Scale

Our Redis client was pushing a sustained 8% CPU on every API node, and pprof could not tell us why. The CPU profile blamed runtime.futex, which is not an answer;...

Context Propagation in Go: Building Distributed Tracing Middleware

We spent a week hunting a checkout outage the tracing dashboards could not explain. The gateway started a span, then the trace went dark: payment logged an empty trace ID,...

Optimizing Go TLS Handshake Latency for HTTP/2 Servers

What the handshake actually costs

Custom Network Programming with Epoll and Kqueue in Go

Go already has a netpoll – know why you would reimplement it

Structured Concurrency in Go: Managing Subtask Lifecycles with golang.org/x/sync/errgroup

sync.WaitGroup answers one question: “is everyone done?” It cannot tell you someone failed, and it certainly cannot stop the others when one does. For fan-out over shards, partitions, or upstreams...

gRPC Client-side Load Balancing in Go: Implementing Custom Resolvers

gRPC is built on HTTP/2, and HTTP/2 wants a few long-lived connections, not many short ones. Put a classic L4 or L7 load balancer in front and you have re-introduced...

Writing a High-Throughput Custom DNS Resolver in Go

A crawler or an ingress resolving thousands of distinct hostnames per second exposes a gap in the standard library. The folklore is that net.LookupHost blocks OS threads via cgo —...

Profiling Go Memory and CPU Bottlenecks with `go tool pprof` and `trace`

Guessing where CPU goes is how services die slowly. Go ships a world-class profiler; the real skill is using it correctly, because each profile type answers a different question and...

Designing a High-Throughput Worker Pool in Go for API Ingestion

Goroutines are cheap — a couple of KiB of stack, sub-microsecond spawn — so teams over-rotated from “thread per request” to “goroutine per request” and hit a wall. Unbounded concurrency...

High-Performance I/O in Go: Custom io.Reader and io.Writer Optimizations

A read syscall costs a few hundred nanoseconds to a few microseconds depending on kernel and storage. That sounds cheap until you multiply by bytes. A 1 GiB log file...

Implementing Graceful Shutdown in Distributed Go Microservices

Kubernetes terminates pods the same way every time: it sends SIGTERM, waits terminationGracePeriodSeconds (30 by default), then sends SIGKILL. If your service treats SIGTERM as “start dying right now”, every...

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...

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...

Building a Replicated State Machine in Go using the Raft Consensus Algorithm

Every gateway node in our fleet needs the same piece of truth at boot: the shard-to-node mapping, the config revision, the list of revoked keys. Before Raft, that truth lived...

Go `sync.Pool` Mechanics: Minimizing Allocation Pressure and GC Interactions

Our request marshaling path allocated a handful of small buffers per request – fine at 1k req/s, a garbage problem at 20k. sync.Pool looked like the obvious fix, and it...

Building an API Gateway Rate Limiter in Go using the Token Bucket Algorithm

Our gateway terminates traffic for public APIs, and the first thing every unauthenticated request hits is a per-API-key limiter. With 50k active keys and a sustained 100k req/s, the limiting...

Optimizing Struct Layouts in Go to Reduce Memory Padding and Cache Misses

Eight bytes per struct. That is what a careless field order cost us in a 1M-record in-memory index we cache in a service that answers every lookup request. Eight bytes...

Implementing Distributed Circuit Breakers in Go without External Dependencies

We ran a checkout pipeline that fronted a legacy payments gateway. The gateway had a 3-second timeout and, once every few weeks, it would wedge for ten minutes. The client...

Using unsafe.Pointer in Go for Zero-Copy Struct Conversion and System Calls

Every packet that crosses our gateway gets decoded into a struct. The naive path – encoding/binary reading seven fields one at a time, on every packet – is slow in...

Go Slice Growth Mechanics: Benchmarking Pre-allocation Strategies

The append loop that grows a slice one element at a time is the most common allocation smell we find in Go production code. It is not wrong, exactly –...

Tag slice

Go Slice Growth Mechanics: Benchmarking Pre-allocation Strategies

The append loop that grows a slice one element at a time is the most common allocation smell we find in Go production code. It is not wrong, exactly –...

Tag preallocation

Go Slice Growth Mechanics: Benchmarking Pre-allocation Strategies

The append loop that grows a slice one element at a time is the most common allocation smell we find in Go production code. It is not wrong, exactly –...

Tag performance

Speculative Decoding: Accelerating LLM Inference in Production

Decode is memory-bandwidth-bound, and that single fact is why speculative decoding is the cheapest throughput win an inference team can spend a week on. Every autoregressive step loads the entire...

High-Performance JSON Serialization: Benchmarking Oj, Blueprinter, and Fast JSON API

The last place I look when an API endpoint is slow is the serializer, and that’s a mistake. On a typical list endpoint the serializer is where most of the...

Multi-tenant Database Routing and Connection Pooling in Go microservices

The simplest multi-tenant design in Go is also the most dangerous: one *sql.DB per tenant, looked up from a map at request time. It works beautifully for ten tenants and...

Go Generics under the Hood: Performance Costs and Monomorphization

When Go 1.18 shipped generics, the design had to thread a needle: be fast like C++ templates without their binary bloat, and be ergonomic without Java’s boxing tax. The answer...

Scaling Sidekiq: Advanced Job Deduplication and Multi-tenant Rate Limiting

Sidekiq’s contract is “push work, forget it,” but the moment you have an event bus that emits per-entity changes, you discover how literally Sidekiq honors that contract. Ten indexing jobs...

Go Garbage Collector Tuning: GOGC and GOMEMLIMIT Deep Dive

A 2GB Kubernetes pod running a Go service with default GOGC=100 has a GC that will happily let the heap double before it starts collecting. That is by design: the...

Unlocking Speed: Rails Performance Tuning with Ruby 3 YJIT

In Ruby 3.3, YJIT is production-ready. Shopify’s numbers, the Optcarrot benchmark, and the Rails core team all point the same direction: roughly 15–25% latency improvement on real Rails workloads, for...

ActiveRecord Eager Loading Pitfalls: Subqueries vs. IN Clauses

includes is the most convenient lie in ActiveRecord. You write one method call, and ActiveRecord decides for you whether to emit two queries joined by an IN clause (preload) or...

Quantization Deep Dive: Math of GGUF, AWQ, and BitsAndBytes Double Quantization

Quantization is how a 7B model becomes a weekend desktop project instead of a dedicated server: fp16 weights are 14 GB, int8 is 7 GB, 4-bit is about 3.5 GB....

Optimizing Go TLS Handshake Latency for HTTP/2 Servers

What the handshake actually costs

Scaling ActionCable to 10k Active WebSockets with Redis Pub/Sub

WebSockets look like the same stack as HTTP and are, in every way that matters, the opposite. An HTTP request occupies a thread for a hundred milliseconds and leaves. A...

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...

Using unsafe.Pointer in Go for Zero-Copy Struct Conversion and System Calls

Every packet that crosses our gateway gets decoded into a struct. The naive path – encoding/binary reading seven fields one at a time, on every packet – is slow in...

Go Slice Growth Mechanics: Benchmarking Pre-allocation Strategies

The append loop that grows a slice one element at a time is the most common allocation smell we find in Go production code. It is not wrong, exactly –...

Tag activesupport

Using ActiveSupport::Notifications for Advanced App Tracing and Telemetry

Rails instruments almost every meaningful point in the request lifecycle already: SQL execution, view and partial rendering, cache reads, and full controller actions. It publishes all of it on a...

Tag notifications

Using ActiveSupport::Notifications for Advanced App Tracing and Telemetry

Rails instruments almost every meaningful point in the request lifecycle already: SQL execution, view and partial rendering, cache reads, and full controller actions. It publishes all of it on a...

Tag telemetry

eBPF-Based Telemetry for LLM Inference Endpoints: Profiling CPU/GPU Latencies

If you serve LLM inference at any real scale, your standard monitoring stack has a blind spot exactly where your tokens actually spend time: the kernel. Prometheus exporters and Datadog...

Writing eBPF Programs in C and Loading Them with Go: System Telemetry at Scale

Our Redis client was pushing a sustained 8% CPU on every API node, and pprof could not tell us why. The CPU profile blamed runtime.futex, which is not an answer;...

Context Propagation in Go: Building Distributed Tracing Middleware

We spent a week hunting a checkout outage the tracing dashboards could not explain. The gateway started a span, then the trace went dark: payment logged an empty trace ID,...

Profiling Go Memory and CPU Bottlenecks with `go tool pprof` and `trace`

Guessing where CPU goes is how services die slowly. Go ships a world-class profiler; the real skill is using it correctly, because each profile type answers a different question and...

Using ActiveSupport::Notifications for Advanced App Tracing and Telemetry

Rails instruments almost every meaningful point in the request lifecycle already: SQL execution, view and partial rendering, cache reads, and full controller actions. It publishes all of it on a...

Tag opentelemetry

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...

Using ActiveSupport::Notifications for Advanced App Tracing and Telemetry

Rails instruments almost every meaningful point in the request lifecycle already: SQL execution, view and partial rendering, cache reads, and full controller actions. It publishes all of it on a...

Tag unsafe

Using unsafe.Pointer in Go for Zero-Copy Struct Conversion and System Calls

Every packet that crosses our gateway gets decoded into a struct. The naive path – encoding/binary reading seven fields one at a time, on every packet – is slow in...

Tag pointer

Using unsafe.Pointer in Go for Zero-Copy Struct Conversion and System Calls

Every packet that crosses our gateway gets decoded into a struct. The naive path – encoding/binary reading seven fields one at a time, on every packet – is slow in...

Tag circuit_breaker

Implementing Distributed Circuit Breakers in Go without External Dependencies

We ran a checkout pipeline that fronted a legacy payments gateway. The gateway had a 3-second timeout and, once every few weeks, it would wedge for ten minutes. The client...

Tag resiliency

Implementing Distributed Circuit Breakers in Go without External Dependencies

We ran a checkout pipeline that fronted a legacy payments gateway. The gateway had a 3-second timeout and, once every few weeks, it would wedge for ten minutes. The client...

Tag microservices

Implementing Graceful Shutdown in Distributed Go Microservices

Kubernetes terminates pods the same way every time: it sends SIGTERM, waits terminationGracePeriodSeconds (30 by default), then sends SIGKILL. If your service treats SIGTERM as “start dying right now”, every...

Implementing Distributed Circuit Breakers in Go without External Dependencies

We ran a checkout pipeline that fronted a legacy payments gateway. The gateway had a 3-second timeout and, once every few weeks, it would wedge for ten minutes. The client...

Tag struct

Optimizing Struct Layouts in Go to Reduce Memory Padding and Cache Misses

Eight bytes per struct. That is what a careless field order cost us in a 1M-record in-memory index we cache in a service that answers every lookup request. Eight bytes...

Tag padding

Optimizing Struct Layouts in Go to Reduce Memory Padding and Cache Misses

Eight bytes per struct. That is what a careless field order cost us in a 1M-record in-memory index we cache in a service that answers every lookup request. Eight bytes...

Tag memory

Ruby YJIT Memory Footprint: Optimization Strategies for Kubernetes Deployments

Since Rails 7.2 made YJIT the default JIT in August 2024, most Rails apps picked up a 15-25% throughput bump for free. The bill shows up on Kubernetes in a...

Memory-Augmented Agents: MemGPT and Semantic DB Storage Layer design

The naive fix for agents that forget is to buy a bigger context window. We ran that playbook and it is a trap: the failure mode of a long conversation...

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...

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...

Go `sync.Pool` Mechanics: Minimizing Allocation Pressure and GC Interactions

Our request marshaling path allocated a handful of small buffers per request – fine at 1k req/s, a garbage problem at 20k. sync.Pool looked like the obvious fix, and it...

Optimizing Struct Layouts in Go to Reduce Memory Padding and Cache Misses

Eight bytes per struct. That is what a careless field order cost us in a 1M-record in-memory index we cache in a service that answers every lookup request. Eight bytes...

Tag rate_limiter

Building an API Gateway Rate Limiter in Go using the Token Bucket Algorithm

Our gateway terminates traffic for public APIs, and the first thing every unauthenticated request hits is a per-API-key limiter. With 50k active keys and a sustained 100k req/s, the limiting...

Tag token_bucket

Building an API Gateway Rate Limiter in Go using the Token Bucket Algorithm

Our gateway terminates traffic for public APIs, and the first thing every unauthenticated request hits is a per-API-key limiter. With 50k active keys and a sustained 100k req/s, the limiting...

Tag concurrency

Real-Time Event Streaming in Rails using ActionController::Live and Server-Sent Events (SSE)

“Real-time dashboard” is the feature that silently becomes an architecture decision. The naive version polls a JSON endpoint every second: one client is nothing, but 500 dashboards at 1 req/s...

Go Scheduler Deep Dive: Work-Stealing, Preemption, and OS Thread Matching

Go’s concurrency story rests on one runtime component most engineers never look at: the scheduler. If you have ever seen a service with 300,000 goroutines and 12 cores stay responsive,...

Go Concurrency Patterns: Channels vs. Mutexes in High-Performance Applications

The advice “share memory by communicating” has done more damage than good. It was written for clarity, not throughput, and teams have shipped channel-based counters and caches that run 5-10x...

Scaling Sidekiq: Advanced Job Deduplication and Multi-tenant Rate Limiting

Sidekiq’s contract is “push work, forget it,” but the moment you have an event bus that emits per-entity changes, you discover how literally Sidekiq honors that contract. Ten indexing jobs...

ActiveJob Scaling: Thread Pools, DB Pool Sizes, and PostgreSQL Contention

The incident is boring and predictable: someone bumps Sidekiq concurrency from 10 to 25, and within an hour pager duty is looking at ActiveRecord::ConnectionTimeoutError across every web and worker process....

Testing Complex Race Conditions and Concurrency in RSpec

The trap: a “concurrent” test that never races

Structured Concurrency in Go: Managing Subtask Lifecycles with golang.org/x/sync/errgroup

sync.WaitGroup answers one question: “is everyone done?” It cannot tell you someone failed, and it certainly cannot stop the others when one does. For fan-out over shards, partitions, or upstreams...

Designing a High-Throughput Worker Pool in Go for API Ingestion

Goroutines are cheap — a couple of KiB of stack, sub-microsecond spawn — so teams over-rotated from “thread per request” to “goroutine per request” and hit a wall. Unbounded concurrency...

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...

Building an API Gateway Rate Limiter in Go using the Token Bucket Algorithm

Our gateway terminates traffic for public APIs, and the first thing every unauthenticated request hits is a per-API-key limiter. With 50k active keys and a sustained 100k req/s, the limiting...

Tag sync_pool

Go `sync.Pool` Mechanics: Minimizing Allocation Pressure and GC Interactions

Our request marshaling path allocated a handful of small buffers per request – fine at 1k req/s, a garbage problem at 20k. sync.Pool looked like the obvious fix, and it...

Tag gc

Go Garbage Collector Tuning: GOGC and GOMEMLIMIT Deep Dive

A 2GB Kubernetes pod running a Go service with default GOGC=100 has a GC that will happily let the heap double before it starts collecting. That is by design: the...

Go `sync.Pool` Mechanics: Minimizing Allocation Pressure and GC Interactions

Our request marshaling path allocated a handful of small buffers per request – fine at 1k req/s, a garbage problem at 20k. sync.Pool looked like the obvious fix, and it...

Tag raft

Building a Replicated State Machine in Go using the Raft Consensus Algorithm

Every gateway node in our fleet needs the same piece of truth at boot: the shard-to-node mapping, the config revision, the list of revoked keys. Before Raft, that truth lived...

Tag distributed_systems

Building a Replicated State Machine in Go using the Raft Consensus Algorithm

Every gateway node in our fleet needs the same piece of truth at boot: the shard-to-node mapping, the config revision, the list of revoked keys. Before Raft, that truth lived...

Tag consensus

Building a Replicated State Machine in Go using the Raft Consensus Algorithm

Every gateway node in our fleet needs the same piece of truth at boot: the shard-to-node mapping, the config revision, the list of revoked keys. Before Raft, that truth lived...

Tag activerecord

Custom Database Adapters and Connection Pools in Rails 7.2

We run a 12-server Puma fleet against a Postgres primary and two read replicas. For a long time our read/write splitting was manual: a sidecar script rewrote database.yml on deploy...

ActiveRecord Eager Loading Pitfalls: Subqueries vs. IN Clauses

includes is the most convenient lie in ActiveRecord. You write one method call, and ActiveRecord decides for you whether to emit two queries joined by an IN clause (preload) or...

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...

ActiveRecord Validations vs. Database Constraints: Finding the Optimal Balance

validates_uniqueness_of is not a data-integrity mechanism. It is a user-experience mechanism, and treating it as anything more is how you end up with duplicate invoices. The failure mode is embarrassingly...

Tag validations

ActiveRecord Validations vs. Database Constraints: Finding the Optimal Balance

validates_uniqueness_of is not a data-integrity mechanism. It is a user-experience mechanism, and treating it as anything more is how you end up with duplicate invoices. The failure mode is embarrassingly...

Tag constraints

ActiveRecord Validations vs. Database Constraints: Finding the Optimal Balance

validates_uniqueness_of is not a data-integrity mechanism. It is a user-experience mechanism, and treating it as anything more is how you end up with duplicate invoices. The failure mode is embarrassingly...

Tag database

Multi-tenant Database Routing and Connection Pooling in Go microservices

The simplest multi-tenant design in Go is also the most dangerous: one *sql.DB per tenant, looked up from a map at request time. It works beautifully for ten tenants and...

Custom Database Adapters and Connection Pools in Rails 7.2

We run a 12-server Puma fleet against a Postgres primary and two read replicas. For a long time our read/write splitting was manual: a sidecar script rewrote database.yml on deploy...

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...

Zero-Downtime Database Migrations in Rails: Guarding Production with Strong Migrations

The migration that nearly took us down wasn’t a clever one. It was add_index :orders, :customer_id, run at 2pm against a table with 40 million rows. Postgres holds a SHARE...

ActiveRecord Validations vs. Database Constraints: Finding the Optimal Balance

validates_uniqueness_of is not a data-integrity mechanism. It is a user-experience mechanism, and treating it as anything more is how you end up with duplicate invoices. The failure mode is embarrassingly...

Tag migrations

Zero-Downtime Database Migrations in Rails: Guarding Production with Strong Migrations

The migration that nearly took us down wasn’t a clever one. It was add_index :orders, :customer_id, run at 2pm against a table with 40 million rows. Postgres holds a SHARE...

Tag strong_migrations

Zero-Downtime Database Migrations in Rails: Guarding Production with Strong Migrations

The migration that nearly took us down wasn’t a clever one. It was add_index :orders, :customer_id, run at 2pm against a table with 40 million rows. Postgres holds a SHARE...

Tag rails

Unlocking Speed: Rails Performance Tuning with Ruby 3 YJIT

In Ruby 3.3, YJIT is production-ready. Shopify’s numbers, the Optcarrot benchmark, and the Rails core team all point the same direction: roughly 15–25% latency improvement on real Rails workloads, for...

Zero-Downtime Database Migrations in Rails: Guarding Production with Strong Migrations

The migration that nearly took us down wasn’t a clever one. It was add_index :orders, :customer_id, run at 2pm against a table with 40 million rows. Postgres holds a SHARE...

Tag zero_allocation

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...

Tag parsing

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...

Tag rack

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...

Tag middleware

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...

Tag prometheus

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...

Tag atomic

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...

Tag lock_free

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...

Tag allocator

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...

Tag tcmalloc

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...

Tag sharding

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...

Tag rails6

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...

Tag concurrent_ruby

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...

Tag multithreading

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...

Tag controllers

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...

Tag graceful_shutdown

Implementing Graceful Shutdown in Distributed Go Microservices

Kubernetes terminates pods the same way every time: it sends SIGTERM, waits terminationGracePeriodSeconds (30 by default), then sends SIGKILL. If your service treats SIGTERM as “start dying right now”, every...

Tag systems

Writing eBPF Programs in C and Loading Them with Go: System Telemetry at Scale

Our Redis client was pushing a sustained 8% CPU on every API node, and pprof could not tell us why. The CPU profile blamed runtime.futex, which is not an answer;...

Implementing Graceful Shutdown in Distributed Go Microservices

Kubernetes terminates pods the same way every time: it sends SIGTERM, waits terminationGracePeriodSeconds (30 by default), then sends SIGKILL. If your service treats SIGTERM as “start dying right now”, every...

Tag io

High-Performance I/O in Go: Custom io.Reader and io.Writer Optimizations

A read syscall costs a few hundred nanoseconds to a few microseconds depending on kernel and storage. That sounds cheap until you multiply by bytes. A 1 GiB log file...

Tag reader

High-Performance I/O in Go: Custom io.Reader and io.Writer Optimizations

A read syscall costs a few hundred nanoseconds to a few microseconds depending on kernel and storage. That sounds cheap until you multiply by bytes. A 1 GiB log file...

Tag writer

High-Performance I/O in Go: Custom io.Reader and io.Writer Optimizations

A read syscall costs a few hundred nanoseconds to a few microseconds depending on kernel and storage. That sounds cheap until you multiply by bytes. A 1 GiB log file...

Tag security

Implementing Llama Guard: Multi-stage Safety Filtering for LLM Gateways

We run a customer-facing LLM gateway in front of a hosted model, and the threat model is unglamorous but real: prompt injection trying to exfiltrate another tenant’s data, jailbreaks attempting...

Implementing Idempotent API Endpoints in Rails using Redis Lock and Request Signatures

A client POSTs a payment, the connection drops mid-response, and the client retries. If your endpoint is not idempotent, the second request charges the card twice. At roughly 3M mutating...

Hardening Rails Security: Implementing Strict Content Security Policy (CSP) and SRI Headers

Browser XSS filters were always a poor backstop, and they’re not even that anymore. The real defense is telling the browser exactly what it’s allowed to execute, and Content Security...

Tag csp

Hardening Rails Security: Implementing Strict Content Security Policy (CSP) and SRI Headers

Browser XSS filters were always a poor backstop, and they’re not even that anymore. The real defense is telling the browser exactly what it’s allowed to execute, and Content Security...

Tag sri

Hardening Rails Security: Implementing Strict Content Security Policy (CSP) and SRI Headers

Browser XSS filters were always a poor backstop, and they’re not even that anymore. The real defense is telling the browser exactly what it’s allowed to execute, and Content Security...

Tag headers

Hardening Rails Security: Implementing Strict Content Security Policy (CSP) and SRI Headers

Browser XSS filters were always a poor backstop, and they’re not even that anymore. The real defense is telling the browser exactly what it’s allowed to execute, and Content Security...

Tag worker_pool

Designing a High-Throughput Worker Pool in Go for API Ingestion

Goroutines are cheap — a couple of KiB of stack, sub-microsecond spawn — so teams over-rotated from “thread per request” to “goroutine per request” and hit a wall. Unbounded concurrency...

Tag channels

Go Concurrency Patterns: Channels vs. Mutexes in High-Performance Applications

The advice “share memory by communicating” has done more damage than good. It was written for clarity, not throughput, and teams have shipped channel-based counters and caches that run 5-10x...

Designing a High-Throughput Worker Pool in Go for API Ingestion

Goroutines are cheap — a couple of KiB of stack, sub-microsecond spawn — so teams over-rotated from “thread per request” to “goroutine per request” and hit a wall. Unbounded concurrency...

Tag pprof

Profiling Go Memory and CPU Bottlenecks with `go tool pprof` and `trace`

Guessing where CPU goes is how services die slowly. Go ships a world-class profiler; the real skill is using it correctly, because each profile type answers a different question and...

Tag profiling

Profiling Go Memory and CPU Bottlenecks with `go tool pprof` and `trace`

Guessing where CPU goes is how services die slowly. Go ships a world-class profiler; the real skill is using it correctly, because each profile type answers a different question and...

Tag dns

Writing a High-Throughput Custom DNS Resolver in Go

A crawler or an ingress resolving thousands of distinct hostnames per second exposes a gap in the standard library. The folklore is that net.LookupHost blocks OS threads via cgo —...

Tag resolver

Writing a High-Throughput Custom DNS Resolver in Go

A crawler or an ingress resolving thousands of distinct hostnames per second exposes a gap in the standard library. The folklore is that net.LookupHost blocks OS threads via cgo —...

Tag networking

Custom Network Programming with Epoll and Kqueue in Go

Go already has a netpoll – know why you would reimplement it

Writing a High-Throughput Custom DNS Resolver in Go

A crawler or an ingress resolving thousands of distinct hostnames per second exposes a gap in the standard library. The folklore is that net.LookupHost blocks OS threads via cgo —...

Tag grpc

gRPC Client-side Load Balancing in Go: Implementing Custom Resolvers

gRPC is built on HTTP/2, and HTTP/2 wants a few long-lived connections, not many short ones. Put a classic L4 or L7 load balancer in front and you have re-introduced...

Tag load_balancing

gRPC Client-side Load Balancing in Go: Implementing Custom Resolvers

gRPC is built on HTTP/2, and HTTP/2 wants a few long-lived connections, not many short ones. Put a classic L4 or L7 load balancer in front and you have re-introduced...

Tag resolvers

gRPC Client-side Load Balancing in Go: Implementing Custom Resolvers

gRPC is built on HTTP/2, and HTTP/2 wants a few long-lived connections, not many short ones. Put a classic L4 or L7 load balancer in front and you have re-introduced...

Tag errgroup

Structured Concurrency in Go: Managing Subtask Lifecycles with golang.org/x/sync/errgroup

sync.WaitGroup answers one question: “is everyone done?” It cannot tell you someone failed, and it certainly cannot stop the others when one does. For fan-out over shards, partitions, or upstreams...

Tag error_handling

Structured Concurrency in Go: Managing Subtask Lifecycles with golang.org/x/sync/errgroup

sync.WaitGroup answers one question: “is everyone done?” It cannot tell you someone failed, and it certainly cannot stop the others when one does. For fan-out over shards, partitions, or upstreams...

Tag interfaces

Tag devirtualization

Tag compiler

Go Compiler Internals: Escape Analysis, Function Inlining, and devirtualization

The difference between a handler that does 40 allocations per request and one that does four is usually not your data structures. It is whether the compiler managed to keep...

Tag actioncable

Rails Solid Cable: Redis-free WebSockets at Scale

ActionCable’s Redis dependency always annoyed me, and not for the reasons people usually cite. The latency argument against database pub/sub is mostly wrong at small scale — the real cost...

Scaling ActionCable to 10k Active WebSockets with Redis Pub/Sub

WebSockets look like the same stack as HTTP and are, in every way that matters, the opposite. An HTTP request occupies a thread for a hundred milliseconds and leaves. A...

Tag websockets

Rails Solid Cable: Redis-free WebSockets at Scale

ActionCable’s Redis dependency always annoyed me, and not for the reasons people usually cite. The latency argument against database pub/sub is mostly wrong at small scale — the real cost...

Scaling ActionCable to 10k Active WebSockets with Redis Pub/Sub

WebSockets look like the same stack as HTTP and are, in every way that matters, the opposite. An HTTP request occupies a thread for a hundred milliseconds and leaves. A...

Tag redis

Rails Solid Cache: Dropping Redis for Database-Backed Caching

The Redis cache bill is a weird tax. You’re paying premium RAM prices for data that is, by definition, disposable — regenerate it and nothing breaks. When our cache footprint...

Scaling Sidekiq: Advanced Job Deduplication and Multi-tenant Rate Limiting

Sidekiq’s contract is “push work, forget it,” but the moment you have an event bus that emits per-entity changes, you discover how literally Sidekiq honors that contract. Ten indexing jobs...

Implementing Idempotent API Endpoints in Rails using Redis Lock and Request Signatures

A client POSTs a payment, the connection drops mid-response, and the client retries. If your endpoint is not idempotent, the second request charges the card twice. At roughly 3M mutating...

Scaling ActionCable to 10k Active WebSockets with Redis Pub/Sub

WebSockets look like the same stack as HTTP and are, in every way that matters, the opposite. An HTTP request occupies a thread for a hundred milliseconds and leaves. A...

Tag netpoll

Custom Network Programming with Epoll and Kqueue in Go

Go already has a netpoll – know why you would reimplement it

Tag epoll

Custom Network Programming with Epoll and Kqueue in Go

Go already has a netpoll – know why you would reimplement it

Tag multitenancy

Multi-tenant Database Routing and Connection Pooling in Go microservices

The simplest multi-tenant design in Go is also the most dangerous: one *sql.DB per tenant, looked up from a map at request time. It works beautifully for ten tenants and...

Tag postgres

Debugging Solid Queue Deadlocks: Transaction Isolation Levels and Row Locks

Rails 8 shipped on November 7, 2024 with Solid Queue as the default background-job adapter — a Postgres-backed queue that fits the “one less database” story. We migrated a roughly...

ActiveJob Scaling: Thread Pools, DB Pool Sizes, and PostgreSQL Contention

The incident is boring and predictable: someone bumps Sidekiq concurrency from 10 to 25, and within an hour pager duty is looking at ActiveRecord::ConnectionTimeoutError across every web and worker process....

Tag saas

Tag lsm_tree

Tag storage_engine

Tag rack_attack

Tag rate_limiting

Tag rspec

Testing Complex Race Conditions and Concurrency in RSpec

The trap: a “concurrent” test that never races

Tag testing

Designing an LLM Evaluation Harness: Judge-LLM Alignment and Benchmarks

BLEU and ROUGE did not catch a single regression for us. The rewrite that scored +3 ROUGE against the old transcripts was, by any human reading, worse — it hedged,...

Testing Complex Race Conditions and Concurrency in RSpec

The trap: a “concurrent” test that never races

Tag race_conditions

Testing Complex Race Conditions and Concurrency in RSpec

The trap: a “concurrent” test that never races

Tag tls

Optimizing Go TLS Handshake Latency for HTTP/2 Servers

What the handshake actually costs

Tag http2

Optimizing Go TLS Handshake Latency for HTTP/2 Servers

What the handshake actually costs

Tag rag

Enterprise Text-to-SQL: Building Self-Correcting Execution Loops

Text-to-SQL looks solved in demos and falls apart in production, always in the same four ways: the model invents column names the schema never had, it emits syntax that parses...

Building Multi-modal RAG Pipelines with Llama 3.1 and Qdrant

Let me correct the framing up front: Llama 3.1 is text-only. The 8B, 70B, and 405B models released in July 2024 consume tokens, not pixels. Any pipeline that claims to...

Fine-tuning Embedding Models for Domain-Specific Vector Space Alignment

Off-the-shelf embedders understand generic language and nothing else. BGE-small and OpenAI’s Ada-002 encode “what is the refund policy” beautifully; ask them about an internal part number like OCT-4472-REV3 or a...

Agentic RAG: Knowledge Graph Indexing and Traversal with Neo4j

Vector RAG answered “what does the payment service do?” beautifully and went blind on “what did the author build for the payment service while reporting to project manager X?” The...

Optimizing RAG: BM25 + Dense Retriever Hybrid Search and Cross-Encoder Reranking

We shipped our first RAG pipeline with a single dense retriever and got paged within a week: users searching for a firmware error code like ERR_0x84F2 or a part number...

Tag bm25

Optimizing RAG: BM25 + Dense Retriever Hybrid Search and Cross-Encoder Reranking

We shipped our first RAG pipeline with a single dense retriever and got paged within a week: users searching for a firmware error code like ERR_0x84F2 or a part number...

Tag rerank

Optimizing RAG: BM25 + Dense Retriever Hybrid Search and Cross-Encoder Reranking

We shipped our first RAG pipeline with a single dense retriever and got paged within a week: users searching for a firmware error code like ERR_0x84F2 or a part number...

Tag cross_encoder

Optimizing RAG: BM25 + Dense Retriever Hybrid Search and Cross-Encoder Reranking

We shipped our first RAG pipeline with a single dense retriever and got paged within a week: users searching for a firmware error code like ERR_0x84F2 or a part number...

Tag quantization

Practical Guide to Model Distillation: From DeepSeek-R1 to edge-ready SLMs

When DeepSeek-R1 landed in January 2025, it proved that chain-of-thought plus reinforcement learning could push open models to near-frontier reasoning on math and code. It also proved something less convenient:...

Quantization Deep Dive: Math of GGUF, AWQ, and BitsAndBytes Double Quantization

Quantization is how a 7B model becomes a weekend desktop project instead of a dedicated server: fp16 weights are 14 GB, int8 is 7 GB, 4-bit is about 3.5 GB....

Tag gguf

Quantization Deep Dive: Math of GGUF, AWQ, and BitsAndBytes Double Quantization

Quantization is how a 7B model becomes a weekend desktop project instead of a dedicated server: fp16 weights are 14 GB, int8 is 7 GB, 4-bit is about 3.5 GB....

Tag awq

Quantization Deep Dive: Math of GGUF, AWQ, and BitsAndBytes Double Quantization

Quantization is how a 7B model becomes a weekend desktop project instead of a dedicated server: fp16 weights are 14 GB, int8 is 7 GB, 4-bit is about 3.5 GB....

Tag vector_db

Memory-Augmented Agents: MemGPT and Semantic DB Storage Layer design

The naive fix for agents that forget is to buy a bigger context window. We ran that playbook and it is a trap: the failure mode of a long conversation...

Vector Search Indexing: HNSW vs. IVF-PQ in pgvector and Qdrant

Every vector index is a bet on a triangle: recall, latency, and memory. Flat scan sits at one corner — perfect recall, but at 1M 1536-d vectors (about 6 GB...

Tag hnsw

Vector Search Indexing: HNSW vs. IVF-PQ in pgvector and Qdrant

Every vector index is a bet on a triangle: recall, latency, and memory. Flat scan sits at one corner — perfect recall, but at 1M 1536-d vectors (about 6 GB...

Tag pgvector

Vector Search Indexing: HNSW vs. IVF-PQ in pgvector and Qdrant

Every vector index is a bet on a triangle: recall, latency, and memory. Flat scan sits at one corner — perfect recall, but at 1M 1536-d vectors (about 6 GB...

Tag qdrant

Building Multi-modal RAG Pipelines with Llama 3.1 and Qdrant

Let me correct the framing up front: Llama 3.1 is text-only. The 8B, 70B, and 405B models released in July 2024 consume tokens, not pixels. Any pipeline that claims to...

Vector Search Indexing: HNSW vs. IVF-PQ in pgvector and Qdrant

Every vector index is a bet on a triangle: recall, latency, and memory. Flat scan sits at one corner — perfect recall, but at 1M 1536-d vectors (about 6 GB...

Tag hotwire

Tag turbo_streams

Tag memgpt

Memory-Augmented Agents: MemGPT and Semantic DB Storage Layer design

The naive fix for agents that forget is to buy a bigger context window. We ran that playbook and it is a trap: the failure mode of a long conversation...

Tag agents

Agent Orchestration: Comparing ReAct, Plan-and-Solve, and Reflection Patterns

Almost every agent starts as a naive while True: call_model, run_tool, call_model loop, and almost every production agent ends up as something else. The reason is that the three canonical...

LLM Agents in Production – What Changed in 2025

The model got smarter, but the reason agents work in production in 2025 is the harness around them. We run them in customer-support triage, internal ops, and incident summarization, and...

Agentic RAG: Knowledge Graph Indexing and Traversal with Neo4j

Vector RAG answered “what does the payment service do?” beautifully and went blind on “what did the author build for the payment service while reporting to project manager X?” The...

Memory-Augmented Agents: MemGPT and Semantic DB Storage Layer design

The naive fix for agents that forget is to buy a bigger context window. We ran that playbook and it is a trap: the failure mode of a long conversation...

Tag ruby

Ruby YJIT Memory Footprint: Optimization Strategies for Kubernetes Deployments

Since Rails 7.2 made YJIT the default JIT in August 2024, most Rails apps picked up a 15-25% throughput bump for free. The bill shows up on Kubernetes in a...

Rails 7.2 — Better eager loading with Zeitwerk

Rails 7.2 (August 2024) did not ship a magic filter that “skips patterns” during eager loading — that idea circulates in a lot of upgrade blog posts, but it is...

Pattern-matching refinements in Ruby 3.3

If you read the Ruby 3.3 changelog looking for “right-hand patterns”, stop. Pattern matching arrived in Ruby 2.7, and the => rightward assignment shipped in the same release; the syntax...

Tag pattern_matching

Pattern-matching refinements in Ruby 3.3

If you read the Ruby 3.3 changelog looking for “right-hand patterns”, stop. Pattern matching arrived in Ruby 2.7, and the => rightward assignment shipped in the same release; the syntax...

Tag ruby3

Unlocking Speed: Rails Performance Tuning with Ruby 3 YJIT

In Ruby 3.3, YJIT is production-ready. Shopify’s numbers, the Optcarrot benchmark, and the Rails core team all point the same direction: roughly 15–25% latency improvement on real Rails workloads, for...

Pattern-matching refinements in Ruby 3.3

If you read the Ruby 3.3 changelog looking for “right-hand patterns”, stop. Pattern matching arrived in Ruby 2.7, and the => rightward assignment shipped in the same release; the syntax...

Tag refinements

Pattern-matching refinements in Ruby 3.3

If you read the Ruby 3.3 changelog looking for “right-hand patterns”, stop. Pattern matching arrived in Ruby 2.7, and the => rightward assignment shipped in the same release; the syntax...

Tag elasticsearch

Tag sidekiq

Scaling Sidekiq: Advanced Job Deduplication and Multi-tenant Rate Limiting

Sidekiq’s contract is “push work, forget it,” but the moment you have an event bus that emits per-entity changes, you discover how literally Sidekiq honors that contract. Ten indexing jobs...

ActiveJob Scaling: Thread Pools, DB Pool Sizes, and PostgreSQL Contention

The incident is boring and predictable: someone bumps Sidekiq concurrency from 10 to 25, and within an hour pager duty is looking at ActiveRecord::ConnectionTimeoutError across every web and worker process....

Tag callbacks

Tag dpo

Direct Preference Optimization (DPO) vs. PPO: A Pragmatic Comparison

Classic RLHF is a four-model circus: a frozen reference policy, a trainable actor, a reward model, and a critic network, plus a KL term to keep the actor honest. It...

Tag rlhf

DeepSeek-R1 reasoning models: Reinforcement Learning without Supervised Fine-Tuning

The standard recipe for a “reasoning” model is crushing amounts of supervised data: millions of human-curated chain-of-thought traces, distilled from a bigger model, cleaned by contractors, and fine-tuned into the...

Direct Preference Optimization (DPO) vs. PPO: A Pragmatic Comparison

Classic RLHF is a four-model circus: a frozen reference policy, a trainable actor, a reward model, and a critic network, plus a KL term to keep the actor honest. It...

Tag alignment

Synthetic Data Generation pipelines for Enterprise Domain Adaptation

Fine-tuning a model for internal tooling usually means one thing is missing: the data. Our first attempt to adapt a model for internal ticket routing needed 10,000 labeled examples, and...

Direct Preference Optimization (DPO) vs. PPO: A Pragmatic Comparison

Classic RLHF is a four-model circus: a frozen reference policy, a trainable actor, a reward model, and a critic network, plus a KL term to keep the actor honest. It...

Tag dpo_vs_ppo

Direct Preference Optimization (DPO) vs. PPO: A Pragmatic Comparison

Classic RLHF is a four-model circus: a frozen reference policy, a trainable actor, a reward model, and a critic network, plus a KL term to keep the actor honest. It...

Tag idempotency

Implementing Idempotent API Endpoints in Rails using Redis Lock and Request Signatures

A client POSTs a payment, the connection drops mid-response, and the client retries. If your endpoint is not idempotent, the second request charges the card twice. At roughly 3M mutating...

Tag api

Implementing Idempotent API Endpoints in Rails using Redis Lock and Request Signatures

A client POSTs a payment, the connection drops mid-response, and the client retries. If your endpoint is not idempotent, the second request charges the card twice. At roughly 3M mutating...

Tag activejob

Debugging Solid Queue Deadlocks: Transaction Isolation Levels and Row Locks

Rails 8 shipped on November 7, 2024 with Solid Queue as the default background-job adapter — a Postgres-backed queue that fits the “one less database” story. We migrated a roughly...

ActiveJob Scaling: Thread Pools, DB Pool Sizes, and PostgreSQL Contention

The incident is boring and predictable: someone bumps Sidekiq concurrency from 10 to 25, and within an hour pager duty is looking at ActiveRecord::ConnectionTimeoutError across every web and worker process....

Tag eager_loading

Rails 7.2 — Better eager loading with Zeitwerk

Rails 7.2 (August 2024) did not ship a magic filter that “skips patterns” during eager loading — that idea circulates in a lot of upgrade blog posts, but it is...

ActiveRecord Eager Loading Pitfalls: Subqueries vs. IN Clauses

includes is the most convenient lie in ActiveRecord. You write one method call, and ActiveRecord decides for you whether to emit two queries joined by an IN clause (preload) or...

Tag sql

Enterprise Text-to-SQL: Building Self-Correcting Execution Loops

Text-to-SQL looks solved in demos and falls apart in production, always in the same four ways: the model invents column names the schema never had, it emits syntax that parses...

ActiveRecord Eager Loading Pitfalls: Subqueries vs. IN Clauses

includes is the most convenient lie in ActiveRecord. You write one method call, and ActiveRecord decides for you whether to emit two queries joined by an IN clause (preload) or...

Tag moe

Mixture-of-Experts (MoE) Architectures: Routing Math and Load Balancing

Dense scaling hits a hard wall: every parameter you add is a parameter you pay for on every token, in both VRAM and bandwidth. Mixture-of-Experts breaks that coupling by making...

Tag transformers

Deep Dive into LLM Context Window Mechanics: RoPE, YaRN, and FlashAttention

“128K context” sounds like a feature but it is two separate engineering problems stapled together, and they fail independently. The first is arithmetic: attention is O(n²) in time and memory,...

Mixture-of-Experts (MoE) Architectures: Routing Math and Load Balancing

Dense scaling hits a hard wall: every parameter you add is a parameter you pay for on every token, in both VRAM and bandwidth. Mixture-of-Experts breaks that coupling by making...

Tag mixtral

Mixture-of-Experts (MoE) Architectures: Routing Math and Load Balancing

Dense scaling hits a hard wall: every parameter you add is a parameter you pay for on every token, in both VRAM and bandwidth. Mixture-of-Experts breaks that coupling by making...

Tag routing

Designing a Low-Latency API Gateway Routing Tree in Go using Radix Trees

An API gateway sits in front of every upstream call, so its router is the hottest code path in the fleet. A linear scan over registered patterns is O(N) in...

Mixture-of-Experts (MoE) Architectures: Routing Math and Load Balancing

Dense scaling hits a hard wall: every parameter you add is a parameter you pay for on every token, in both VRAM and bandwidth. Mixture-of-Experts breaks that coupling by making...

Tag context

Context Propagation in Go: Building Distributed Tracing Middleware

We spent a week hunting a checkout outage the tracing dashboards could not explain. The gateway started a span, then the trace went dark: payment logged an empty trace ID,...

Tag tracing

Context Propagation in Go: Building Distributed Tracing Middleware

We spent a week hunting a checkout outage the tracing dashboards could not explain. The gateway started a span, then the trace went dark: payment logged an empty trace ID,...

Tag peft

Parameter-Efficient Fine-Tuning: Math and Mechanics of LoRA and QLoRA

Full-parameter fine-tuning of a 7B model needs about 112 GB of VRAM: fp16 weights (14 GB) plus gradients, fp32 Adam moments, and fp32 master weights add up to roughly 16...

Tag lora

Parameter-Efficient Fine-Tuning: Math and Mechanics of LoRA and QLoRA

Full-parameter fine-tuning of a 7B model needs about 112 GB of VRAM: fp16 weights (14 GB) plus gradients, fp32 Adam moments, and fp32 master weights add up to roughly 16...

Tag qlora

Parameter-Efficient Fine-Tuning: Math and Mechanics of LoRA and QLoRA

Full-parameter fine-tuning of a 7B model needs about 112 GB of VRAM: fp16 weights (14 GB) plus gradients, fp32 Adam moments, and fp32 master weights add up to roughly 16...

Tag finetuning

Fine-tuning Embedding Models for Domain-Specific Vector Space Alignment

Off-the-shelf embedders understand generic language and nothing else. BGE-small and OpenAI’s Ada-002 encode “what is the refund policy” beautifully; ask them about an internal part number like OCT-4472-REV3 or a...

Synthetic Data Generation pipelines for Enterprise Domain Adaptation

Fine-tuning a model for internal tooling usually means one thing is missing: the data. Our first attempt to adapt a model for internal ticket routing needed 10,000 labeled examples, and...

Parameter-Efficient Fine-Tuning: Math and Mechanics of LoRA and QLoRA

Full-parameter fine-tuning of a 7B model needs about 112 GB of VRAM: fp16 weights (14 GB) plus gradients, fp32 Adam moments, and fp32 master weights add up to roughly 16...

Tag yjit

Ruby YJIT Memory Footprint: Optimization Strategies for Kubernetes Deployments

Since Rails 7.2 made YJIT the default JIT in August 2024, most Rails apps picked up a 15-25% throughput bump for free. The bill shows up on Kubernetes in a...

Unlocking Speed: Rails Performance Tuning with Ruby 3 YJIT

In Ruby 3.3, YJIT is production-ready. Shopify’s numbers, the Optcarrot benchmark, and the Rails core team all point the same direction: roughly 15–25% latency improvement on real Rails workloads, for...

Tag llm

Fine-tuning vs Prompt-engineering – what to choose in 2025

The 2023 version of this question was about knowledge: “should we fine-tune so the model knows our domain?” That framing is dead in 2025. Current models — Claude Sonnet 4,...

LLM Agents in Production – What Changed in 2025

The model got smarter, but the reason agents work in production in 2025 is the harness around them. We run them in customer-support triage, internal ops, and incident summarization, and...

Deep Dive into LLM Context Window Mechanics: RoPE, YaRN, and FlashAttention

“128K context” sounds like a feature but it is two separate engineering problems stapled together, and they fail independently. The first is arithmetic: attention is O(n²) in time and memory,...

Tag attention

Deep Dive into LLM Context Window Mechanics: RoPE, YaRN, and FlashAttention

“128K context” sounds like a feature but it is two separate engineering problems stapled together, and they fail independently. The first is arithmetic: attention is O(n²) in time and memory,...

Tag rope

Deep Dive into LLM Context Window Mechanics: RoPE, YaRN, and FlashAttention

“128K context” sounds like a feature but it is two separate engineering problems stapled together, and they fail independently. The first is arithmetic: attention is O(n²) in time and memory,...

Tag kamal

Deploying Rails at Scale with Kamal, Docker, and Tailscale

The platform bill grows linearly with a problem you did not choose: a few years of real traffic later, the Heroku/Render invoices looked like a third engineering salary, and Kubernetes...

Tag docker

Deploying Rails at Scale with Kamal, Docker, and Tailscale

The platform bill grows linearly with a problem you did not choose: a few years of real traffic later, the Heroku/Render invoices looked like a third engineering salary, and Kubernetes...

Tag tailscale

Deploying Rails at Scale with Kamal, Docker, and Tailscale

The platform bill grows linearly with a problem you did not choose: a few years of real traffic later, the Heroku/Render invoices looked like a third engineering salary, and Kubernetes...

Tag deployment

Deploying Rails at Scale with Kamal, Docker, and Tailscale

The platform bill grows linearly with a problem you did not choose: a few years of real traffic later, the Heroku/Render invoices looked like a third engineering salary, and Kubernetes...

Tag clip

Multi-modal Retrieval: CLIP vs. SigLIP for Visual Semantic Search

Catalog search lives and dies on the visual queries text search never sees: “floral dress, but not the one with the collar”, “refrigerator that fits under a 32-inch counter”, “product...

Tag siglip

Multi-modal Retrieval: CLIP vs. SigLIP for Visual Semantic Search

Catalog search lives and dies on the visual queries text search never sees: “floral dress, but not the one with the collar”, “refrigerator that fits under a 32-inch counter”, “product...

Tag multimodal

Building Multi-modal RAG Pipelines with Llama 3.1 and Qdrant

Let me correct the framing up front: Llama 3.1 is text-only. The 8B, 70B, and 405B models released in July 2024 consume tokens, not pixels. Any pipeline that claims to...

Multi-modal Retrieval: CLIP vs. SigLIP for Visual Semantic Search

Catalog search lives and dies on the visual queries text search never sees: “floral dress, but not the one with the collar”, “refrigerator that fits under a 32-inch counter”, “product...

Tag embeddings

Fine-tuning Embedding Models for Domain-Specific Vector Space Alignment

Off-the-shelf embedders understand generic language and nothing else. BGE-small and OpenAI’s Ada-002 encode “what is the refund policy” beautifully; ask them about an internal part number like OCT-4472-REV3 or a...

Multi-modal Retrieval: CLIP vs. SigLIP for Visual Semantic Search

Catalog search lives and dies on the visual queries text search never sees: “floral dress, but not the one with the collar”, “refrigerator that fits under a 32-inch counter”, “product...

Tag synthetic_data

Synthetic Data Generation pipelines for Enterprise Domain Adaptation

Fine-tuning a model for internal tooling usually means one thing is missing: the data. Our first attempt to adapt a model for internal ticket routing needed 10,000 labeled examples, and...

Tag data_engineering

Synthetic Data Generation pipelines for Enterprise Domain Adaptation

Fine-tuning a model for internal tooling usually means one thing is missing: the data. Our first attempt to adapt a model for internal ticket routing needed 10,000 labeled examples, and...

Tag ebpf

eBPF-Based Telemetry for LLM Inference Endpoints: Profiling CPU/GPU Latencies

If you serve LLM inference at any real scale, your standard monitoring stack has a blind spot exactly where your tokens actually spend time: the kernel. Prometheus exporters and Datadog...

Writing eBPF Programs in C and Loading Them with Go: System Telemetry at Scale

Our Redis client was pushing a sustained 8% CPU on every API node, and pprof could not tell us why. The CPU profile blamed runtime.futex, which is not an answer;...

Tag rails-7

Rails 7.2 — Better eager loading with Zeitwerk

Rails 7.2 (August 2024) did not ship a magic filter that “skips patterns” during eager loading — that idea circulates in a lot of upgrade blog posts, but it is...

Tag zeitwerk

Rails 7.2 — Better eager loading with Zeitwerk

Rails 7.2 (August 2024) did not ship a magic filter that “skips patterns” during eager loading — that idea circulates in a lot of upgrade blog posts, but it is...

Tag dspy

Moving Beyond LangChain: Why DSPy is the Future of Declarative AI Pipelines

We rewrote a production pipeline from LangChain to DSPy last spring, and the reason was not a benchmark — it was a two-day incident. A security team bumped our model...

Tag langchain

Moving Beyond LangChain: Why DSPy is the Future of Declarative AI Pipelines

We rewrote a production pipeline from LangChain to DSPy last spring, and the reason was not a benchmark — it was a two-day incident. A security team bumped our model...

Tag programming_paradigms

Moving Beyond LangChain: Why DSPy is the Future of Declarative AI Pipelines

We rewrote a production pipeline from LangChain to DSPy last spring, and the reason was not a benchmark — it was a two-day incident. A security team bumped our model...

Tag evals

Designing an LLM Evaluation Harness: Judge-LLM Alignment and Benchmarks

BLEU and ROUGE did not catch a single regression for us. The rewrite that scored +3 ROUGE against the old transcripts was, by any human reading, worse — it hedged,...

Tag metrics

Designing an LLM Evaluation Harness: Judge-LLM Alignment and Benchmarks

BLEU and ROUGE did not catch a single regression for us. The rewrite that scored +3 ROUGE against the old transcripts was, by any human reading, worse — it hedged,...

Tag llm_judge

Designing an LLM Evaluation Harness: Judge-LLM Alignment and Benchmarks

BLEU and ROUGE did not catch a single regression for us. The rewrite that scored +3 ROUGE against the old transcripts was, by any human reading, worse — it hedged,...

Tag kubernetes

Ruby YJIT Memory Footprint: Optimization Strategies for Kubernetes Deployments

Since Rails 7.2 made YJIT the default JIT in August 2024, most Rails apps picked up a 15-25% throughput bump for free. The bill shows up on Kubernetes in a...

Tag graph_db

Agentic RAG: Knowledge Graph Indexing and Traversal with Neo4j

Vector RAG answered “what does the payment service do?” beautifully and went blind on “what did the author build for the payment service while reporting to project manager X?” The...

Tag neo4j

Agentic RAG: Knowledge Graph Indexing and Traversal with Neo4j

Vector RAG answered “what does the payment service do?” beautifully and went blind on “what did the author build for the payment service while reporting to project manager X?” The...

Tag gpt4o

State Machine Validation for GPT-4o Function Calling Applications

GPT-4o function calling still managed to call charge_payment before create_transaction produced an ID. The model emitted both calls in one turn — valid tool calls, invalid order — and the...

Tag function_calling

State Machine Validation for GPT-4o Function Calling Applications

GPT-4o function calling still managed to call charge_payment before create_transaction produced an ID. The model emitted both calls in one turn — valid tool calls, invalid order — and the...

Tag state_machine

State Machine Validation for GPT-4o Function Calling Applications

GPT-4o function calling still managed to call charge_payment before create_transaction produced an ID. The model emitted both calls in one turn — valid tool calls, invalid order — and the...

Tag verification

State Machine Validation for GPT-4o Function Calling Applications

GPT-4o function calling still managed to call charge_payment before create_transaction produced an ID. The model emitted both calls in one turn — valid tool calls, invalid order — and the...

Tag solid_queue

The Rails 8 Solid Suite: Moving to a Zero-Dependency Stack

Rails 8 (November 2024) did something bold: it made the database the default home for everything that used to need Redis. Solid Queue for background jobs, Solid Cache for the...

Debugging Solid Queue Deadlocks: Transaction Isolation Levels and Row Locks

Rails 8 shipped on November 7, 2024 with Solid Queue as the default background-job adapter — a Postgres-backed queue that fits the “one less database” story. We migrated a roughly...

Tag deadlocks

Debugging Solid Queue Deadlocks: Transaction Isolation Levels and Row Locks

Rails 8 shipped on November 7, 2024 with Solid Queue as the default background-job adapter — a Postgres-backed queue that fits the “one less database” story. We migrated a roughly...

Tag self_hosting

Self-hosting Llama 3 70B: Inference Optimization with vLLM and Triton

A client in EU pharma needs inference that never leaves the data center: weights, prompts, and outputs all stay on-prem, and the model has to be legally auditable. Llama 3...

Tag llama3

Self-hosting Llama 3 70B: Inference Optimization with vLLM and Triton

A client in EU pharma needs inference that never leaves the data center: weights, prompts, and outputs all stay on-prem, and the model has to be legally auditable. Llama 3...

Tag vllm

Speculative Decoding: Accelerating LLM Inference in Production

Decode is memory-bandwidth-bound, and that single fact is why speculative decoding is the cheapest throughput win an inference team can spend a week on. Every autoregressive step loads the entire...

eBPF-Based Telemetry for LLM Inference Endpoints: Profiling CPU/GPU Latencies

If you serve LLM inference at any real scale, your standard monitoring stack has a blind spot exactly where your tokens actually spend time: the kernel. Prometheus exporters and Datadog...

KV-Cache Eviction and PagedAttention in High-Throughput LLM Serving

The first time we load-tested vLLM for a multi-tenant embedding-and-completion service, we watched nvidia-smi and assumed something was leaking. Four Mistral-7B instances on two A100s, steady 512-token requests, and the...

Self-hosting Llama 3 70B: Inference Optimization with vLLM and Triton

A client in EU pharma needs inference that never leaves the data center: weights, prompts, and outputs all stay on-prem, and the model has to be legally auditable. Llama 3...

Tag triton

Self-hosting Llama 3 70B: Inference Optimization with vLLM and Triton

A client in EU pharma needs inference that never leaves the data center: weights, prompts, and outputs all stay on-prem, and the model has to be legally auditable. Llama 3...

Tag inference

Speculative Decoding: Accelerating LLM Inference in Production

Decode is memory-bandwidth-bound, and that single fact is why speculative decoding is the cheapest throughput win an inference team can spend a week on. Every autoregressive step loads the entire...

KV-Cache Eviction and PagedAttention in High-Throughput LLM Serving

The first time we load-tested vLLM for a multi-tenant embedding-and-completion service, we watched nvidia-smi and assumed something was leaking. Four Mistral-7B instances on two A100s, steady 512-token requests, and the...

Tag kv_cache

KV-Cache Eviction and PagedAttention in High-Throughput LLM Serving

The first time we load-tested vLLM for a multi-tenant embedding-and-completion service, we watched nvidia-smi and assumed something was leaking. Four Mistral-7B instances on two A100s, steady 512-token requests, and the...

Tag paged_attention

KV-Cache Eviction and PagedAttention in High-Throughput LLM Serving

The first time we load-tested vLLM for a multi-tenant embedding-and-completion service, we watched nvidia-smi and assumed something was leaking. Four Mistral-7B instances on two A100s, steady 512-token requests, and the...

Tag llama_guard

Implementing Llama Guard: Multi-stage Safety Filtering for LLM Gateways

We run a customer-facing LLM gateway in front of a hosted model, and the threat model is unglamorous but real: prompt injection trying to exfiltrate another tenant’s data, jailbreaks attempting...

Tag safety

Implementing Llama Guard: Multi-stage Safety Filtering for LLM Gateways

We run a customer-facing LLM gateway in front of a hosted model, and the threat model is unglamorous but real: prompt injection trying to exfiltrate another tenant’s data, jailbreaks attempting...

Tag guardrails

Implementing Llama Guard: Multi-stage Safety Filtering for LLM Gateways

We run a customer-facing LLM gateway in front of a hosted model, and the threat model is unglamorous but real: prompt injection trying to exfiltrate another tenant’s data, jailbreaks attempting...

Tag slog

Structured Logging Performance: Custom zap and slog Configurations in Go

Logging is the last thing anyone profiles and the first thing that sinks a latency budget. A service doing 10k req/s with two or three log lines per request is...

Tag zap

Structured Logging Performance: Custom zap and slog Configurations in Go

Logging is the last thing anyone profiles and the first thing that sinks a latency budget. A service doing 10k req/s with two or three log lines per request is...

Tag logging

Structured Logging Performance: Custom zap and slog Configurations in Go

Logging is the last thing anyone profiles and the first thing that sinks a latency budget. A service doing 10k req/s with two or three log lines per request is...

Tag distillation

Practical Guide to Model Distillation: From DeepSeek-R1 to edge-ready SLMs

When DeepSeek-R1 landed in January 2025, it proved that chain-of-thought plus reinforcement learning could push open models to near-frontier reasoning on math and code. It also proved something less convenient:...

Tag deepseek

DeepSeek-R1 reasoning models: Reinforcement Learning without Supervised Fine-Tuning

The standard recipe for a “reasoning” model is crushing amounts of supervised data: millions of human-curated chain-of-thought traces, distilled from a bigger model, cleaned by contractors, and fine-tuned into the...

Practical Guide to Model Distillation: From DeepSeek-R1 to edge-ready SLMs

When DeepSeek-R1 landed in January 2025, it proved that chain-of-thought plus reinforcement learning could push open models to near-frontier reasoning on math and code. It also proved something less convenient:...

Tag slm

Practical Guide to Model Distillation: From DeepSeek-R1 to edge-ready SLMs

When DeepSeek-R1 landed in January 2025, it proved that chain-of-thought plus reinforcement learning could push open models to near-frontier reasoning on math and code. It also proved something less convenient:...

Tag gomemlimit

Go Garbage Collector Tuning: GOGC and GOMEMLIMIT Deep Dive

A 2GB Kubernetes pod running a Go service with default GOGC=100 has a GC that will happily let the heap double before it starts collecting. That is by design: the...

Tag rails7_2

Rails Solid Cache: Dropping Redis for Database-Backed Caching

The Redis cache bill is a weird tax. You’re paying premium RAM prices for data that is, by definition, disposable — regenerate it and nothing breaks. When our cache footprint...

Custom Database Adapters and Connection Pools in Rails 7.2

We run a 12-server Puma fleet against a Postgres primary and two read replicas. For a long time our read/write splitting was manual: a sidecar script rewrote database.yml on deploy...

Tag connection_pool

Custom Database Adapters and Connection Pools in Rails 7.2

We run a 12-server Puma fleet against a Postgres primary and two read replicas. For a long time our read/write splitting was manual: a sidecar script rewrote database.yml on deploy...

Tag sentence_transformers

Fine-tuning Embedding Models for Domain-Specific Vector Space Alignment

Off-the-shelf embedders understand generic language and nothing else. BGE-small and OpenAI’s Ada-002 encode “what is the refund policy” beautifully; ask them about an internal part number like OCT-4472-REV3 or a...

Tag api_gateway

Designing a Low-Latency API Gateway Routing Tree in Go using Radix Trees

An API gateway sits in front of every upstream call, so its router is the hottest code path in the fleet. A linear scan over registered patterns is O(N) in...

Tag radix_tree

Designing a Low-Latency API Gateway Routing Tree in Go using Radix Trees

An API gateway sits in front of every upstream call, so its router is the hottest code path in the fleet. A linear scan over registered patterns is O(N) in...

Tag propshaft

Propshaft Asset Pipeline: A Modern, Light Replacement for Sprockets

Sprockets was designed for the Rails era where the framework compiled CoffeeScript, SCSS, and ERB-templated JavaScript on the fly. That era is over. Modern browsers ship ES modules and CSS...

Tag sprockets

Propshaft Asset Pipeline: A Modern, Light Replacement for Sprockets

Sprockets was designed for the Rails era where the framework compiled CoffeeScript, SCSS, and ERB-templated JavaScript on the fly. That era is over. Modern browsers ship ES modules and CSS...

Tag rails7

Propshaft Asset Pipeline: A Modern, Light Replacement for Sprockets

Sprockets was designed for the Rails era where the framework compiled CoffeeScript, SCSS, and ERB-templated JavaScript on the fly. That era is over. Modern browsers ship ES modules and CSS...

Tag assets

Propshaft Asset Pipeline: A Modern, Light Replacement for Sprockets

Sprockets was designed for the Rails era where the framework compiled CoffeeScript, SCSS, and ERB-templated JavaScript on the fly. That era is over. Modern browsers ship ES modules and CSS...

Tag llama3_1

Building Multi-modal RAG Pipelines with Llama 3.1 and Qdrant

Let me correct the framing up front: Llama 3.1 is text-only. The 8B, 70B, and 405B models released in July 2024 consume tokens, not pixels. Any pipeline that claims to...

Tag escape_analysis

Go Compiler Internals: Escape Analysis, Function Inlining, and devirtualization

The difference between a handler that does 40 allocations per request and one that does four is usually not your data structures. It is whether the compiler managed to keep...

Tag inlining

Go Compiler Internals: Escape Analysis, Function Inlining, and devirtualization

The difference between a handler that does 40 allocations per request and one that does four is usually not your data structures. It is whether the compiler managed to keep...

Tag solid_cache

The Rails 8 Solid Suite: Moving to a Zero-Dependency Stack

Rails 8 (November 2024) did something bold: it made the database the default home for everything that used to need Redis. Solid Queue for background jobs, Solid Cache for the...

Rails Solid Cache: Dropping Redis for Database-Backed Caching

The Redis cache bill is a weird tax. You’re paying premium RAM prices for data that is, by definition, disposable — regenerate it and nothing breaks. When our cache footprint...

Tag caching

Rails Solid Cache: Dropping Redis for Database-Backed Caching

The Redis cache bill is a weird tax. You’re paying premium RAM prices for data that is, by definition, disposable — regenerate it and nothing breaks. When our cache footprint...

Tag ai

Fine-tuning vs Prompt-engineering – what to choose in 2025

The 2023 version of this question was about knowledge: “should we fine-tune so the model knows our domain?” That framing is dead in 2025. Current models — Claude Sonnet 4,...

LLM Agents in Production – What Changed in 2025

The model got smarter, but the reason agents work in production in 2025 is the harness around them. We run them in customer-support triage, internal ops, and incident summarization, and...

Tag production

LLM Agents in Production – What Changed in 2025

The model got smarter, but the reason agents work in production in 2025 is the harness around them. We run them in customer-support triage, internal ops, and incident summarization, and...

Tag monitoring

eBPF-Based Telemetry for LLM Inference Endpoints: Profiling CPU/GPU Latencies

If you serve LLM inference at any real scale, your standard monitoring stack has a blind spot exactly where your tokens actually spend time: the kernel. Prometheus exporters and Datadog...

Tag json

High-Performance JSON Serialization: Benchmarking Oj, Blueprinter, and Fast JSON API

The last place I look when an API endpoint is slow is the serializer, and that’s a mistake. On a typical list endpoint the serializer is where most of the...

Guaranteed JSON Formats: Grammars and Regex-Constrained LLM Decoding

Prompting a model to “return valid JSON” fails at a rate that is invisible until it isn’t: at low volume a 2% malformed-output rate is a retry. At 5M calls/day,...

Building a High-Performance JSON Parser using Go Code Generation

Every few months someone on the team proposes “we should just use a faster JSON library” and benchmarks encoding/json against a dropped-in replacement, sees a 2x, and ships it. That’s...

Tag code_generation

Building a High-Performance JSON Parser using Go Code Generation

Every few months someone on the team proposes “we should just use a faster JSON library” and benchmarks encoding/json against a dropped-in replacement, sees a 2x, and ships it. That’s...

Tag easyjson

Building a High-Performance JSON Parser using Go Code Generation

Every few months someone on the team proposes “we should just use a faster JSON library” and benchmarks encoding/json against a dropped-in replacement, sees a 2x, and ships it. That’s...

Tag rails8

The Rails 8 Solid Suite: Moving to a Zero-Dependency Stack

Rails 8 (November 2024) did something bold: it made the database the default home for everything that used to need Redis. Solid Queue for background jobs, Solid Cache for the...

Rails Solid Cable: Redis-free WebSockets at Scale

ActionCable’s Redis dependency always annoyed me, and not for the reasons people usually cite. The latency argument against database pub/sub is mostly wrong at small scale — the real cost...

Tag solid_cable

The Rails 8 Solid Suite: Moving to a Zero-Dependency Stack

Rails 8 (November 2024) did something bold: it made the database the default home for everything that used to need Redis. Solid Queue for background jobs, Solid Cache for the...

Rails Solid Cable: Redis-free WebSockets at Scale

ActionCable’s Redis dependency always annoyed me, and not for the reasons people usually cite. The latency argument against database pub/sub is mostly wrong at small scale — the real cost...

Tag mutex

Go Concurrency Patterns: Channels vs. Mutexes in High-Performance Applications

The advice “share memory by communicating” has done more damage than good. It was written for clarity, not throughput, and teams have shipped channel-based counters and caches that run 5-10x...

Tag fine_tuning

Fine-tuning vs Prompt-engineering – what to choose in 2025

The 2023 version of this question was about knowledge: “should we fine-tune so the model knows our domain?” That framing is dead in 2025. Current models — Claude Sonnet 4,...

Tag prompt_engineering

Fine-tuning vs Prompt-engineering – what to choose in 2025

The 2023 version of this question was about knowledge: “should we fine-tune so the model knows our domain?” That framing is dead in 2025. Current models — Claude Sonnet 4,...

Tag goroutines

Detecting and Debugging Goroutine Leaks in Production Go Applications

A goroutine leak is the sneakiest way to lose memory in Go, because the memory is not garbage: it is a live stack, referenced by a blocked goroutine, unreachable to...

Tag memory_leaks

Detecting and Debugging Goroutine Leaks in Production Go Applications

A goroutine leak is the sneakiest way to lose memory in Go, because the memory is not garbage: it is a live stack, referenced by a blocked goroutine, unreachable to...

Tag debugging

Detecting and Debugging Goroutine Leaks in Production Go Applications

A goroutine leak is the sneakiest way to lose memory in Go, because the memory is not garbage: it is a live stack, referenced by a blocked goroutine, unreachable to...

Tag generics

Go Generics under the Hood: Performance Costs and Monomorphization

When Go 1.18 shipped generics, the design had to thread a needle: be fast like C++ templates without their binary bloat, and be ergonomic without Java’s boxing tax. The answer...

Tag monomorphization

Go Generics under the Hood: Performance Costs and Monomorphization

When Go 1.18 shipped generics, the design had to thread a needle: be fast like C++ templates without their binary bloat, and be ergonomic without Java’s boxing tax. The answer...

Tag r1

DeepSeek-R1 reasoning models: Reinforcement Learning without Supervised Fine-Tuning

The standard recipe for a “reasoning” model is crushing amounts of supervised data: millions of human-curated chain-of-thought traces, distilled from a bigger model, cleaned by contractors, and fine-tuned into the...

Tag reasoning

DeepSeek-R1 reasoning models: Reinforcement Learning without Supervised Fine-Tuning

The standard recipe for a “reasoning” model is crushing amounts of supervised data: millions of human-curated chain-of-thought traces, distilled from a bigger model, cleaned by contractors, and fine-tuned into the...

Tag scheduler

Go Scheduler Deep Dive: Work-Stealing, Preemption, and OS Thread Matching

Go’s concurrency story rests on one runtime component most engineers never look at: the scheduler. If you have ever seen a service with 300,000 goroutines and 12 cores stay responsive,...

Tag runtime

Go Scheduler Deep Dive: Work-Stealing, Preemption, and OS Thread Matching

Go’s concurrency story rests on one runtime component most engineers never look at: the scheduler. If you have ever seen a service with 300,000 goroutines and 12 cores stay responsive,...

Tag prompt_caching

Prompt Caching Strategies to Reduce LLM Latency and API Costs

Every RAG or agent application I’ve reviewed re-sends the same few thousand tokens on every request: the system prompt, tool schemas, a hundred pages of policy docs, the conversation so...

Tag latency

Prompt Caching Strategies to Reduce LLM Latency and API Costs

Every RAG or agent application I’ve reviewed re-sends the same few thousand tokens on every request: the system prompt, tool schemas, a hundred pages of policy docs, the conversation so...

Tag anthropic

Prompt Caching Strategies to Reduce LLM Latency and API Costs

Every RAG or agent application I’ve reviewed re-sends the same few thousand tokens on every request: the system prompt, tool schemas, a hundred pages of policy docs, the conversation so...

Tag gemini

Prompt Caching Strategies to Reduce LLM Latency and API Costs

Every RAG or agent application I’ve reviewed re-sends the same few thousand tokens on every request: the system prompt, tool schemas, a hundred pages of policy docs, the conversation so...

Tag decoding

Guaranteed JSON Formats: Grammars and Regex-Constrained LLM Decoding

Prompting a model to “return valid JSON” fails at a rate that is invisible until it isn’t: at low volume a 2% malformed-output rate is a retry. At 5M calls/day,...

Tag grammars

Guaranteed JSON Formats: Grammars and Regex-Constrained LLM Decoding

Prompting a model to “return valid JSON” fails at a rate that is invisible until it isn’t: at low volume a 2% malformed-output rate is a retry. At 5M calls/day,...

Tag outlines

Guaranteed JSON Formats: Grammars and Regex-Constrained LLM Decoding

Prompting a model to “return valid JSON” fails at a rate that is invisible until it isn’t: at low volume a 2% malformed-output rate is a retry. At 5M calls/day,...

Tag serialization

Serialization Benchmarks: Go JSON vs. Protobuf vs. FlatBuffers

Why serialization keeps topping your pprof

High-Performance JSON Serialization: Benchmarking Oj, Blueprinter, and Fast JSON API

The last place I look when an API endpoint is slow is the serializer, and that’s a mistake. On a typical list endpoint the serializer is where most of the...

Tag oj

High-Performance JSON Serialization: Benchmarking Oj, Blueprinter, and Fast JSON API

The last place I look when an API endpoint is slow is the serializer, and that’s a mistake. On a typical list endpoint the serializer is where most of the...

Tag text_to_sql

Enterprise Text-to-SQL: Building Self-Correcting Execution Loops

Text-to-SQL looks solved in demos and falls apart in production, always in the same four ways: the model invents column names the schema never had, it emits syntax that parses...

Tag agent

Enterprise Text-to-SQL: Building Self-Correcting Execution Loops

Text-to-SQL looks solved in demos and falls apart in production, always in the same four ways: the model invents column names the schema never had, it emits syntax that parses...

Tag protobuf

Serialization Benchmarks: Go JSON vs. Protobuf vs. FlatBuffers

Why serialization keeps topping your pprof

Tag flatbuffers

Serialization Benchmarks: Go JSON vs. Protobuf vs. FlatBuffers

Why serialization keeps topping your pprof

Tag react

Agent Orchestration: Comparing ReAct, Plan-and-Solve, and Reflection Patterns

Almost every agent starts as a naive while True: call_model, run_tool, call_model loop, and almost every production agent ends up as something else. The reason is that the three canonical...

Tag planning

Agent Orchestration: Comparing ReAct, Plan-and-Solve, and Reflection Patterns

Almost every agent starts as a naive while True: call_model, run_tool, call_model loop, and almost every production agent ends up as something else. The reason is that the three canonical...

Tag reflection

Agent Orchestration: Comparing ReAct, Plan-and-Solve, and Reflection Patterns

Almost every agent starts as a naive while True: call_model, run_tool, call_model loop, and almost every production agent ends up as something else. The reason is that the three canonical...

Tag speculative_decoding

Speculative Decoding: Accelerating LLM Inference in Production

Decode is memory-bandwidth-bound, and that single fact is why speculative decoding is the cheapest throughput win an inference team can spend a week on. Every autoregressive step loads the entire...

Tag actioncontroller_live

Real-Time Event Streaming in Rails using ActionController::Live and Server-Sent Events (SSE)

“Real-time dashboard” is the feature that silently becomes an architecture decision. The naive version polls a JSON endpoint every second: one client is nothing, but 500 dashboards at 1 req/s...

Tag sse

Real-Time Event Streaming in Rails using ActionController::Live and Server-Sent Events (SSE)

“Real-time dashboard” is the feature that silently becomes an architecture decision. The naive version polls a JSON endpoint every second: one client is nothing, but 500 dashboards at 1 req/s...

Tag streaming

Real-Time Event Streaming in Rails using ActionController::Live and Server-Sent Events (SSE)

“Real-time dashboard” is the feature that silently becomes an architecture decision. The naive version polls a JSON endpoint every second: one client is nothing, but 500 dashboards at 1 req/s...