使用 oplog tailing 观察大型集合的成本 [英] cost of observing large collection with oplog tailing

查看:58
本文介绍了使用 oplog tailing 观察大型集合的成本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些需要观察的大型集合以进行更改.在过去的 polling 时代,整个集合会每 10 秒与内存中的版本进行比较,以确定某些内容是否发生了变化.

I have some large collections which need to be observed for changes. In the old days of polling the whole collection would be compared to the in-memory version every 10 seconds in order to determine if something has changed.

使用 oplog 拖尾,这不再是必要的.使用没有任何参数的 observe 是否仍然很昂贵,或者这是在集合上创建触发器的好方法?

With oplog tailing, this is not necessary anymore. Is it still expensive to have an observe without any parameters or is this a good way to create a trigger on a collection?

推荐答案

Oplog Observe Driver 的当前实现(从 Meteor 0.8.1 开始)将要求所有已发布的文档都在内存缓存中.即,如果您在一个集合上有 3 个不同但重叠的观察,则至少有一个观察观察到的每个文档将分别存储在每个观察的缓存中.但是,如果有多个具有相同参数的观察者,例如选择器、字段投影、排序和限制 - 观察者驱动程序将在它们之间共享.

The current implementation of Oplog Observe Driver (as of Meteor 0.8.1) would require all published documents to be in memory cache. i.e. if you have 3 different but overlapping observes on a collection, each document that is observed by at least one of the observes will be stored in the cache for each observe separately. But if there are multiple observes with the same arguments like selector, fields projection, sort and limit - observe driver would be shared between them.

这篇关于使用 oplog tailing 观察大型集合的成本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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