数以千计的 REDIS 有序集与数百万个简单集

Thousands of REDIS Sorted Sets VS millions of Simple Sets

关于如何解决我遇到的问题,我有 2 个选项 (AWS ElastiCache (REDIS))。

我能够找到这两种方法在时间复杂度 (Big O) 和其他方面的所有差异。 然而,有一个问题仍然困扰着我:

REDIS 集群(内存消耗,CPU 或任何其他资源)处理是否有任何差异:

?

在此先感谢您的帮助:)

您正在比较两种不同的数据类型,最好通过基准测试来决定哪种内存消耗更好 info memory。但我假设两者都以相同的长度用于内部条目。

如果你使用配置 set-max-intset-entries 并在添加到这个集合时保持在它的限制内(比如 512),那么你的内存消耗将低于你的第一个选项(相同的值长度和相等性)的总条目)。但它不是免费的。

documentation 指出

This is completely transparent from the point of view of the user and API. Since this is a CPU / memory trade off it is possible to tune the maximum number of elements and maximum element size for special encoded types using the following redis.conf directives.