We are seeing very slow login response times on our Meteor app. As load approaches 200 logins/minute the observeChanges calls become quite slow:
As loginWith<service> is part of Meteor core, this problem seems difficult to debug. Note that we only see these slow response times once the app hits 100-200 logins/min second. When there is less load on the app the observeChanges only take a few ms. Any idea what could be causing this?
Looking at your screenshot, it looks like you've defined a custom publication for returning individual user details. As a troubleshooting step, if you're not interested in this query being reactive, try disabling reactivity:
Meteor.publish('currentUser', function () {
return Users.find({
_id: this.userId
}, {
fields: {
emails: 1,
registered_emails: 1,
services: 1,
isPremium: 1,
},
reactive: false,
});
});
To take things further (if you want to keep things reactive), you might want to look into leveraging Meteor 1.3's poll/diff tweaking capabilities, to see if that makes a difference. So instead of relying on the oplog for your user publication, try disabling it for that specific query, and tweak the pollingIntervalMs
and pollingThrottleMs
options. So something like:
Meteor.publish('currentUser', function () {
return Users.find({
_id: this.userId
}, {
fields: {
emails: 1,
registered_emails: 1,
services: 1,
isPremium: 1,
}
}, {
disableOplog: true,
pollingThrottleMs: 10000,
pollingIntervalMs: 10000,
});
});