You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/develop/data-types/probabilistic/cuckoo-filter.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ Note> In addition to these two cases, Cuckoo filters serve very well all the Blo
50
50
> You'll learn how to create an empty cuckoo filter with an initial capacity for 1,000 items, add items, check their existence, and remove them. Even though the [`CF.ADD`]({{< relref "commands/cf.add/" >}}) command can create a new filter if one isn't present, it might not be optimally sized for your needs. It's better to use the [`CF.RESERVE`]({{< relref "commands/cf.reserve/" >}}) command to set up a filter with your preferred capacity.
51
51
52
52
{{< clients-example cuckoo_tutorial cuckoo >}}
53
-
> CF.RESERVE bikes:models1000000
53
+
> CF.RESERVE bikes:models1000
54
54
OK
55
55
> CF.ADD bikes:models "Smoky Mountain Striker"
56
56
(integer) 1
@@ -115,18 +115,18 @@ When bucket size of 1 is used the fill rate is 55% and false positive error rate
115
115
116
116
### Choosing the scaling factor (`EXPANSION`)
117
117
118
-
When the filter self-declares itself full, it will auto-expand by generating additional sub-filters at the cost of reduced performance and increased error rate. The new sub-filter is created with size of the previous sub-filter multiplied by `EXPANSION` (chosen on filter creation). Like bucket size, additional sub-filters grow the error rate linearly (the compound error is a sum of all subfilters' errors). The size of the new sub-filter is the size of the last sub-filter multiplied by expansion and this is something very important to keep in mind. If you know you'll have to scale at some point it's better to choose a higher expansion value. The default is 1.
118
+
When the filter self-declares itself full, it will auto-expand by generating additional sub-filters at the cost of reduced performance and increased error rate. The new sub-filter is created with size of the previous sub-filter multiplied by `EXPANSION` (chosen on filter creation). Like bucket size, additional sub-filters grow the error rate linearly (the compound error is a sum of all subfilters' errors). The size of the new sub-filter is the size of the last sub-filter multiplied by expansion and this is something very important to keep in mind. If you know you'll have to scale at some point it's better to choose a higher expansion value. The default is [`cf-expansion-factor`]({{< relref "develop/data-types/probabilistic/configuration/#cf-expansion-factor" >}}).
119
119
120
120
Maybe you're wondering "Why would I create a smaller filter with a high expansion rate if I know I'm going to scale anyway?"; the answer is: for cases where you need to keep many filters (let's say a filter per user, or per product) and most of them will stay small, but some with more activity will have to scale.
121
121
122
122
The expansion factor will be rounded up to the next "power of two (2<sup>n</sup>)" number.
123
123
124
124
### Choosing the maximum number of iterations (`MAXITERATIONS`)
125
-
`MAXITERATIONS` dictates the number of attempts to find a slot for the incoming fingerprint. Once the filter gets full, a high MAXITERATIONS value will slow down insertions. The default value is 20.
125
+
`MAXITERATIONS` dictates the number of attempts to find a slot for the incoming fingerprint. Once the filter gets full, a high MAXITERATIONS value will slow down insertions. The default value is [`cf-max-iterations`]({{< relref "develop/data-types/probabilistic/configuration/#cf-max-iterations" >}}).
126
126
127
127
### Interesting facts:
128
128
- Unused capacity in prior sub-filters is automatically used when possible.
129
-
- The filter can grow up to 32 times.
129
+
- The filter can grow up to [`cf-max-expansions`]({{< relref "develop/data-types/probabilistic/configuration/#cf-max-expansions" >}}) times.
130
130
- You can delete items to stay within filter limits instead of rebuilding
131
131
- Adding the same element multiple times will create multiple entries, thus filling up your filter.
0 commit comments