When it does not fit

The sizes a store passes through

A levelled store's range-filter memory can be divided by its levels' sizes alone, a few more bits a key for every factor of four a level is smaller than the deepest, and on the full store that rule matched the division fitted to the store's own queries at every budget. Through the fill it does not. At a bit a key or less it falls up to 17 points of a perfect filter's saving behind on the shuffled store and 26 on the store filled a cluster at a time, and every large loss has the same cause: part way through the fill the deepest level is a smaller share of the store, and the rule gives it nothing.

A division chosen before the queries arrive gave a levelled store a rule for dividing its range-filter memory that needs nothing but the levels’ sizes. The store keeps its keys in sorted levels, each a fixed multiple of the one above, and a range query that a level’s filter cannot rule out costs a read of that level. One bit a key, divided had found the best division by trying every assignment against the store’s own queries: the small levels want twelve to sixteen bits a key, the deepest one bit or less. The rule reproduces that shape from sizes alone. For each level, count how many factors of four it is smaller than the deepest, give it δ\delta more bits a key for each, snap to a grid of bit counts, and raise the base until the budget is spent. At δ=4\delta = 4 it matched the fitted division on the full store at every budget, on both arrival orders, charged on queries neither had seen.

Its closing section noticed what the full store hides. A store is not full while it fills. Through the fill the deepest level is newer and smaller relative to its own eventual size, sometimes smaller than the level above will be at the end, and the ratios between levels change at every merge. A store writing a level mid-fill applies the rule to the sizes it has then. The prediction was that the rule, with δ\delta fixed at four, would stay within a point and a half of the fitted division at every point of the fill the earlier essays measured, an eighth, a quarter, three eighths, a half, three quarters and the whole, on both orders at every budget. It named the risk: early in the fill the deepest level may be most of the store while the store has fewer keys than its budget was sized for, and the rule’s half bit for it could be too little.

The risk was named in the right place and with the wrong number. The rule’s trouble is not that its half bit is too little but that, part way through the fill, it gives the deepest level nothing.

The rule at six points of the fill

The store, the queries and the accounting are the earlier essays’. The store holds 2202^{20} keys in sixteen clusters and fills either shuffled or a cluster at a time, its filters chosen afresh at every write; each level’s range filter is a pair of prefix lengths chosen for the level’s keys, at each number of bits a key on the grid of nought, a half, one, two, three, four, six, eight, twelve and sixteen. At each of the six checkpoints of the fill, every level’s cost at every grid value is read on two seeds of queries. The fitted division is the assignment of grid values to levels, within the budget, whose cost on the choosing seed is least, found by trying all of them. The rule is the earlier essay’s at δ=4\delta = 4, applied to the sizes the store has at that checkpoint. Both, and the even split, are charged on the charging seed and reported as the share of a perfect filter’s saving they capture.

At the whole store the rule here is the earlier essay’s rule to the bit, and every division is checked to spend no more than its budget and to cost between a perfect filter and none.

Seventeen points behind, three eighths in

On the shuffled store at 1 bit a key, the size rule that matched the fitted division on the full store falls 17.3 points behind it three eighths of the way through the fill: 68.3% of a perfect filter's saving against 85.7%, giving its levels 12, 4, 0 bits a key where the fitted division gives 16, 2, 0.5The shuffled store at 1 bits a key of filter memory on average, at six points of its fill: the share of a perfect range filter's saving captured by the division fitted on the choosing seed, by the size rule at δ = 4 and by the even split, all charged on the charging seed. an eighth of the keys (levels of 8,192, 40,960, 81,920): fitted 59.0% at 6/1/0.5, rule 56.8% at 6/2/0, even 45.0%; a quarter of the keys (levels of 16,384, 245,760): fitted 82.7% at 8/0.5, rule 82.7% at 8/0.5, even 59.8%; three eighths of the keys (levels of 4,096, 61,440, 327,680): fitted 85.7% at 16/2/0.5, rule 68.3% at 12/4/0, even 53.7%; half of the keys (levels of 12,288, 20,480, 163,840, 327,680): fitted 82.9% at 6/6/1/0.5, rule 70.1% at 8/8/1/0, even 54.9%; three quarters of the keys (levels of 8,192, 40,960, 81,920, 655,360): fitted 87.0% at 16/4/2/0.5, rule 74.6% at 12/6/4/0, even 51.5%; all of the keys (levels of 4,096, 61,440, 983,040): fitted 97.2% at 16/8/0.5, rule 97.2% at 16/8/0.5, even 52.7%.0.4000.6000.8001share of the keys arrivedshare of a perfect filter's saving1/81/43/81/23/41fitted to the queriesthe size rule, δ = 4the even splitthe shuffled store, 1 bit a keycharged on unseen queries
Fig. 1 The shuffled store at one bit a key: the share of a perfect filter’s saving captured at each checkpoint of the fill. Fitted to the queries: 59.0%, 82.7%, 85.7%, 82.9%, 87.0%, 97.2%. The size rule at δ = 4: 56.8%, 82.7%, 68.3%, 70.1%, 74.6%, 97.2%. The even split: 45.0%, 59.8%, 53.7%, 54.9%, 51.5%, 52.7%.

On the shuffled store at one bit a key, the size rule captures 97.2% of a perfect filter’s saving on the full store, the same as the fitted division, and 68.3% three eighths of the way through the fill, where the fitted division captures 85.7%: 17.3 points behind. From three eighths to three quarters of the fill it trails by 12 to 17 points. It matches the fitted division exactly at a quarter of the fill and at the end, and nowhere else does it come within two points.

The prediction’s point and a half holds at two of six checkpoints at this budget. The rule is still well above the even split everywhere, by 15 to 23 points from three eighths to three quarters of the fill, so the sizes are telling it something; they are not telling it enough.

On the store filled a cluster at a time at 1 bit a key, the size rule that matched the fitted division on the full store falls 24.8 points behind it three eighths of the way through the fill: 75.1% of a perfect filter's saving against 99.9%, giving its levels 12, 4, 0 bits a key where the fitted division gives 16, 1, 0.5The store filled a cluster at a time at 1 bits a key of filter memory on average, at six points of its fill: the share of a perfect range filter's saving captured by the division fitted on the choosing seed, by the size rule at δ = 4 and by the even split, all charged on the charging seed. an eighth of the keys (levels of 8,192, 40,960, 81,920): fitted 94.5% at 6/1/0.5, rule 73.0% at 6/2/0, even 84.0%; a quarter of the keys (levels of 16,384, 245,760): fitted 99.3% at 8/0.5, rule 99.3% at 8/0.5, even 95.7%; three eighths of the keys (levels of 4,096, 61,440, 327,680): fitted 99.9% at 16/1/0.5, rule 75.1% at 12/4/0, even 85.2%; half of the keys (levels of 12,288, 20,480, 163,840, 327,680): fitted 99.4% at 12/2/1/0.5, rule 79.2% at 8/8/1/0, even 92.5%; three quarters of the keys (levels of 8,192, 40,960, 81,920, 655,360): fitted 99.6% at 12/1/2/0.5, rule 83.6% at 12/6/4/0, even 92.4%; all of the keys (levels of 4,096, 61,440, 983,040): fitted 99.8% at 12/8/0.5, rule 99.8% at 16/8/0.5, even 82.4%.0.7000.8000.9001share of the keys arrivedshare of a perfect filter's saving1/81/43/81/23/41fitted to the queriesthe size rule, δ = 4the even splitthe store filled a cluster at a time, 1 bit a keycharged on unseen queries
Fig. 2 The store filled a cluster at a time, at one bit a key. Fitted: 94.5%, 99.3%, 99.9%, 99.4%, 99.6%, 99.8%. The size rule at δ = 4: 73.0%, 99.3%, 75.1%, 79.2%, 83.6%, 99.8%. The even split: 84.0%, 95.7%, 85.2%, 92.5%, 92.4%, 82.4%.

On the store filled a cluster at a time, at one bit a key, the rule falls 24.8 points behind the fitted division three eighths of the way through the fill, 75.1% against 99.9%, and 21.6 points behind at an eighth. Here the fitted division captures nearly all of a perfect filter’s saving at every checkpoint, and the even split comes within a few points of it from a quarter of the fill on. The rule, which beat the even split by 17 points on the full store, falls below it at four of the six checkpoints.

A deepest level given nothing

Three eighths of the way through filling the shuffled store, at 1 bit a key, the deepest level holds 83% of the keys, and the size rule gives it 0 bits a key where the fitted division gives it 0.5: 68.3% of the saving against 85.7%The shuffled store at three eighths of its fill, 1 bits a key on average: each level's keys and share of the store, its size ratio to the deepest in factors of four, and the bits a key the size rule at δ = 4 and the fitted division give it. level 1: 4,096 keys (1%), ratio 3.16, rule 12, fitted 16; level 2: 61,440 keys (16%), ratio 1.21, rule 4, fitted 2; level 3: 327,680 keys (83%), ratio 0.00, rule 0, fitted 0.5.the size rule, δ = 4fitted to the queries0481216level 14,096 keys · 1%12 · 16level 261,440 keys · 16%4 · 2level 3327,680 keys · 83%0 · 0.5bits a key, smallest level at the topthree eighths of the fill1 bit a key
Fig. 3 The shuffled store three eighths of the way through its fill, at one bit a key: three levels of 4,096, 61,440 and 327,680 keys, 1%, 16% and 83% of the store. The size rule gives them 12, 4 and 0 bits a key; the fitted division gives them 16, 2 and 0.5.

Three eighths of the way through filling the shuffled store, at one bit a key, the deepest level holds 83% of the keys, and the size rule gives it no filter at all where the fitted division gives it half a bit a key. The rule’s division is 12, 4 and 0 bits a key on levels of 4,096, 61,440 and 327,680 keys; the fitted division’s is 16, 2 and 0.5. The difference in the small levels hardly matters here, though the small levels were where dividing the memory first found its saving: they hold 17% of the keys, and at twelve or sixteen bits a key both divisions already spend heavily on them. The difference in the deepest is the whole gap: with no filter, every range query that reaches the deepest level reads it, as a store with no range filter does at every level, and half a bit a key, the earlier essays found, already rules out a large share of those reads.

At the full store the same budget gives the deepest level half a bit because there it holds 94% of the keys. A budget of one bit a key, of which 94% must be spent somewhere, cannot be spent on the small levels alone, so the base the rule solves for lands at a half for the deepest level. Three eighths into the fill the deepest holds 83%, the small levels’ 17% can absorb most of the budget at high bit counts, the base falls below a half, and the snap to the grid rounds it to nothing.

Half of the way through filling the store filled a cluster at a time, at 0.5 bits a key, the deepest level holds 63% of the keys, and the size rule gives it 0 bits a key where the fitted division gives it 0.5: 55.9% of the saving against 82.0%The store filled a cluster at a time at half of its fill, 0.5 bits a key on average: each level's keys and share of the store, its size ratio to the deepest in factors of four, and the bits a key the size rule at δ = 4 and the fitted division give it. level 1: 12,288 keys (2%), ratio 2.37, rule 6, fitted 0.5; level 2: 20,480 keys (4%), ratio 2.00, rule 6, fitted 0.5; level 3: 163,840 keys (31%), ratio 0.50, rule 0, fitted 0.5; level 4: 327,680 keys (63%), ratio 0.00, rule 0, fitted 0.5.the size rule, δ = 4fitted to the queries0481216level 112,288 keys · 2%6 · 0.5level 220,480 keys · 4%6 · 0.5level 3163,840 keys · 31%0 · 0.5level 4327,680 keys · 63%0 · 0.5bits a key, smallest level at the tophalf of the fill0.5 bits a key
Fig. 4 The store filled a cluster at a time, half way through, at half a bit a key: four levels of 12,288, 20,480, 163,840 and 327,680 keys. The size rule gives them 6, 6, 0 and 0 bits a key; the fitted division gives each half a bit.

Half way through filling the store a cluster at a time, at half a bit a key, the rule gives the two deepest levels nothing and the two small ones six bits a key each; the fitted division gives every level half a bit, the even split, and captures 82.0% of the saving to the rule’s 55.9%. The rule’s worst point on either order is this one, 26.1 points behind. Half way through, the store has four levels, the two deepest hold 94% of the keys between them and differ in size by a factor of two, which is half a factor of four, so the rule treats them as nearly the same size and spends nothing on either. On this order and at this budget, the queries want the opposite of what the rule assumes: a little filter everywhere rather than a lot on the small levels.

The shape of a store that is filling

Through the fill the deepest level's share of the shuffled store's keys swings with every merge — 63%, 94%, 83%, 63%, 83%, 94% at the six checkpoints — and half way through the level above it is half its size, a ratio the rule reads as half a factor of fourThe shuffled store at six points of its fill: the keys each level holds, as shares of the store, smallest level on the left. an eighth: 8,192 (6%), 40,960 (31%), 81,920 (63%); a quarter: 16,384 (6%), 245,760 (94%); three eighths: 4,096 (1%), 61,440 (16%), 327,680 (83%); half: 12,288 (2%), 20,480 (4%), 163,840 (31%), 327,680 (63%); three quarters: 8,192 (1%), 40,960 (5%), 81,920 (10%), 655,360 (83%); all: 4,096 (0%), 61,440 (6%), 983,040 (94%).1/8 of the keysdeepest 63%1/4 of the keysdeepest 94%3/8 of the keysdeepest 83%1/2 of the keysdeepest 63%3/4 of the keysdeepest 83%1 of the keysdeepest 94%each bar is the store; segments are its levels, smallest first, the deepest in the accentthe shuffled storekeys a level, as shares
Fig. 5 The shuffled store’s levels at each checkpoint, as shares of its keys, smallest first. An eighth: 8,192, 40,960 and 81,920 keys, the deepest 63%. A quarter: 16,384 and 245,760, 94%. Three eighths: 4,096, 61,440 and 327,680, 83%. A half: 12,288, 20,480, 163,840 and 327,680, 63%. Three quarters: 8,192, 40,960, 81,920 and 655,360, 83%. All: 4,096, 61,440 and 983,040, 94%.

Through the fill the deepest level’s share of the store swings between 63% and 94% with every merge: 63% at an eighth of the keys, 94% at a quarter, 83% at three eighths, 63% at half, 83% at three quarters, 94% at the end. The full store, where the rule was measured, is one of the two points where the deepest level is largest relative to the rest. The rule’s arithmetic was right for that shape, where a level’s share of the store and its number of factors of four below the deepest go together. Mid-fill they do not. Half way through, the level above the deepest is half its size, a ratio of 0.5 in factors of four, and the rule gives it nearly the deepest’s bits, which at a small budget is nothing.

The two checkpoints where the rule matches the fitted division exactly are the two where the deepest holds 94%: a quarter of the way through and at the end. Everywhere else its share is lower, and on the shuffled store at one bit a key the rule gives the deepest level nothing at every one of the four. That is the failure the closing section named, in its mechanism. A store’s sizes do tell the rule how to divide its memory; the rule’s way of reading them, ratios to the deepest level alone, cannot tell a deepest level that is 94% of the store from one that is 63%.

How far behind, over the whole fill

Over the whole fill the size rule at δ = 4 falls at worst 17.3 points behind the fitted division on the shuffled store and 26.1 on the store filled a cluster at a time, both at a bit a key or less; from two bits a key up its worst is 4.2 points, and no single δ is within two points everywhereFor each order and budget, the most and the mean points of a perfect filter's saving by which the size rule trails the fitted division across six checkpoints of the fill, at δ = 4 (solid) and δ = 2 (pale). shuffled at 0.5: δ 4 worst 9.3 at half, mean 2.1; δ 2 worst 6.7 at a quarter, mean 3.9; shuffled at 1: δ 4 worst 17.3 at three eighths, mean 7.5; δ 2 worst 6.7 at a quarter, mean 3.9; shuffled at 2: δ 4 worst 4.2 at half, mean 1.8; δ 2 worst 10.8 at a quarter, mean 5.0; shuffled at 4: δ 4 worst 4.1 at a quarter, mean 2.0; δ 2 worst 6.3 at a quarter, mean 4.3; batched at 0.5: δ 4 worst 26.1 at half, mean 7.8; δ 2 worst 17.0 at a quarter, mean 3.6; batched at 1: δ 4 worst 24.8 at three eighths, mean 13.7; δ 2 worst 1.6 at an eighth, mean 0.7; batched at 2: δ 4 worst 0.7 at an eighth, mean 0.2; δ 2 worst 2.3 at an eighth, mean 0.8; batched at 4: δ 4 worst 0.6 at an eighth, mean 0.2; δ 2 worst 0.9 at three eighths, mean 0.5.δ = 4, worst over the fillδ = 2, worst over the fill0 points10 points20 points30 pointsshuffled, 0.5 bits a keyshuffled, 1 bit a keyshuffled, 2 bits a keyshuffled, 4 bits a keya cluster at a time, 0.5 bits a keya cluster at a time, 1 bit a keya cluster at a time, 2 bits a keya cluster at a time, 4 bits a keydot: the mean gap at δ = 4points behind the fitted divisionsix checkpoints of the fill
Fig. 6 For each order and budget, the most and the mean points by which the size rule trails the fitted division over the six checkpoints, at δ = 4 and δ = 2. Shuffled, δ = 4: worst 9.3, 17.3, 4.2 and 4.1 points at 0.5, 1, 2 and 4 bits a key. A cluster at a time: 26.1, 24.8, 0.7 and 0.6. At δ = 2: shuffled 6.7, 6.7, 10.8 and 6.3; a cluster at a time 17.0, 1.6, 2.3 and 0.9.

Over the whole fill the rule at δ = 4 trails the fitted division by at most 4.2 points from two bits a key up on either order, and by up to 17.3 points on the shuffled store and 26.1 on the store filled a cluster at a time at a bit a key or less. The prediction holds where the budget is large: at two and four bits a key on the store filled a cluster at a time the rule is within 0.7 points at every checkpoint. It fails where the budget is small, which is where the snap to nothing bites, since with two bits a key there is enough to give the deepest level at least half a bit at every point of the fill.

A smaller δ\delta is no repair. At δ=2\delta = 2 the rule spreads its bits more evenly and gives the deepest level half a bit more often, which cuts the worst gap at one bit a key on the store filled a cluster at a time from 24.8 points to 1.6. It also gives the small levels too little at two bits a key on the shuffled store, where its worst gap rises from 4.2 to 10.8. No value of δ\delta that was tried, nought, two, four or eight, stays within two points of the fitted division at every checkpoint and every budget on both orders.

The δ that would have served

The δ that would have served best moves through the fill: at a bit a key on the shuffled store it is 2, 4, 2, 2, 2, 4 at the six checkpoints, and on the store filled a cluster at a time at half a bit, 2, 0, 0, 0, 8, 6 — four at the full store, where it was measured, and rarely four before itFor each order at half a bit and one bit a key, the δ on the grid 0, 0.5, 1, 2, 3, 4, 6, 8 whose size rule captures the most of a perfect filter's saving at each checkpoint of the fill, charged on unseen queries. shuffled at 0.5: 1/8 δ 2, 1/4 δ 4, 3/8 δ 8, 1/2 δ 3, 3/4 δ 4, 1 δ 6; shuffled at 1: 1/8 δ 2, 1/4 δ 4, 3/8 δ 2, 1/2 δ 2, 3/4 δ 2, 1 δ 4; batched at 0.5: 1/8 δ 2, 1/4 δ 0, 3/8 δ 0, 1/2 δ 0, 3/4 δ 8, 1 δ 6; batched at 1: 1/8 δ 2, 1/4 δ 4, 3/8 δ 2, 1/2 δ 2, 3/4 δ 1, 1 δ 4.02468share of the keys arrivedthe δ that captures most1/81/43/81/23/41shuffled, 0.5 bitsshuffled, 1 bita cluster at a time, 0.5 bitsa cluster at a time, 1 bitlines offset 2 px apartthe rule's δ, fitted afterwardsgrey: δ = 4
Fig. 7 The δ whose rule captures most at each checkpoint, at half a bit and one bit a key. Shuffled, one bit: 2, 4, 2, 2, 2, 4. Shuffled, half a bit: 2, 4, 8, 3, 4, 6. A cluster at a time, half a bit: 2, 0, 0, 0, 8, 6. A cluster at a time, one bit: 2, 4, 2, 2, 1, 4. The grey line marks δ = 4.

The best δ moves through the fill: on the shuffled store at one bit a key it is 2, 4, 2, 2, 2, 4 at the six checkpoints, and on the store filled a cluster at a time at half a bit it is 2, 0, 0, 0, 8, 6. Four is right at the full store, which is where it was chosen, and at a quarter of the fill, which has the same shape. Elsewhere the best value is two, or, half way through the clustered store at the smallest budget, nought, the even split. A δ\delta chosen once cannot follow a store whose shape keeps changing.

Even a δ\delta chosen afresh at every checkpoint does not reach the fitted division. On the shuffled store at one bit a key the best δ\delta at each point captures 56.9%, 82.7%, 83.6%, 77.7%, 86.3% and 97.2%, against the fitted division’s 59.0%, 82.7%, 85.7%, 82.9%, 87.0% and 97.2%: within two points at four checkpoints, and 5.2 points behind half way through, where the store has four levels and no single rate of growth up the levels fits the bits the queries want. The parameter is not merely set wrong for the shape; at some shapes it is the wrong kind of parameter.

The rule’s parameter was doing two jobs at once on the full store. It set how much more the small levels get than the deepest, and, through the snap and the budget, whether the deepest got anything. On the full store those happen to be decided together, because the deepest is so large that the budget forces it a share. Through the fill they come apart, and a parameter that is right for the first job gives the wrong answer to the second.

What the prediction got right

The closing section predicted that the rule would stay within a point and a half of the fitted division at every checkpoint, on both orders, at every budget, because the ratio between levels never falls below four in a levelled store and the rule’s arithmetic holds at any ratio that large. It holds at two and four bits a key on the store filled a cluster at a time, within 0.7 points everywhere. It fails at one bit a key or less on both orders, by up to 26 points, and by up to 4.2 at two and four bits on the shuffled store.

The premise about ratios was wrong in a way the full store could not show. Through the fill a levelled store is often not levelled: half way through, the two deepest levels differ by a factor of two, because the merge that will combine them has not happened yet. The named risk was in the right place, the deepest level early in the fill, and the wrong direction: the rule’s half bit for the deepest was not too little, it was not there, rounded away whenever the deepest level was not quite large enough to force it.

The question was whether a rule that reads sizes is right at every size a store passes through. Read as ratios to the deepest level, the sizes are enough at the full store and at a quarter of the fill, and not at the four checkpoints between.

What one store’s fill leaves out

Six checkpoints. The fill is read at six points, and a store between them has other shapes still; the worst gaps here are the worst at those six, not over the whole fill.

One grid. The rule snaps to the earlier essays’ grid of bit counts, whose lowest step above nothing is a half. A grid with a quarter bit would give the snap somewhere to land short of nought, and might close part of the gap by itself.

Two seeds of queries and one store size. As before, the queries are two seeds of the same workload, one to choose on and one to charge on, and the store is 2202^{20} keys in sixteen clusters.

Still open: a rule that never gives a level nothing

The rule’s losses through the fill share one cause: a deepest level, or the two deepest, rounded down to no filter at all at a small budget. From one bit a key up, the fitted division never does that: it gives every level at least half a bit at every checkpoint on both orders. A rule could say the same thing outright: give every level a floor of half a bit a key, then divide what is left of the budget by sizes as before.

The measurement that follows gives the rule that floor and repeats every checkpoint, order and budget, at δ\delta = 2, 4 and 8. The prediction is that the floor closes every gap larger than five points, since every one of them is a level given nothing, and brings the worst gap at one bit a key under three points on both orders, while costing nothing at two and four bits a key, where the rule already gives every level a bit or more. It could fail at half a bit a key, where a floor of half a bit is the whole budget and leaves the rule nothing to divide; there the rule becomes the even split, which is right half way through the clustered store and wrong on the full shuffled store by 34 points. The question is whether the rule’s real parameter is how fast bits grow up the levels or how little the deepest level may be given, and whether a floor alone, set before the store knows its shape, is enough for every shape it passes through.

What this makes readable

Essays that name this one as a prerequisite.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

What links here

Every essay whose body links to this one.

The objects this essay names

Each one links to every other essay that touches it.

Bloom filterDesign parameterLsm treePer levelPredictionSpace accounting