I would like to observe 300 - 400 queries. Is this feasible?


#1

Just wondering how many query observers it is feasible to run. They won’t be constantly updating – just a handful of times per day for each one.


#2

Have you considered using a cron job instead? Using an observe for something that changes this rarely seems like overkill.

Is it important for the changes to be synced immediately?


#3

I have a situation where one collection has documents, each of which contains the specifications for a query on another collection. Users can add, modify, delete the query-docs any time, and there are also often situations in which adding, deleting, or modifying documents in the other collection will cause the results of one or more of these queries to change, which will mean I need to recalculate some statistics. Using a cron job would mean sweeping through every so often and recalculating my statistics, which is effectively using polling instead of reactivity, which means that it would be both more expensive in terms of resources and also not as quick when changes do come up. I’m not really sure how expensive observers are, though. When a change does happen I would like it to be reflected pretty much within less than a minute, and ideally within just a few seconds. My users will lose confidence if they make changes that they know should affect the statistics they see, but then don’t see the statistics update quickly.


#4

I guess I will also need a system for automatically stopping and modifying and restarting the observers as the query specification docs are updated/added/deleted.


#5

Well, for 1 collection you need only 1 observer and changes are picked up instantly.


#6

Not sure the changes are picked up instantly if I’m running my own Mongo instance and the updates to Mongo are coming from a separate process on another server. I don’t think I have oplog tailing on the mongo that I installed on the digital ocean droplet that I’m running this on.


#7

Let me rephrase: It is instant as long as you configured oplog properly.
And there is no reason not to do that.


#8

I guess if I don’t get my oplog configured properly for free then it’s just one more thing that I have to figure out.


#9

Take a look, it’s really easy: https://medium.com/meteor-secret/adding-oplog-tailing-with-meteor-up-mup-and-ubuntu-efa644f397e9