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)

Results:- 

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 :-

1.in 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
 
https://github.com/ratneshsinghparihar/Node-Data

Or visit our main page

https://nodedataio.azurewebsites.net/

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

https://github.com/sureshdube14/nodedata-demo-sample/tree/master

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

https://wordpress.com/post/blog.talentica.com/2596

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s