Skip to main content
CRUCIBLE
DEEP SYSTEMS COMPONENT MASTERY · PACKETS · STORAGE · CONSENSUS · GPU SILICON

Systems Internals Physics Labs

Stop memorizing buzzwords. Manipulate real TCP BBR/CUBIC loss, eBPF XDP maps, Linux cgroups v2, PostgreSQL 8KB MVCC heap pages, Kafka ISR durability, Raft fencing tokens, and H100 vLLM GQA KV-cache math — then launch straight into live Firecracker KVM chaos.

FEYNMAN MENTAL MODEL · SIM-01PRODUCTION FAULT · 0/5 GATES
Fight Live tc-netem Loss in Firecracker KVM
Think of the internet + kernel like a toll highway with a strict budget inspector.

TCP CUBIC slams on the brakes by 30% every time a single truck drops a box (packet loss), even if the highway is empty. BBR measures the actual road width and travel time instead. Meanwhile, iptables checks every car against a paper clipboard one rule at a time O(N), while eBPF XDP rejects bad plates right at the entrance gate before the kernel even builds a socket buffer. Inside the pod, Linux cgroup v2 enforces a hard wallet (memory.max -> Exit 137 OOMKill) and a 100ms stopwatch (cpu.max -> micro-stalls).

LIVE COMPONENT PARAMETERS
TCP Congestion Control
TLS Handshake Protocol
Packet Filter Engine (8,000 rules)
Cold Handshake
382msTarget: <= 75ms
TCP Throughput
2 MbpsTarget: >= 120 Mbps
Packet Filter
13380 nsTarget: <= 500 ns
cgroup Memory
EXIT 137Target: SAFE
CFS p99 Stall
+240msTarget: <= 20ms
WIRE WATERFALL · DNS + TCP + TLS + BGP BREAKDOWN
DNS Resolution63 ms
TCP SYN / ACK45 ms
TLS Handshake90 ms
BGP Flap Jitter184 ms
LIVE PHYSICS DIAGNOSIS
• CUBIC cwnd collapse: 2.5% loss caps single-stream TCP to 2 Mbps.
• TLS 1.2 adds an extra full RTT (+45ms) on every cold connection; upgrade to TLS 1.3 1-RTT.
• BGP Anycast route flap adds +184ms asymmetric path jitter and breaks active stateful TCP flows.
• iptables linear rule traversal (8000 rules) burns 13380 ns/pkt inside netfilter; migrate to eBPF XDP.
• cgroup v2 memory.max=128MB < worker RSS 196MB -> guaranteed Kernel OOM-Kill (Exit 137).
• CFS cpu.max=10000 100000 exhausts quota mid-request, injecting +240ms p99 tail stalls.
PRODUCTION FORENSICS OUTPUT
$ ss -tin dst :443 | head -n 4
ESTAB 0 0 10.24.4.18:51822 172.16.0.44:443
  cubic wscale:7,7 rto:335 rtt:45.0/4.2 mss:1448 pacing_rate 2Mbps retrans:35
$ bpftool prog list | grep xdp || iptables -S | wc -l
8000 netfilter rules (linear scan 13380 ns/pkt)
$ cat /sys/fs/cgroup/memory.current /sys/fs/cgroup/memory.max /sys/fs/cgroup/cpu.max
memory.current=205520896  memory.max=134217728  status=CRITICAL_EXIT_137
cpu.max=10000 100000  p99_cfs_stall=240ms
Loading interactive Mafs systems math plot…
XSTATE V5 PROTOCOL MACHINE · INJECT PARTITION

Raft Leader Election & Monotonic Fencing Token Machine

Step through a real Raft election, inject a network partition creating a zombie leader, attempt a stale write, and watch the monotonic fencing token block split-brain corruption.

timeoutquorumsplithealFollowerReceiving heartbeatsCandidateTerm++ vote requestLeaderQuorum activeZombie LeaderIsolated old term!Stepped DownSynced new term
ACTIVE XSTATE NODE
follower
NODE TERM
Term 4
STORAGE HIGH-WATER
Token 4
STALE WRITES BLOCKED
0
Node A is a healthy Follower in Term 4 receiving leader heartbeats.
BRENDAN GREGG FLAMEGRAPH · LAB 1 POSTGRES CPU 96%

PostgreSQL 15 CPU FlameGraph · SeqScan + LWLock Buffer Pin Storm

1000 SAMPLES · CLICK FRAME TO ZOOM
all (root) — 100% total (0% self, 1000 samples)all (root)kernel — 9% total (0% self, 90 samples)kernelentry_SYSCALL_64 — 9% total (0% self, 90 samples)entry_SYSC…__x64_sys_epoll_wait — 9% total (0% self, 90 samples)__x64_sys_…tcp_poll — 9% total (9% self, 90 samples)tcp_pollpostgres — 91% total (0% self, 910 samples)postgresAutoVacuumWorker — 4.4% total (0% self, 44 samples)lazy_scan_heap — 4.4% total (0% self, 44 samples)heap_page_prune — 4.4% total (4.4% self, 44 samples)PostgresMain — 79.8% total (0% self, 798 samples)PostgresMainexec_simple_query — 79.8% total (0% self, 798 samples)exec_simple_querypg_plan_query — 3.4% total (0% self, 34 samples)standard_planner — 3.4% total (3.4% self, 34 samples)PortalRun — 76.4% total (0% self, 764 samples)PortalRunExecProcNode — 76.4% total (0% self, 764 samples)ExecProcNodeExecIndexScan — 5.2% total (0% self, 52 samples)ExecI…btgettuple — 5.2% total (0% self, 52 samples)btget…_bt_search — 5.2% total (5.2% self, 52 samples)_bt_s…ExecSeqScan — 71.2% total (0% self, 712 samples)ExecSeqScanExecQual — 11.4% total (0% self, 114 samples)ExecQualtexteq — 11.4% total (11.4% self, 114 samples)texteqheap_getnext — 59.8% total (0% self, 598 samples)heap_getnextheapgetpage — 41.2% total (0% self, 412 samples)heapgetpageReadBufferExtended — 41.2% total (0% self, 412 samples)ReadBufferExtendedLWLockAcquire_BufferMapping — 41.2% total (41.2% self, 412 samples)LWLockAcquire_BufferMappingHeapTupleSatisfiesMVCC — 18.6% total (18.6% self, 186 samples)HeapTupleSatisfiesMVCCWalWriterMain — 6.8% total (0% self, 68 samples)WalWrit…XLogBackgroundFlush — 6.8% total (0% self, 68 samples)XLogBac…__x64_sys_fdatasync — 6.8% total (6.8% self, 68 samples)__x64_s…
TOP HOT LEAF FUNCTION
LWLockAcquire_BufferMapping
Self CPU: 41.2% · Total: 41.2% (412 samples)
STAFF ROOT-CAUSE VERDICT
71% of CPU sits inside ExecSeqScan -> heapgetpage -> LWLockAcquire(BufferMapping) because a missing composite index forced full table scans across 420k dead MVCC tuples.
FIX: CREATE INDEX CONCURRENTLY idx_orders_tenant_status ON orders(tenant_id, status, created_at DESC); VACUUM ANALYZE orders;
Lock / ContentionPostgres EngineNGINX / TLSLinux KernelPython / App