Hello!
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 1.4.3.1, 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 1.4.3.1 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?