Sysadmin guides
Linux systems work, measured: systemd, nginx, logrotate, containers, and the command line.
-
Waking a Thread: pipe vs eventfd vs signalfd, Measured
Pipe, eventfd, and signalfd all wake a blocked thread in ~0.04 ms. The difference is 1,000 events: pipe keeps all 1,000, eventfd counts them, signalfd keeps one.
-
paste vs join, Measured: Fast by Position, Wrong by Key
On a million lines, paste merges two files in 0.087 seconds and join takes 0.155 — but paste pairs rows by position, not by key. On shuffled files every one of the million pairings is wrong, and on a file with 1,000 missing keys 997,204 rows carry the wrong value. join drops unmatched keys and fails loudly on unsorted input.
-
mv Across Filesystems, Measured: One Rename or a Full Copy
Moving a 1 GiB file with mv takes 0.002 seconds on one filesystem and about 1 second across filesystems. A 10,000-file tree is the same story: one rename on the same filesystem, a full copy across. mv preserves the timestamp across filesystems; plain cp does not.
-
Pulling One Field Out of a Million JSON Lines: jq vs Python vs grep, Measured
grep pulls one field from a million JSON lines 4.3x faster than jq and 5.1x faster than Python — until a nested key with the same name adds 1,000 extra lines.
-
inotify vs Polling: Measured Wake Latency, Queue Overflow, and the Non-Recursive Trap
A blocked inotify read wakes in about 0.087 milliseconds. A 10 millisecond stat poller takes about 6.1 milliseconds on median, and a 100 millisecond poller about 40.9 milliseconds. The queue holds exactly 16,384 events before it overflows, and a directory watch never sees a grandchild change.
-
grep -F vs -E vs -P, Measured: Same Pattern, Three Engines, One Silent Trap
On a million log lines, grep -F and grep -E tie at 0.040 seconds on a plain literal while grep -P costs 0.099 — 2.5 times more for the same 49,533 lines. LC_ALL=C halves -P and barely moves -E. And on a dotted service name, -E and -P silently return 10,058 lines -F does not.
-
epoll vs poll vs select, Measured: Where the Crossover Actually Is
One wait call over 10,000 idle file descriptors costs poll 0.30 ms and epoll 0.0003 ms. Wake latency ties at 10 fds and differs 30-fold at 10,000.
-
Copying a 1 GiB File: dd at bs=512 Is 9x Slower — and cp Ties dd Once the Block Size Is Right
dd at bs=512 takes 3.6 seconds to copy a 1 GiB file; at bs=1M it takes 0.4 — and plain cp ties it. The block size is the decision, not the tool.
-
Which Lines Are in Both Files? comm vs grep vs sort|uniq vs Python, Measured
comm finds the 500,000 shared lines in two million-line files in 0.14 seconds; grep takes 2.60. But the second-fastest method, sort|uniq -d, is wrong unless both files are already deduplicated.
-
Are These Two Files the Same? cmp vs diff, Measured — Plain diff Costs 100x on Text and Nothing Extra on Binary
On a 1 GiB binary file cmp, diff -q and plain diff cost the same. On a million-line text file, plain diff costs 100x more than diff -q when the difference is on line 1. The equality check is -q, not diff itself.
-
cgroup v2 CPU Quota: What Actually Happens When the Throttle Bites, Measured
A 50% CPU quota makes the same fixed work take 1.92 times as long; a 25% quota makes it 3.95 times as long. cpu.stat shows why: the CPU time is nearly flat, and almost every 100 ms period is throttled.
-
systemd Timers vs Cron: What Actually Happens When a Run Is Missed
A systemd timer stopped for 34 seconds fired exactly once when it came back, one run for four missed elapses, while cron fired zero times for a minute already past. A 10-second timer with AccuracySec=30s ran 2 of 8 elapses when the offset was 8.87 seconds. The measured catch-up counts, fire-time offsets, and dropped elapses.
-
rsync's 2,729x Speedup Is 1% Slower on the Clock: Delta vs Whole-File, Measured in Wall-Clock
rsync reported 'speedup is 2,729.37' for a delta transfer that moved 32,768 literal bytes — and the clock said it took 35.00 seconds against 34.63 for the whole-file copy. The same probe last night said 43 percent slower. The byte counter is not a clock, and the gap does not reproduce.
-
The Regex That Hangs: Catastrophic Backtracking, Measured Across Five Engines
The same pattern, (a+)+$, on the same failing input: Python re takes 16.5 seconds at n=28, grep -P errors out at its backtracking limit, and ripgrep, Rust regex, and grep -E answer in about 2 ms. One possessive character fixes it 811-fold.
-
nginx Reload vs Restart: What Actually Happens to In-Flight Requests
A reload dropped zero requests in three loops of about 26,000 each, with the longest pause 0.040 seconds. A restart dropped about 4,000 connection attempts per loop and left a 0.22-second hole. A slow download finished through a reload and through a graceful quit, and was cut to 39.1 percent by a stop. The counts, the verbatim errors, and the bad-config cases.
-
Logrotate copytruncate vs create: Measured What Happens to a Live Writer
A live writer holds its log file open across a rotation. Under create, 7,087 lines land in the rotated file and 0 in the new one. Under copytruncate, 50 lines vanish in a 56 ms window. Measured on logrotate 3.21.0.
-
GNU Parallel Is Slower Than Serial: xargs -P vs GNU Parallel vs Serial, Measured
GNU Parallel, the tool built for parallelism, is slower than a serial loop at every job count on short jobs, and floors at about 0.61 seconds on the heavy arm while xargs keeps scaling to 11.90x.
-
Your Docker Build Context Taxes Every Rebuild — Even the Cached Ones
A 1 GB build context slows a no-change, fully cached Docker rebuild from 0.66 s to 2.72 s on the classic builder, for a byte-identical image. One .dockerignore line restores 0.63 s.
-
cgroup v2 MemoryMax: What Actually Happens When a Process Hits the Limit, Measured
A process that crosses a 128 MiB MemoryMax cap dies in about 25 milliseconds, with memory.peak exactly at the cap and almost no pressure stall. The same allocator under a 96 MiB MemoryHigh throttle takes about 101 seconds per 16 MiB step instead.
-
Bash Strict Mode, Tested: Six Traps, Each Failing and Then Fixed
A small archive script with a bats test for every strict-mode trap: function-as-condition, local masking, command substitution, the ERR trap without -E, pipelines without pipefail, and the ((count++)) false failure. Every trap is shown failing first, then fixed, on bash 5.2.21.