Who can benefit from Node.js? Top 3 reasons why companies choose Node.js

A few weeks ago, in our article Famous apps built with Node.js, you could see the quite impressive list of companies that have already given Node a chance. But why did they do it? If they had a functioning application, what was really the reason that made them change the technology?Obviously, all of these companies had serious reasons to do so. Their motivations may have been different, but surely all of them wanted to see whether the benefits that Node promised would translate into a brighter reality. What benefits am I talking about? Let’s list a few.

All JavaScript/TypeScript

With Node.js, both frontend and backend can be written in the same language. Historically, JS was mainly used for simple client-side scripting, while server-side was written in another language. That meant your team needed to cover both [other language] skills and JavaScript/TypeScript skills. While developing for frontend and backend is still very different from one another, the initial work to master the language can be done only once. In addition, both frontend and backend developers use the same ecosystem of tools, libraries, and package managers, which makes sharing code much easier (no need to rewrite those model classes in different language!). That means you can now really build a team of fullstack developers. If anyone from the team goes on vacation, the others can take over some of his responsibilities. Additionally, utilizing JavaScript on both client- and server-side makes the communication between them smoother.

Non-blocking I/O

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.

Resources

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.

Why big companies choose Node.js

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.

PayPal

Back in 2013, PayPal decided to move their web applications from Java to JavaScript and Node.js. In an article at PayPal Engineering, Jeff Harrell writes:

Historically, our engineering teams have been segmented into those who code for the browser (using HTML, CSS and JavaScript) and those who code for the application layer (using Java). Imagine an HTML developer who has to ask a Java developer to link together page “A” and “B”. That’s where we were. This model has fallen behind with the introduction of full-stack engineers, those capable of creating an awesome user interface and then building the application backing it. Call them unicorns, but that’s what we want and the primary blocker at PayPal has always been the artificial boundary we established between the browser and server.

Node.js helps us solve this by enabling both the browser and server applications to be written in JavaScript. It unifies our engineering specialties into one team which allows us to understand and react to our users’ needs at any level in the technology stack.

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:

  • built almost twice as fast with fewer people,
  • written in 33% fewer lines of code,
  • constructed with 40% fewer files.

That’s not all, though. The development was more efficient, sure, but there were also some improvements in the performance.

Node.js and Java

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.

Netflix

In 2015, Netflix started migrating their architecture to Node.js. Prior to this decision, Netflix used to be a monolith application with 40-minute startup times, slow builds, and huge developer machines. This situation was affecting the team’s productivity and ability to move quickly. Additionally, they used to run Java on the server-side and JavaScript on the client-side. They had to do a lot of things twice: they had to write everything separately for the server and for the client. There were also two ways of doing things such as debugging, data access, rendering… In short: it was quite a complicated process. Netflix was looking for a solution to simplify their stack since their web application layer was doing too much: it was very complex and had a lot of business logic, it was doing a lot of data access. They wanted to make it simple and also turn more to a single page application.

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.

Node.js users

Who can benefit from Node.js?

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.

Need a hand with Node.js development?
What types of applications can you build with Node.js?

Node.js is a JavaScript runtime environment and it’s built on Chrome’s V8 JS engine. Is known for its efficiency and scalability. Netflix, Uber, LinkedIn, Trello, PayPal, and even NASA (among others) are already enjoying its benefits. Read more

Everything changed when Node.js emerged and suddenly, there was no longer need for the sole usage of PHP in building the next generation of server stacks. Is there a possibility to clearly state which one is better?. Read more

Famous apps built with Node.js

Node.js is gaining more and more popularity.Node is most commonly used in web app development, with 85% of respondents indicating they use it for this type of work. 43% of respondents indicate they use Node for enterprise applications. Read more

Share the article with your friends!

Written by: and

Kaja Polachowska

Communication specialist in love with the English language. A people person who loves to learn about others. An avid reader of paper books.