Observer reuse ratio in Kadira

For one of my most used collections, these are the stats on observers:

I assume this is not really great. I read the article on improving this, but I’m not really doing a find using arguments that change often. I’m using React, and not subscribing on a global level but rather within a component that appears on a specific page. So any time the user navigates to a different page, say “Settings,” the subscription is gone and will re-sub once they go back to the page. I’m not sure if that counts as a low reuse ratio or not.

In fact, I just looked at my subscriptions and find statements, and I’m not really passing any arguments to either one. I’m limiting what’s returned on the publication side.

Meteor.publish('tracks', function () {
  return Tracks.find({artistId: this.userId});
});

Meteor.publish('reels', function () {
  return Reels.find({artistId: this.userId});
});

So how do I improve the observer reuse in this case?

In this case, there is a little you can do. You publications are already optimized. Observer Reuse is low because, different artist info is subscribed all the times.

Oh, is Observer Reuse across all sessions/users?

Yes. It’s based on all user sessions

3 Likes

If the data is not too sensitive and it is not too big, like a couple hundred of users a and about 10 tracks on average, and that the track info is crucial to the app, you could publish the complete set.

I often overpublish (which seems counterintuitive to performance optimization) in order to optimize for observer reuse and whenever I can, I use default publish “null” so that the subscription is set up as soon as the app loads.