Kafka将Rocksdb作为活动店播放?

发布于 2025-01-21 12:57:03 字数 249 浏览 4 评论 0原文

有很多有关卡夫卡和活动采购的文章。大多数文章都是关于Kafka在执行事件时并不是很有用的,因为您不能仅针对给定的汇总ID查询事件。 如果将事件存储在主题中,则是的,这是真的。这是因为我们需要阅读所有事件并跳过不相关的事件。 但是将事件存储在RockSDB中呢?现在,我们实际上可以通过将骨料ID用作前缀并在RockSDB中进行范围查询来查询所有事件。

这是一个好方法吗?我知道这将使用大型状态,当重新平衡时可能会出现问题。但是再次,也许在卡夫卡的静态会员资格会有所帮助。

There are alot of articles about kafka and event sourcing. Most of the articles are about that kafka is not realy usefull when doing eventsourcing, because you cannot query the events just for a given aggregate id.
If you store the events in a topic, then yes this is true. This is because we need to read all the events and skip those that are not relevant.
But what about storing the events in rocksdb? Now, we can actually query all the events just for the given aggregate by using the aggregate id as prefix and do a range query in rocksdb.

Is this a good approach? I know that this will use large state and can be problematic when a rebalance occurs. But again, maybe static membership in kafka will help with this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南冥有猫 2025-01-28 12:57:03

Kafka Streams的基于默认磁盘的StateStore IS rocksdb,所以,这是一种完全有效的方法。

,而不是直接摇滚。

现在,我们实际上可以通过将汇总ID用作前缀

来查询所有事件。

。这些商店仅由Kafka记录键构建,而不是由前缀值构建。但是,正如评论中的链接一样,该商店确实支持前缀扫描,但我认为这是Kafka记录键的前缀

这将使用大状态,并且可能是有问题的

您可以参考内存管理处理状态上的页面以及处理其大小的内容。

Kafka Streams's default disk-based StateStore is RocksDB, so yes, this is a perfectly valid approach.

You'd query the store via Kafka Streams APIs, not RocksDB directly, however.

Now, we can actually query all the events just for the given aggregate by using the aggregate id as prefix

Unclear what you mean by prefix. The stores are built exclusively by Kafka record keys, not by prefixed values. However, as linked in the comments, the store does support prefix scanning, but I assume that'd be the prefix of the kafka record keys

this will use large state and can be problematic

You can refer the Memory Management page on handling state and what to tune for handling its size.

小姐丶请自重 2025-01-28 12:57:03

Kafka Streams和RockDB对于快速启动来理解这些概念确实是一个很好的解决方案,但我不确定从长远来看,我不确定这是一个好主意。

如果您打算在生产Apache Cassandra中使用密钥/价值数据库,我对RockDB的个人经历并不是那么出色,似乎是一个更好的解决方案。

但是您也是对的,只能通过主键查询内容并不是那么灵活,因此实现 cqrs 确实更有意义,因此您可以在查询方面获得更大的灵活性。

作为一个行走路径的人,您可以在我的 blog :)

Kafka Streams and RockDB is really good solution for a quick startup to understand the concepts but I am not sure it is good idea in the long term for the production.

My personal experience with RockDB was not that brilliant in production, if you plan to use a Key/Value database in production Apache Cassandra seems to be a much better solution.

But you are also right, querying things only over Primary Key is not that flexible, so implementing CQRS does make much more sense, so you get much more flexibility for Query Side.

As a person that walked the path you plan the walk, you can find my proposed solution in my blog :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文