Logo
Logo
16 results for
  • For years, tuning Go’s GC meant tweaking GOGC and hoping for the best. I operated on vibes and guesswork. Then Go 1.19 introduced GOMEMLIMIT — a hard memory limit that fundamentally changed how I reason about GC tuning. Suddenly I had a second axis of control that actually matched how production memory is constrained. This lesson is the mental model I wish I had from day one.

    The Problem

    Go uses a concurrent, tri-color mark-and-sweep garbage collector. “Concurrent” means most of the GC work happens while your program is running, not in stop-the-world pauses. This is generally excellent, but the GC needs to be triggered somehow, and the default trigger can be surprising.

    Go tutorial golang internals Created Fri, 15 Nov 2024 00:00:00 +0000
  • Twitter is the classic system design problem for good reason. It looks like a glorified blog until you start pulling on the threads: how does a tweet from a user with 100 million followers appear in every follower’s timeline within seconds? How do you rank timelines without reading millions of tweets per request? How do you identify trending topics across 500 million users in near real-time? Each of these is a genuinely hard problem, and they interact in non-obvious ways.

    fundamentals system design interviews Created Thu, 14 Nov 2024 00:00:00 +0000
  • The nastiest production bug I ever tracked down involved a Java ConcurrentHashMap that was “thread-safe” in the API sense but not in the logic sense. Two threads would read a key, both see it’s absent, both insert with computed values, and one would silently overwrite the other. The map itself was fine — the access pattern was broken.

    Rust’s Mutex won’t save you from logic bugs either. But it will absolutely prevent you from forgetting the lock in the first place.

    Rust tutorial rust concurrency Created Wed, 13 Nov 2024 16:55:00 +0000
  • One of the things that surprised me most about Go when I came from Python was that Go has no inheritance. No base classes, no method overriding, no type hierarchies. What it has instead is embedding — the ability to include one type inside another so that the outer type promotes the inner type’s methods. Combined with interface composition, this gives you something more flexible than inheritance: you can build complex behaviors from simple, testable pieces without the fragility that comes from deep class trees.

    Go tutorial golang interfaces Created Tue, 12 Nov 2024 00:00:00 +0000
  • The first concurrent system I built that actually worked well was a log aggregation pipeline. Multiple producers writing log lines, one consumer batching and flushing to disk. No shared state, no locks, no races. Just messages flowing through a pipe.

    That experience sold me on message passing. And Rust’s channel implementation makes it surprisingly ergonomic.

    The Problem: Shared State Is Hard

    You can share state between threads with mutexes. But every shared mutable variable is a coordination point, a potential bottleneck, and a source of bugs. The more threads touching the same data, the harder the code is to reason about.

    Rust tutorial rust concurrency Created Mon, 11 Nov 2024 09:10:00 +0000
  • I spent a week optimizing a Postgres query that powered a leaderboard. It involved a complex window function over millions of rows, and no amount of indexing got it under 200ms. Then a senior engineer walked over, looked at the query, and said “Why isn’t this in Redis?” He was right. I replaced 30 lines of SQL with a sorted set and the response time dropped to 2ms.

    Not every data problem is a SQL problem. Sometimes you need the right tool, not a better query plan.

    Rust tutorial rust database postgres Created Sun, 10 Nov 2024 15:37:00 +0000
  • Writing a Go benchmark feels simple. You drop Benchmark in front of a function name, loop from 0 to b.N, run go test -bench=., and get a number. The number feels authoritative. I spent about a year trusting benchmark numbers that were wrong — not wrong because of bugs, but wrong because of how the benchmark was written. The Go benchmark framework is excellent, but it has sharp edges that will mislead you until you learn to see them.

    Go tutorial golang performance Created Sun, 10 Nov 2024 00:00:00 +0000
  • When I first started writing threaded Rust code, I hit the same compiler error about forty times in one afternoon. Something about closures borrowing values that might be dropped. I kept slapping move on closures until things compiled, without really understanding what was happening.

    That’s a terrible way to learn. So here’s the actual explanation I wish I’d had.

    The Problem: Closures and Thread Lifetimes

    When you pass a closure to thread::spawn, the new thread might run for an arbitrary amount of time. It could outlive the function that spawned it. It could outlive the variables it references.

    Rust tutorial rust concurrency Created Sat, 09 Nov 2024 14:20:00 +0000
  • Almost every interview starts the same way: “So, tell me about yourself.” And almost every engineer I’ve talked to hates this question. Not because they don’t know themselves, but because it feels formless. You could say anything. You could say everything. What are they actually asking?

    What they’re asking is: give me a thesis statement for why you’re sitting in this chair. Not a resume recitation. Not a biography. A thread that connects where you’ve been to why this job is the logical next step. That thread is your career narrative.

    fundamentals interviews career Created Sat, 09 Nov 2024 00:00:00 +0000
  • When I first started structuring larger Go projects, I defaulted to what felt natural: one repository, one go.mod. It worked for a long time. Then I joined a project with four services in a single repo, each with different dependency requirements, and suddenly the single go.mod was pulling in every dependency of every service for every build. Tests for the email service were slow because the go test run was loading the ML inference library needed only by the recommendation service. That was when I started thinking seriously about module boundaries, not just package boundaries.

    Go tutorial golang architecture Created Fri, 08 Nov 2024 00:00:00 +0000