How does Meteor perform multiple subscriptions to larger documents?
I am currently developing a database for a fairly large meteorite application and we are discussing whether Meteor will perform better with more subscribers, collections of tiny documents, or fewer subscribers to collections of large documents.
Some of these documents can eventually get quite large, such as user favorites or preferences that are only available to an individual user in a particular view.
In terms of numbers, we are talking about 10 subscriptions, at least four of which will not be sequentially signed either, returning only one larger document in certain representations.
Compared to 4 subscriptions to collections of possibly quite large documents (I realize these custom views are likely to be faster to have data already on the client).
Any ideas or empirical evidence would be incredibly helpful.
Thank.
source to share
This is probably not a complete answer. I am currently solving this problem myself.
I have experience with large datasets. I subscribe to one collection without any restrictions:
Meteor.publish('collectionName', function () {
return collectionName.find();
});
My collection contains 400 documents with a total size of approximately 600KB (after resetting the collection with mongodump
). With 100 users on the system (using it daily from different continents) we have several performance issues:
- When I load a page with 400 items, you can watch the list being filled.
- It is also important what you do with 400 documents. Each of my entries is a fairly complex DOM node with a few helpers being executed on each element.
DOM generation takes some time and causes a spike on the client processor. In addition, a large amount of data is transmitted to the client.
A few ideas for solving problems:
- Using pagination (like batch
alethes:pages
) to prevent client computation intensive. - Use a separate post / subscribe to view the list including the fields required to display the list items to reduce the size of each document.
- Only publish / subscribe to documents available to the current user (e.g. checking login status, access rights, etc.) to reduce the number of documents.
- Download subscription: https://github.com/meteorhacks/subs-manager (haven't tried it yet)
source to share