**3/3**
The hardest part wasn't the mechanisms.
It was learning not to trust my own benchmark. Three separate times it measured something other than what I thought — overlapping batches, serialised releases, a race that resolved in 5ms.
Every set of numbers looked reasonable.
**1/3**
Built the same booking endpoint 3 ways — unique constraint, row lock, compare-and-swap.
30,000 concurrent requests. Seat pool shrunk from 10,000 down to 10.
All three probably correct. But there is no single winner.
**2/3**
Row lock wins when demand is spread. Concentrate it and it drops to second worst — every loser queues on the same row.
CAS wins as contention tightens. Its losers read once and leave.
The constraint never wins. Every loser fires a real INSERT that Postgres rolls back.
7/
Building this in Go now (MIT 6.5840) — designing every piece in plain English before writing code, getting quizzed until I can defend it.
The hard part isn't the code. It's explaining why it's correct. 🏔️
1/
Today I learned what the Raft consensus algorithm is actually trying to fix.
Paxos solved distributed consensus but was famously hard to understand and implement. Raft does the same job with one goal baked in: be something an engineer can actually reason about.
6/
But election is just the setup. The leader's real job:
command in → written to the log in order → replicated → majority stores it = committed → everyone applies it → all copies identical.
That replicated log is consensus. The election just picks who runs it.
@aiseykaiseyyy Sorry to fuck up your 2 years with my shit. You deserve to be better I don’t wanna hold you back i love you i miss you i would love everything back but i don’t wanna hold you back. You have goals and you deserve much better. Last message for real from my side❤️
Best lesson wasn't the code. Every test passed and I went digging. Found the coordinator handing the same reduce task to two workers. it worked: deterministic reduce + atomic rename make duplicate work safe. Real systems don't prevent redundant work; they make it harmless.
1/ Finished MIT 6.5840 Lab 1: MapReduce in Go, built from scratch — a coordinator handing tasks to workers that can crash at any moment, and the job still completes correctly. 🧵
2/ The neat part: workers never talk to each other. Intermediate files are named mr-X-Y (map task X, reduce bucket Y). That filename is the coordination — reduce reconstructs exactly which files it needs from the formula. No central registry.
3/The task data comes back by reference, the coordinator writes into the reply struct you passed as a pointer.
So getTask() returns that filled reply, and the worker switches on TaskType to decide what to do next.
Small mechanic, but it's the whole shape of distributed RPC.
1/Building MapReduce from scratch for MIT 6.5840 — no framework, just Go.
Today I wired the worker ↔ coordinator over RPC.
The worker doesn't call the coordinator's functions directly. It can't — they live in another process. So it goes through a thin wrapper.
2/That wrapper is getTask(). It bridges worker and coordinator: builds the args + reply structs and calls Coordinator.GetTask over RPC.
The bit that clicked: the reply isn't the return value. call() only hands back an ok bool — "did the round-trip work."
2/2
Tomorrow: implementing task assignment and scheduling.
Trying to understand every line instead of racing to a working solution. The pace is slower, but the concepts stick much better.
1/2
Day 3 of MIT 6.5840.
Built the MapReduce Coordinator skeleton from scratch:
• task state tracking
• mutex synchronization
• coordinator lifecycle
• RPC interfaces (GetTaskArgs/Reply)
• task type enums