Meteor's subscription and sync are slow

前端 未结 5 489
谎友^
谎友^ 2020-11-29 06:39

I have a collection with 10M documents of 6000 stocks, stock name is indexed. When I subscribe to a new stock, meteor hangs more than 10 seconds to get about 3000 documents

5条回答
  •  既然无缘
    2020-11-29 07:23

    With autopublish enabled you may see a performance hit with large collections of documents in Mongodb. You can address this by removing autopublish and write code to only publish the relevant data instead of the entire database.

    The docs also go into managing cache manually:

    Sophisticated clients can turn subscriptions on and off to control how much data is kept in the cache and manage network traffic. When a subscription is turned off, all its documents are removed from the cache unless the same document is also provided by another active subscription.

    Additional performance improvements to Meteor are currently being worked on, including a DDP-level proxy to support "very large number of clients". You can see more detail on this at the Meteor roadmap.

提交回复
热议问题