Meteor.loginWithPassword Very Slow to Respond

#1

Hi Forum,

I’m on meteor 1.8 & Mongo 3 and trying to call Meteor.loginWithPassword, but it is taking a very very long time to return a result, like 25 seconds, and then it seems to slow down the entire meteor server afterwards until I reboot and logout the user.

The application is very bare bones. The client only subscribes to a tiny amount of data. Same data loads very quickly before logging in. After logging in the publication starts to hang and takes a very long time to respond. I’ve isolated the behavior to calling loginWithPassword(). If I skip that call everything behaves as expected.

I only have a single user account defined, so I don’t know what could be causing it to take so long. All other queries and database interactions are fast, as long as I’m not logged in.

Any ideas? Or suggestions for debugging this?

#2

I would check if users collection has properly indexes.

#3

Yes it has all of the indexes defined by the package.

There is also only a single user defined in the collection, so it doesn’t have much data to search through.

#4

Have you tried using a kadira alternative, like https://montiapm.com? It is free for 8h retention, and works like the original kadira with some improvements. It will catch the traces of your long running methods like the login method so you can explore which step is taking a long time.

1 Like
#5

Thanks, I miss Kadira. I’ll check this one out.

#6

Looking at Kadira, I can see the method response time for login is extrememly long. Here’s link the to a stack trace for the login:

https://app.montiapm.com/mt/6b210084-2325-453d-a0dc-24258db596d0/4xkKEGuGmJ9oqRgTZ

You can see that the find on users takes 0ms, while the fetch on users takes 29912ms! Why is that fetch taking so long? The query it is performing is very simple and it only returns a single document.

This trace shows the observer changes call taking forever to return:

https://app.montiapm.com/mt/abcde57c-44e7-4aa2-bc7c-0f45f5013019/4xkKEGuGmJ9oqRgTZ

#7

The stack trace also mentions that I’m not using OpLog support in my app. Is that a requirement?

#8

Yes, use the oplog to solve your performance issues. There is something else wrong, but this is one of the things that are wrong.

#9

Oplog would not be the root cause of this. It’s as if your database is on the moon, or running on a potato. How/where is your DB running?

2 Likes