Meteor.loginWithPassword Very Slow to Respond

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?

I would check if users collection has properly indexes.

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.

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

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

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

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

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

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?

3 Likes

Hi guys, im having same problem, any luck?

Where’s your MongoDB hosted?

I am running into the same issue, which is causing my instance to crash with a JS heap dump, I am running the database with Atlas in US-east-1 and meteor in US-east-1. I am using Oplog on an M30 and an 8 octa on meteor for only 380 concurrent connections.

APM:

  • login:

response time: 3900ms avg.
DB time: 3100ms avg.

Nearly 4 second ping… not sure why you are paying for that. Just setup your own, I have it all on the same LAN in my rack at the datacenter so latency is 0ms internal between my machine and my db and outside it’s 30ms because I use tier 1 business grade DNS.

Never paid AWS or any of these clouds a penny and we use a data center that donates profits to veterans instead of woke causes.

1 Like

Has anyone figured this out? running into same issue… login is taking very long

Do you have anything that may be relevant, in an Accounts.onCreateUser function?