Meteor extremely slow when deployed to production on EC2


I have deployed my app to production. I am hosting the app on Amazon EC2.

I have noticed that the app runs really slow on production. Therefore I have created a performance test. It shows that the test runs almost 10 times slower after bundled and deployed to production than when run locally with meteor (i.e. dev mode). I can not understand what issue is. The test runs alot of database queries (both read and write) so it seems like the database is one issue.

I have made alot of tests, using different instance types (t2 large, m3 large etc.) on EC2 but that does not really make a big difference. I have even tried setting up the database on Atlas Mongo. That made some performance improvements but it still runs almost 4 times faster locally on a DEV environment!

I am running out of ideas. Any ideas what could be the issue here or did I config something wrong?


There are a couple of things that pass my mind:

  1. Is Meteor connected to the Mongo Oplog? Meteor reverts to long polling the DB when not running on a local machine. And the polling has an interval of 10 seconds by default
  2. Is the APP connected via the socket? Check if there is a handshake error on your client console (chrome devtools)
  3. Is there a lot of data flowing from your server to the clients? Since locally all the data is available it might be an issue when you try to fetch that data from a remote machine
  4. How big is the clientside of your app?
  5. Try Meteor’s APM service Kadira (either by hosting it yourself or by using NodeChef’s version. (or run your app on galaxy. You might be able to spot bottlenecks there


I should state that it especially is the server side that is running slow.

  1. Yep, MONGO_OPLOG_URL is set
    2-4) Issue is not with the client
  2. Hmm, well try running the app on Galaxy could perhaps help spot the bottleneck,

I will try set up the meteor dev environment on the EC2 server to make sure that is not some issue with the bundling of the app for production.