loginWithPassword slow


#1

Why would loginWithPassword run extremely slow? User click sign in button and it can take up to 10-15 sec to log the user in. And, Meteor.logout() is also very slow.

Anyone else see this issue? How can I improve performance?

Thanks
Donnie

Meteor.loginWithPassword(email, password, function (err) {
            if (err) {
                $('.signInMessage').text('Sign In failed. ' + err.reason);
                $('.signInAlert').removeClass('alert-success').addClass('alert-danger');
                $('.signInAlert').show();

                return;

            }
            else {

                var loggedInUser = Meteor.user();
                        Session.set('userRole',loggedInUser.role);
                        Router.go('home');
                }
        });

#2

From my experience this is likely due to the amount of data being sent down to the client. Not sure if this is the case for you but its a good place to start.


#3

I have the same problem. With a server running on a 1GB RAM Single Core Digital Ocean instance, it takes 34 seconds for loginWithPassword to return. I have just 5 users created in this Meteor instance. There are no subscriptions setup prior to the login so it could not be a problem with data as well. I have been trying to solve this for last 4 days and nothing seems to improve. I am running the server using MUP

My backend is connected to a Mongolab database. Will check that next,

But if any of you have a solution or ideas, your ideas are most welcome !!


#4

And other types of login are fast ?


#5

The problem was latency - from my Digital Ocean server to Mongolabs running in Google Compute. I found this through Kadira - DB time was almost 20s. I moved the Meteor server to GCE and now things are zippy… Thanks


#6

If anyone else is having issues where the login or create user functions are taking a long time, remove autopublish.

autopublish@1.0.7 # Publish all data to the clients (for prototyping)

Autopublish will slow things down because it will download all the user details, before it attempts to log you in.

Hopefully this saves someone form pulling their hair out.