Non-blocking I/O means better performance and scalability. Why? The application runs asynchronously and handles many tasks in one thread. If the app has to wait for data from another component, it puts the waiting line in a queue and handles a different task in the meantime, thus increasing efficiency and minimizing delays.
It does take a bit of planning not to block your application, with constructs that were not built with non-blocking I/O, but it is definitely worth it. Simply put: you process more requests with the same “size” of virtual machine, which saves you money. At the same time, there is little to no time that developers have to put to achieve that, so it is not offset by higher cost of development.
Node.js has a rich library of open-source frameworks as well as active community – no need to fear that it’ll disappear any time soon. In fact, Node is constantly growing in popularity.
In comparison to Java, for example, where major versions are released every couple of years, a new version of Node.js is released twice a year. That means the platform evolves faster to keep developers productive.
Even before Node gained its fame, it was already being implemented by some big companies. One of the first companies to give Node a try was PayPal.
Now, even though some say that Node.js is not the best solution for handling heavy data volumes – so it shouldn’t be the best fit for banking or other financial services, PayPal disproves it.
As you can see, having the same language on both sides actually does matter. Not only is it a more convenient solution (usually), but it also speeds up the development process.
To start with Node.js, PayPal used it for some prototyping at first. Node proved to be extremely proficient, so they decided to try it on production. The first adopter of the new technology at PayPal was the account overview page, one of the most trafficked apps on the website. That’s a big step, isn’t it? They did, however, mitigate the risk by building an equivalent application in Java. If something went wrong with the Node.js app, they could still go back to Java.
A team of 5 Java developers started working on the app in January, while two months later a smaller team of 2 developers started working on the Node.js application. In early June both teams found themselves in the same place: both applications had the same functionalities.
What were the results?
The Node.js app was:
That’s not all, though. The development was more efficient, sure, but there were also some improvements in the performance.
There are a couple of things worth noticing:
Compared to the Java app, the Node.js equivalent had double the requests per second. What’s more, PayPal got their initial performance results using a single core for the Node.js app and 5 cores. At that time, they stated that they were expecting to increase that divide further.
Average response time for the same page was decreased by 35%. That meant pages were served 200ms faster.
Why did they choose Node.js? There are a few reasons, number one being having one common programming language. It was important for Netflix’s team to be able to write the code once and be able to run it everywhere instead of having to do everything twice. Another important factor was the performance of Node.js. Node being non-blocking and async appealed to Netflix as they were hoping to improve the performance. And it worked. From the initial 40-minute startup time they went to less than a minute.
OK, Netflix and PayPal succeeded, but can you count on such benefits as well? The answer is: yes. Obviously, no technology choice guarantees the success of your product as there’s much more to it than its technology stack. The technology can, however, contribute to this success.
Node.js is a solution that’s lightweight, fast, and scalable. It’s performant and efficient – it handles multiple requests at the same time and, as PayPal showed, it doesn’t use as many resources. It’s more time- and cost-efficient to handle the traffic of your application. Node.js can be used for a variety of cases: web application backend (APIs), data intensive real-time applications, serverless applications. It’s both an effective solution for startups to speed up and simplify the development, and a mature enough environment that can be used by enterprises.