The road ahead for Node.js
© Shutterstock / BlackCat Imaging
Why is Node.js gaining fans? According to Saini, Gupta, and Gupta, it’s not just the speed and performance that set it apart from other platforms, but the community support and enthusiasm that makes it shine.
Node.js is quickly gaining traction and becoming a go-to technology for multiple companies. The success of Node.js could also be attributed to immense community support and growing amount of modules published by developers. Moreover, the npm packages make it extremely easy for developers to reuse and share the code.
With Node.js, it has become very easy to build real-time applications. Furthermore, technology companies that emphasize on concurrency, intensive data exchange and speed have started relying on Node.js heavily due to its underlying Google Chrome’s V8 engine.
How does Node.js work?
Outlined below are some of the key features of Node.js architecture:
- Single threaded: Node.js works on the single threaded model with event looping.
- Non-blocking I/O and event driven: A Node.js -based server never waits to obtain the response of an API. The server moves to the next API after calling it and the notification mechanism provided by Events of Node.js helps the server to get a response from the previous API call.
Here’s the diagrammatic representation:
Experience with Node.js
We have been working with Node.js for over five years now and we have developed multiple consumer-facing and business-critical applications. We have built marketplaces, social media applications, live chat engines and so much more. Through our research and development experience, we have gathered several reasons around when and why teams should choose Node.js over other technologies.
As Node.js runs on a single threaded model, it is very good at handling multiple concurrent requests. Companies that anticipate having concurrent users on their product would benefit from using Node.js.
- They will be able to do server-side development using Node.js
- They will be able to develop frontend using multiple frameworks such as React, Angular, and Vue.js
- They will be able to execute mobile development using Cordova and React Native
- They will be able to do desktop application development using Electron
When compared to other technologies that we have previously used, Node.js facilitates faster development as less code is required to develop similar components. Moreover, multiple actions such as reading or writing database, file system, and network connection can be performed swiftly too. Node.js can even act as an API gateway between microservices.
Node.js has a strong community support. We have found that it also has a large third-party library managed by npmjs.com. It is quite exhaustive and offers almost everything you need without incurring any additional cost. With this, development teams have to only focus on business aspects of the application, rather than taking care of technical aspects as most technical challenges are addressed through npm and community support.
Real-time applications can really only be built using Node.js. We have found that Node.js can work wonders when it comes to building instant messaging, audio/video calling, and video/audio streaming.
However, we have also experienced use cases where Node.js isn’t a good fit, especially when your application needs process-intensive calculations that are time-consuming. Some of the examples of process-intensive calculations include mathematical calculations, image processing and so on.
How has Node.js made our lives easier?
It has made our lives easier in two specific ways. First, parsing the data has always been a tedious, seemingly redundant, and monotonous task for many developers. With Node.js, parsing isn’t required as the basic data structure is JSON.
Secondly, setting up initial projects is typically tough but Yeoman comes to rescue. It allows the technology teams to automatically build the project and the fun part, almost production ready code. Whoa!
Features we really liked in v.8 and v.9
Node.js released Node.js 9 last year. Both 8 and 9 have multiple features that are extremely useful. In the most recent release, we really liked these features:
- The async hooks module comes up with an API for registering callbacks. It helps to track async resources within the application.
- Additional support for HTTP/2 and N-API. They are available without any command line flag, but they are still experimental.
Node.js is already becoming the go-to technology for companies pursuing IoT. According to a report from The Node.js Foundation, 96% of respondents have marked Node.js as their preferred platform for IoT development and developing applications for the connected devices. This report is quite interesting as it also highlights a surge in MEAN stack development for interactive and real-time applications.
Along with an increase in use for connected devices, Node.js is also used by multiple big brands. We would like to showcase a couple of examples of how these brands leveraged Node.js for microservices:
- In 2013, Netflix ran a large monolithic application with a startup time of as much as 40 minutes. Soon Netflix identified Node.js as a solution to move the website to single page application. With this, they were not only able to reduce startup time, but also perform distributed resource scheduling for use cases such as real-time anomaly detection, machine learning orchestration, and Node.js based microservices according to their tech blog.
- Another proponent of Node.js is GoDaddy. It mainly used .Net for some time till 2013 when they finally realized that Node.js is the future for any agile company. .Net didn’t have a great community support and they were experiencing multiple problems with product engineering. During the Super Bowl, GoDaddy was able to handle 10.000 requests/second leveraging Node.js and a cluster of 12 servers. The company also was able to implement continuous integration transitioning to microservices.
Expectation from future release(s)
It would be great to see Node.js provide built-in support for mobile development. It would also be nice to see if Node.js is able to handle computationally expensive tasks like mathematical operations. If it is achievable, it will open up an area for Machine Learning, Automation, and much more.
This article is part of the “Use, favor, ditch: Angular, Vue.js, React & Node.js” JAX Magazine issue:
The number of libraries and frameworks could easily overwhelm you so let’s stick to the most popular ones: Angular, React and Vue.js.