I'm getting started in node.js and evaluating alternatives for a new project, and have a performance concern.
The use case is to support a very simple HTTP POST of a JSON document of about 300 bytes, validate the fields, and persist that to a MongoDb collection.
I wrote the app twice: Once using Loopback with loopback-connector-mongodb, and once using simple express with mongoose. To write the loopback app, I pretty much just did: ( slc loopback; npm install loopback-connector-mongodb; slc loopback:datasource; slc loopback:model; slc loopback:boot-script) and the app was ready to run, except for some tuning tweaks I'll describe for connection pool and server queue.
Then I ran some load tests using JMeter to submit concurrent POST requests to confirm that I could support some load. I tweaked the OS (Linux) kernel to support multiple connections, set the http server to allow a backlog (app.listen(port,hostname,backlog), and set the mongo connection pool up to 500 connections. In JMeter I ran 1000 threads for about 10 minutes, with some time delay between each post.
Now finally to my concern: The mongoose version ran fine, with no connection errors, using relatively low CPU and having relatively quick (2ms) average response time. However the Loopback version performed worse: It had socket timeout connection errors (.25%), used 3 times the amount of CPU, and much longer average response times (80ms). Nothing else changed between runs, and this was repeatable, and independent of mongo file creation issues.
My questions are: Is this expected? Is there something I can do to easily determine the loopback bottleneck, or boost performance?
Thanks.
David