Couchbase 6.5.1 和布隆过滤器

Couchbase 6.5.1 and Bloom filters

我正在尝试评估使用布隆过滤器是否适合我的 Couchbase 部署。我在仅值弹出模式下使用 CB 6.5.1。在官方文档中搜索,我不清楚 何时 布隆过滤器可用。此外,我只能找到它们仅在 5.0 和 5.1 版本上使用的提及。更具体地说,关于 5.0 版,在数据库引擎体系结构部分中,一节内容为

Full metadata ejection removes all data including keys, metadata, and key-value pairs from the cache for non-resident items. Full ejection is well suited for cases where the application has cold data that is not accessed frequently or the total data size is too large to fit in memory plus higher latency access to the data is accepted. The performance of full eviction cache management is significantly improved by Bloom filters. Bloom filters are enabled by default and cannot be disabled.

这是否意味着它们只能在完全弹出模式下使用?

我只能在 5.0 和 5.1 版本中找到的另一个页面是 this one,它只是描述了布隆过滤器与完全弹出和 XDCR 相结合的功能。

那么版本 6.5.x 中发生了什么? bloom filter是不是默认只在full ejection模式下使用,不能禁用?它们可以在某处配置吗?有人可以将它们与仅值弹出模式结合使用吗?

仅值弹出模式的 Couchbase 存储桶在元数据中具有存储桶的所有键,因此布隆过滤器的好处对于大多数操作来说是微乎其微的,因为它可以更快地查看内部内存结构以检查是否一个键是否存在。也就是说,布隆过滤器用于值逐出以改进对已删除键的检测,因为这些键不驻留在内存中,但它们的墓碑确实驻留在磁盘上。

布隆过滤器仍然存在于最新的 Couchbase Server 版本中,包括 Couchbase Server 7.0。 例如,在我的 6.5.1 集群上,我有一个名为 travel-sample 的纯值存储桶。我可以使用 cbstats CLI 命令查看布隆过滤器信息。

:~$ /opt/couchbase/bin/cbstats -u Administrator -p password -b travel-sample localhost:11210 all | grep bfilter

ep_bfilter_enabled: true
ep_bfilter_fp_prob: 0.01
ep_bfilter_key_count: 10000
ep_bfilter_residency_threshold: 0.1

布隆过滤器有 2 个配置选项,可使用 cbepctl 命令修改:

bfilter_enabled - 启用或禁用布隆过滤器 (true/false)

bfilter_residency_threshold - 居民比率阈值,低于该阈值的所有项目都将在布隆过滤器中被完整考虑

例如; :~$ /opt/couchbase/bin/cbepctl localhost:11210 -b travel-sample -u Administrator -p password set flush_param bfilter_enabled false

setting param: bfilter_enabled false
set bfilter_enabled to false

你可以看到它现在被禁用了。

:~$ /opt/couchbase/bin/cbstats -u Administrator -p password -b travel-sample localhost:11210 all | grep bfilter
ep_bfilter_enabled: false
ep_bfilter_fp_prob: 0.01
ep_bfilter_key_count: 10000
ep_bfilter_residency_threshold: 0.1
eviction policy (0.0 - 1.0)

谢谢, Ian McCloy(首席产品经理,Couchbase)