Comparing performance of node.js frameworks

Our mission is to compare the node.js frameworks on performance (completed no of requests per second).

Node.js performance tests were performed on the Ubuntu subsystem(2 core , 2 GB RAM) on a VM provisioned from Digital Ocean. The tests only utilize the most basic capabilities of the frameworks in question, therefore the main goal was to show the relative overhead these frameworks add to the handling of a request. This is not a test of the absolute performance as this will vary greatly depending on the environment and network conditions. This test also doesn’t cover the utility each framework provides and how this enables complex applications to be built with them.

We are doing followings three transactions  in each request

  1. create document in db .
  2. fetch the same document from db and add new fields and update the document
  3. update the document’s three field in an audit trail document (nested array)

we are also doing mulptile logging in each transactions.

Data base is mlab data base hosted in same data center where the VM is hosted.

connection string(poolsize etc.) are same for each framework.

There are no caching involved while testing for any of the framework.

Node.js version 6.9 has been used to all three framework.

We are comparing 4 frameworks

  1. hapi+ mongoose
  2. express + mongoose
  3. nodedata
  4. native(http + mongodb driver for node.js)

We taking following scenarios for each of the framework and comparing them

  1. single small document(each document size 5 kb)
  2. single big document(document size 200 kb)
  3. 100 small documents (each document 5 kb)
  4. 100 big documents(each document 200 kb)


Understanding the results:-

  1. Every framework add significant overhead as compare to native calls
  2. on bigger documents (heavy load) this difference become less significant because operations on the load size negates the overhead
  3. on small documents both express and node-data outshines the hapi.
  4. for a single document(small or big) express and node-data are almost equal
  5. on multiple documents(small),node-data completely outshines both express and hapi and closer to  native
  6. on multiple documents(big size),node-data is performing 4-5 time better than  both express and hapi and closer to  native

How node-data achieve the performance improvements :- node-data we make sure that once a document is fetched from DB we don’t do any serialization/transformation over db objects and pass it to application middle wares as it is.

2.we also improve the native db driver code , so it doesn’t impose any performance penalty

3. for multiple documents creation, fetch and update , we have special bulk operations which provide a right balance to batch size and no of concurrent calls to DB.

If you want to know more about node-data check out the our github

Or visit our main page

If you want to try out your self , check out this template

For step by step creation of first node-data application follow this blog.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s