[SOLVED] - Very slow subscription waiting for itself 200+ times


After upgrading from Meteor 2.7.1 to 2.7.3 we have starting seeing some very slow subscriptions due to them waiting on other subscriptions, including themselves. See screenshot below from Monti APM.

Any idea what could cause this, how we can fix it or how we can see similar data for which subscriptions a subscription is waiting for in development (localhost)?

Thanks :pray:

1 Like

It looks like the app is creating a large number of subscriptions to the bookings.byDateTimeRange publication. By default, each subscription is set up one at a time, so it has to wait for all of the previous subscriptions. The best solution would probably be to reduce how many subscriptions are created. Another option is to call this.unblock() so they don’t force other subscriptions to wait on them, though there are some bugs with unblocking publications.

In development, you can use montiapm:debug to record and view traces of publications.

Thanks. We fixed this by downgrading react-meteor-data to 2.4.0 and on top of that adding this.unblock() helped a lot, so pub/subs has never been faster.

1 Like