Performance of 1 Meteor server vs 1 Meteor + 1 Node REST API raises questions for me


I have been working on an app lately where I need to read data from a SQL Server database. I have built a Node+Express+Sequelize REST API server for querying the SQL server, and it works well. The webapp runs Meteor, and the two servers—1 Meteor + 1 Node API—run on the same MacBook Pro. What I’ve been doing is importing data from the REST API into the Meteor Mongo database, since duplicating the data from SQL to Mongo is faster than making API calls every time. It’s been working very well, but I had the idea to skip the separate node server and implement Sequelize directly in Meteor, since it feels more elegant. I was surprised to see that importing data via the Sequelize implementation directly in Meteor took approxiamately 50% longer than it did compared with the node server. I may be approaching it incorrectly, or perhaps this is expected performance with Meteor. Has anyone else had similar experience to this?

The flow of events when it is just Meteor
•Upon startup, Meteor makes calls via Sequelize to the MSSQL database, then inserts the resulting arrays into their respective collections using Collection.batchInsert(responseArray). I had to wrap the responses in a Meteor.bindEnvironment() because of a Fiber error.

The flow of events when Meteor + Node API Server
•Start up the Node server in one terminal window—Running Express 4.14.0 on top of Node v7.1.0
•Start up the Meteor server in a different terminal window—upon startup, Meteor makes Meteor.http requests to routes on the API server
•Meteor takes the responses from those requests and populates their respective collections using Collection.batchInsert(responseArray).

The MSSQL populating sequence takes 59 seconds in the just-Meteor implementation and 39 seconds in the Meteor+API Server implementation. Since I also use a Meteor.setInterval() to poll the data every 5 minutes, the performance hit will have noticeable impact. Is this performance finding consistent with people’s intuition?

Can you see what the outcome is using vanilla Node 4? That’s the version in Meteor right now and it would help identify any extra overhead.

Whoa, it’s Sashko—neat!

Indeed, downgrading my API server to 4.7.3 using nvm results in performance roughly around the bad performance measurements earlier, so the version of Node Meteor is on seems like the most likely culprit. That actually makes me feel better about Meteor—I was worried it might be Meteor-specific overhead rather than Node.

At the end of the day though, it’s not an issue for my use case: it was one of those situations where I asked myself, “is this the way to go about doing it?,” and ultimately decided to just return sequelize thenables from meteor method calls, eliminating the need for the API server and the mongo replication strategy altogether. I was actually pretty amazed by the speed of the sequelize returns—I highly recommend it for quick and dirty non-reactive SQL-integration.

Thanks for the reply and idea!


Yeah, we’re doing our best to upgrade to Node 6 ASAP, hopefully that will make things much better.

I can’t wait to see Meteor become a better and better tool to get any kind of JavaScript app running quickly.