False-Positive Budgets Across Leveled LSM Compaction

Giving every SSTable level 10 Bloom filter bits per key wastes 90% of filter DRAM on the bottommost level. Shifting bits upward keeps point lookups just as fast at a fraction of the RAM footprint.

In leveled compaction with a fanout ratio of ten, roughly 90% of all keys live in the deepest level (say L6), 9% live in L5, and barely 1% sit across L1–L4 combined. Yet default configurations often allocate an identical 10 bits per key across every level.

During a non-existent key lookup, each level adds independently to expected false-positive I/O. By assigning more bits per key to small upper levels and dropping (or omitting) filters at the very bottom level, we achieve nearly identical expected I/O per lookup while shrinking resident filter memory sharply.

Strategy Filter Bits (L1..L5 / Bottom) Filter RAM / TB False-Positive I/O / Miss
Uniform 10 bpk 10 / 10 ~125 GiB (all keys) 0.048 ops
Level-Weighted (Monkey) 14 / 4 ~56 GiB 0.052 ops
Drop Bottommost Filter 12 / 0 ~14 GiB 1.011 ops (mostly L6)

When skipping the bottom filter makes sense

If your workload consists mainly of missing-key negative lookups, retain 4–6 bits per key on the bottom level so cold misses avoid hitting NVMe. Conversely, when lookups predominantly query keys known to exist—and RAM is tighter than IOPS—optimize_filters_for_hits removes bottom-level filters outright, freeing almost 90% of filter block cache for hot index and data pages.

Calculating expected false-positive rate per bits-per-key target cleanly in Go:
bloom_budget.go
// FalsePositiveRate returns the theoretical FPR for b bits per key
// using optimal k = round(b * ln(2)) hash probes.
func FalsePositiveRate(bitsPerKey float64) float64 {
    if bitsPerKey <= 0 {
        return 1.0
    }
    return math.Exp(-bitsPerKey * math.Ln2 * math.Ln2)
}

Balancing filter density by level fanout turns Bloom memory into a tuned engineering parameter rather than a hidden fixed tax per gigabyte stored.