Meteor methods extremely slow in production

Here’s the gist of what’s happening:

I deployed my Meteor 1.5.2.2 app using mup to an AWS instance without any issue. I’ve deployed dozens of Meteor applications before with no issues (mostly on DO). The weird behavior on this app that simple method calls take 3 minutes to complete.

It’s a method that sends a simple email an uses no database at all. So after filling out a form, sending data to method, sending an email and then getting a status back…that process takes 3 minutes in production. It’s instantaneous on the development server.

I really have no idea what the issue is here.

If you run the app in production mode on your local/dev machine do you still experience this issue? (use the --production flag).

Check server error logs for any errors that aren’t being thrown. If you’re using await/async without try/catch these may not be obvious.

Use node perf hooks to determine which part of the method is causing the slowdown (https://nodejs.org/api/perf_hooks.html#perf_hooks_performance_timing_api).

Get NodeChef Kadira instance installed, it’s $10 bucks.

I had all sorts of problems that were instantly diagnosed and fixed… You need Kadira and it’ll tell you.

You should use Meteor.defer or this.unblock. Here’s nice article with example how to send emails.

2 Likes

Do you test your mail server spent to send out of your app? Mail server is slow to send mail, because all send exists all connection proccess again.

I have this problem too and I will use a lib like this https://atmospherejs.com/ostrio/mailer

You can to use that @mpowaga talk too, is more simple.