云(Firestore)数据存储热点和索引日期

发布于 2025-02-01 14:27:11 字数 208 浏览 2 评论 0 原文

最近,我试图研究这个主题,涉及云数据存储的热点行为。据我了解,在单调上增加的索引字段的阅读/写作可能会导致高读/写入期间性能的争论和降解。

现在,关于单调增加但更粗糙的田地的情况如何。以代表事件日志的一种例如一种。如果每个事件的日期字段与发生的日期相对应,则可以每天查询。在这种情况下,直到随后的一天,该领域将保持恒定(直到单调增加)。这会导致争夺与在高写入期间使用高精度的时间戳类似吗?

I have tried to research this topic a lot lately, regarding the hotspotting behavior of Cloud Datastore. As I understand, reading/writing to indexed fields that are monotonically increasing can lead to contention and degradation of performance during high read/write load.

Now, how is it with regards to fields that increase monotonically but on a more coarse level. Take for instance a kind that represent a log of events. If each event has a date field corresponding to the day at which it occurred, such that one can query on a day to day basis. In this case the field will remain constant (not monotonically increasing) until the subsequent day. Will this lead to contention similarly to using a high precision timestamp during a high write load?

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

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

发布评论

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

评论(1

一袭水袖舞倾城 2025-02-08 14:27:11

对于您的问题:

我不是在考虑使用时间戳,该时间戳会从实体到实体增加,而是在日常使用的领域。

根据时间戳字段在任何查询中,您都可以通过不索引时间戳字段来删除每秒500个写入。”为此添加:

如果每个事件的日期字段与发生的日期相对应,以便每天查询。

如果您的实体/键共享一个共同的日期前缀,但具有完全随机的后缀,则旧平板电脑(带有旧日期前缀)将不会共享负载。例如,如果您想通过时间戳查询条目,但只需要一次返回单个用户的结果,则可以将时间戳以 userId 和索引新属性索引。

最后,如果您要添加时间戳/日间属性,并且 index 这种方法似乎遇到了热点。

有关更多参考,您可以查找:

For your question:

I am not thinking of using a timestamp, which would increase from entity to entity, but rather a field that is fixed on a day-to-day basis.

According to this "If your app doesn't use the timestamp field in any queries, you can remove the 500 writes per second limit by not indexing the timestamp field." To add in this:

If each event has a date field corresponding to the day at which it occurred, such that one can query on a day to day basis.

If your entities/keys share a common date prefix, but have a completely random suffix, then old tablets (with old date prefixes) won't share the load. For instance, if you want to query for entries by timestamp but only need to return results for a single user at a time, you could prefix the timestamp with the userId and index that new property instead.

Lastly, if you are looking to add a timestamp/day property, and index it, this approach seems to encounter hotspotting.

For more reference, you can look up: High read/write rates to a narrow key range

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