Stratio Lucene Index 如何为 Cassandra 工作

How Stratio Lucene Index works for Cassandra

我刚开始研究 Stratio,但我有一些基本问题让我感到困惑:

I heard like using of secondary indexes in cassandra is not suggestible, but looks like Stratio is lucene based implementation of cassandra's secondary index. Do I need to compromise performance of cassandra's if I use stratio? Will there be any latency for normal cql queries?

Stratio 的 Cassandra Lucene 索引只是 Cassandra 二级索引的另一种实现。使用 Stratio 的 Cassandra Lucene 索引可能不会因索引而导致的性能损失变得更糟。我所看到的优势是,与 Cassandra 基于精确字段匹配的默认索引解决方案相比,使用 Stratio 的解决方案,您将获得接近实时的自由文本搜索功能的 Lucene。 在这里阅读更多 Cassandra lucene performance question and here Stratio’s Cassandra Lucene Index GitHub

How it internally indexes data? Will it duplicate my entire existing data?

根据定义,索引不会复制数据。索引是一种反向查找。不同的字段使用指向实际记录的指针进行索引。 (就像书末不同术语的索引)。 因此,如果您的记录中有一个存储 "country of origin" 的字段,那么假设 50% 的记录会将国家/地区设置为美国,而另外 50% 的记录将设置为加拿大。在索引中,USA 将仅存储一次,而 Canada 将分别存储一半的记录。这意味着索引字段越不同,数据需要的存储空间就越大。这也是 Lucene 很好地解决自由文本搜索的地方,它通过将文本标记为不同的词,并对不同文本中每个词的丰度应用评分机制。更多信息:Full Text Search of Dialogues with Apache Lucene: A Tutorial Lucene Basic Concepts

Is it suggestable to use Stratio in production level, How far it is stable?

这个问题很难回答。这在很大程度上取决于您将在生产中使用什么以及如何使用它。我建议您去获得概念验证/原型并尝试一下。

In order to query non partition or non clustering keys we can achieve this by creating secondary indexes, Even by using Stratio I feel like we are doing same. How Stratios custom index really differs from Cassandras secondary index?

如上所述,Lucene擅长自由文本搜索,它有多种不同的查询类型,快速灵活。另一方面,如果您的搜索要求仅限于几个完全匹配的字段,那么选择标准的 Cassandra 索引解决方案可能是正确的选择。

祝你好运, 泰奥

过去 2 年,我们一直在生产中使用 Stratio Cassandra Lucene 插件。它的性能问题与您在 Cassandra 中使用任何其他二级索引时遇到的问题相同。对于需要小延迟(< 100 毫秒)的用途,我们使用自己的自定义表作为索引来利用快速主键查找来满足性能要求。我们仅将基于 Stratio 的索引用于不需要快速响应时间的查询(例如基于 user/ui 的搜索)。

我注意到 Stratio Cassandra 项目 (https://github.com/Stratio/cassandra-lucene-index) 似乎已经死了,因为大约两年没有更新。因此,我们将计划逐步停止使用它。