Systems & Backend Engineering Notes

Field notes on Linux kernel networking, Go services, PostgreSQL internals, and lightweight observability.

Tuning TCP Congestion Control & Queueing on Small Cloud VMs

When running bursty HTTP/2 workloads on 1 vCPU / 1 GB RAM instances, default cubic queueing can amplify tail latency during brief packet loss windows. Switching the qdisc to fq paired with bbr keeps pacing smooth without inflating memory buffers.

sysctl -w net.core.default_qdisc=fq
sysctl -w net.ipv4.tcp_congestion_control=bbr
ss -tin state established '( dport = :443 or sport = :443 )'

Understanding Heap-Only Tuple (HOT) Updates in High-Churn Tables

Every non-HOT update forces an index entry insertion across all indexes on the table, even if only an unindexed timestamp column changed. Setting a modest fillfactor (e.g., 85) leaves intra-page headroom so PostgreSQL can chain updated row versions inside the same 8 KB heap page.

ALTER TABLE job_queue SET (fillfactor = 85);
SELECT relname, n_tup_upd, n_tup_hot_upd FROM pg_stat_user_tables;

Bounded Worker Pools with Context Cancellation and Backpressure

Unbounded goroutine spawning hides memory growth under slow downstream I/O. Using a buffered semaphore or fixed worker pool coupled with errgroup.WithContext ensures fast shutdown propagation and predictable RSS footprint under load spikes.

Quick Socket & Page-Cache Checks Without Heavy Agents

Before attaching heavyweight telemetry collectors to low-memory nodes, standard procps, ss, and vmstat 1 already expose socket queue pressure, slab growth, and major page faults with negligible overhead.

About This Notebook

Minimal static notebook hosted at 2299883.xyz for recording reproducible Linux sysctl baselines, database benchmarks, and post-mortem debugging recipes.