bolt_unix: Remove madvise(MADV_RANDOM) on the data mmap #1356
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 296 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.341
Real PR Conversation Timeline
1 comments
"Review active on #1356"
general
weight: 0.35
tjungblu
Removes the
madvise(MADV_RANDOM)call on the database mmap inbolt_unix.go, so the mapping uses the kernel default (MADV_NORMAL). This is the same change as #940.Fixes #939
Why
Since Linux 6.4 (kernel commit
8788f678, "mm: add vma_has_recency()"), page-table accesses in a VMA markedVM_RAND_READno longer count as recent use. WithMADV_RANDOMon bbolt's mmap, the kernel evicts etcd's cached database pages easily under memory pressure, and compaction then reads them back one 4 KiB page at a time. Details are in #939.Results
As requested in #939, this was evaluated with etcd's own benchmark tools (
tools/benchmarkandtools/rw-heatmaps/rw-benchmark.sh) on Linux 6.12: results comment, full report.| Benchmark test | Result |
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
rw-benchmark.shsweep | No change: across 60 read/write workload mixes, median +0.3% for reads and +0.3% for writes, all within 4.5% || Reads, plenty of memory | No change: point-read throughput and p99 latency within -1.1% to +0.6% |
| Reads under memory pressure | Faster without
MADV_RANDOM: 19x to 41x the point-read throughput; a full list of all keys is 10.1x faster || Compaction under memory pressure | 11.9x faster without
MADV_RANDOM(773 s vs 65.1 s); with compaction every minute under writes, the slowest compaction drops from 238 s to 19.2 s |Notes
bolt_unix.gochanges, as in #940.bolt_android.go,bolt_aix.goandbolt_solaris.gostill setMADV_RANDOM; I can drop it there too if preferred.release-1.5andrelease-1.4(used by etcd 3.7 and 3.6) and add the changelog entries.