8

We are seeing very slow login response times on our Meteor app. As load approaches 200 logins/minute the observeChanges calls become quite slow:Login method

ObserveChanges large

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?

EDIT: Added a stack trace with the slow items expanded: ObserveChanges large

Max Ferguson
  • 676
  • 1
  • 7
  • 25
  • I have always thought that the reactive loginServiceConfiguration was overkill for a large production app. However, I'm not sure how to avoid using it – Max Ferguson Nov 12 '15 at 00:13
  • 1
    200 logins/sec? Wow. – Michel Floyd Nov 12 '15 at 00:36
  • Can you expand each of those and post the details under "SHOW MORE"? As well, what does your observer re-use look like for this? – Brett McLain Jan 15 '16 at 18:56
  • oplog will solve this issue, see [this blog post](http://www.manuel-schoebel.com/blog/meteorjs-and-mongodb-replica-set-for-oplog-tailing) – dr.dimitru Jan 16 '16 at 20:26
  • @dr.dimitr Thanks for your comment but we are using the oplog. Kadira shows that the oplog is enabled with the green "Using Oplog" tags. – Max Ferguson Jan 19 '16 at 16:58

1 Answers1

1

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,
  });
});
hwillson
  • 1,399
  • 9
  • 7