So Redis⌠Now that I have my OpLog server running - do I not need that with Redis? I looks like Redis is yet another layer I could add for performance and probably need in this case. Iâll look in to it.
A lot of it has to do with the Minimongo library, the pub/sub subscription, whether there are classes being created, which rendering library youâre using, and how many components youâve created.
The browser can certainly handle many thousands of JSON objects⌠just ask anybody who does mapping or graphing. But to cleanly render those objects, you need a functional programming library that uses pure functions. Blazeâs rerenders just donât cut it. But D3 and React can.
So, if youâre just using D3 or React, itâs clearly easy to have an array of 1000 or 10000 JSON objects, and the browser renders super fast. So why does Minimongo bog down? Well, itâs monitoring the subscription and handling optimistic UI. For every component you create, there will be a Tracker item put on the heap thatâs watching to be invalidated. Itâs all those Tracker objects that bring it down an order of magnitude.
You can use HTTP.get() or Meteor.call() functions to bypass the Minimongo cursor, and load up thousands of records client side; but youâll loose reactivity and synchronization with the database.
tl;dr - your max of 225 documents isnât simply a max of documents in the browser. Itâs the max number of synchronized documents that will be synced with the database.
Not necessarily. If you create a method that returns your data, and poll it twice a second, it might still be more performant than using a subscription for data that changes so frequently, and youâll still get all the updates
In our case documents often didnât get fetched at once, this especially resulted in multiple and unnecessary renderings on start.
We fixed that with isReady on the subscription handler on the initial load together with Reactâs PureComponents (or write your own shouldComponentUpdate) to avoid reactive unnecessary rerenders. Hope this helps a bit.
Have you already see this answer (of mine) on StackOverflow: http://stackoverflow.com/questions/12298640/meteors-subscription-and-sync-are-slow/19599027#19599027. In my experience, the only thing that slows things down are reactive re-renders, so you want to disable them (using a guard or similar) before loading a lot of data. In iron-router you would make sure to load the data first and only then render the page (see âwaitOnâ).
Maybe itâs already proposed in one of the comments, but try to ask yourself the question whether you even need this much documents? It might become more performant when using less documents (by adding i.e. more nesting). In that case you might need a little more advanced observers on the client (only watching particular parts of a document instance), but you can keep all the current (reactive) functionality.
I havenât any performance benchmarks so whether it could be really faster is a pretty wild guess⌠Whether itâs worth the refactoring of course also depends on the current structure and size of the application.