使用MongoDB存储不可变数据? [英] Using MongoDB to store immutable data?

查看:69
本文介绍了使用MongoDB存储不可变数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们研究了存储和读取大量不可变数据(事件)的选项,我希望获得有关MongoDB是否合适的一些反馈意见.

We investigation options to store and read a lot of immutable data (events) and I'd like some feedback on whether MongoDB would be a good fit.

要求:

  1. 我们需要每秒存储约10个事件(但速度会提高).每个事件很小,大约1 Kb.将所有这些事件存储在同一集合中会很好吗?
  2. 一个非常重要的要求是,我们需要能够按顺序重播所有事件.我已经阅读此处,说MongoDB的上限为32使用光标对文档进行排序时,Mb.对我们来说,按插入顺序读取所有数据(如表扫描)会很好,因此可能不需要显式排序?游标是前进的方向吗,他们是否能够满足这一要求?
  1. We'll need to store about 10 events per seconds (but the rate will increase). Each event is small, about 1 Kb. Would it be fine to store all of these events in the same collection?
  2. A really important requirement is that we need to be able to replay all events in order. I've read here that MongoDB have a limit of 32 Mb when sorting documents using cursors. For us it would be fine to read all data in insertion order (like a table scan) so an explicit sort might not be necessary? Are cursors the way to go and would they be able to fullfil this requirement?

如果MongoDB非常适合此操作,那么可以进行一些配置或设置调整以提高不可变数据的性能或可靠性吗?

If MongoDB would be a good fit for this there some configuration or setting one can tune to increase performance or reliability for immutable data?

推荐答案

这与存储日志非常相似:大量写入操作,并且按顺序读取数据.幸运的是,Mongo网站对此有一个秘诀:

This is very similar to storing logs: lots of writes, and the data is read back in order. Luckily the Mongo Site has a recipe for this:

https://docs.mongodb.org/ecosystem/use-cases/storing-log-data/

关于数据的不变性,这对MongoDB来说不是问题.

Regarding immutability of the data, that's not a problem for MongoDB.

这篇关于使用MongoDB存储不可变数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆