Monitoring active reactive meteorite compounds

We have a problem with our meteor server. When we publish 300 or so items with Meteor.publish / Meteor.subscribe, the server increases its memory and ultimately becomes unresponsive. We thought: 1) to control the number of active subscribers / memory accepted by the active subscription 2) to do something like: publish one time "- ignore changes in the collection on the server side

Any thoughts on how to do any of the above actions? Or any other tips for debugging / improving meteorite application performance? Thanks

+2
source share
2 answers

The answer to zorlak is good.

Some other things:

You can do a one-time publication by writing your own custom publisher using the this.set API based on code in _publishCursor . You would do something like:

 Meteor.publish("oneTimeQuery", function () { MyCollection.find().forEach(function (doc) { sub.added("collectionName", doc._id, doc); }); sub.ready(); }); 

This makes a query, sends its results down, and then never updates it again.

Nevertheless, we hope that the performance of Meteor will be such that it is not necessary!

I would also like to add an easy way to get statistics (for example, the number of cursors observed) from an application in Meteor (set up as a certified subscription), but I haven’t done it yet.

+2
source

As with Meteor 0.5.1, you can simply remove the userId dependencies from the publish function. If the publish function does not depend on which user is subscribing, Meteor will cache the db request so that it does not become slower as more users subscribe.

See this Meteor blog post: http://meteor.com/blog/2012/11/20/meteor-051-database-scaling

0
source

Source: https://habr.com/ru/post/1502343/


All Articles