This contributed piece is from a speaker at Node.js Interactive Europe , an event offering an in-depth look at the future of Node.js from the developers who are driving the code forward, taking place in Amsterdam from September 15 to September 18.

Peter Marton, co-founder, CTO, RisingStack Peter Marton (@slashdotpeter) is the co-Founder and CTO of RisingStack, currently working on Trace — a Node.js Performance Monitoring and Debugging tool designed for understanding and troubleshooting microservices-based applications on a process level.

Most software projects start with solving one problem. Then comes another one and the project continues growing without the engineering team being able to cope with it.

This is how monoliths are built. Every new feature gets added to the existing application making it more and more complex. Scaling becomes hard and resource-wasting since everything has to be scaled together. Deployment turns into a nightmare thanks to the million lines of code waiting to be pushed into production every time. Meanwhile, management will encounter grave challenges with coordinating large, siloed teams interfering with each other.

After a certain complexity, it becomes difficult to handle even the smallest changes in an enterprise environment. Developers begin to struggle to add new features to their product, which can easily become obsolete in a competitive market.

Microservices to the Rescue

To solve these problems, daring and innovative enterprises turned towards a new type of architecture called microservices.

In a microservice-oriented architecture, the software can be built up from multiple smaller pieces that work together, but can be developed separately. By defining technology agnostic communication channels, any language can be implemented to use. This means that developers are not restricted to certain technologies anymore, and they can freely experiment.

If done properly, a microservice should be small enough to be rewritable in about two weeks by a small team. If the quality or the performance is not good enough, it will not take long to replace a service, which highly reduces the risk of development, and the costs associated with the operation of the infrastructure, so companies end up with better performance for less money.

But what makes Node.js the best option out there to build small services? Let’s find out!

Node.js and Microservices: A Match Made in Heaven

Node.js became the go-to technology in the past years for both startups and enterprises who decided to embrace microservices. Why did that happen? What is so appealing about using Node?

Well, some argue that Node.js increased the productivity of their teams, and some will say their application became blazing fast or that their developers are happier with Node.

In fact, all of these claims are true, here’s why:

Productivity: The package manager for Node.js, npm has an incredible amount of modules that can be used instantly, which saves a lot of development effort. Also, as Node.js applications are written using JavaScript, front-end developers can easily understand what is going on, and make changes if necessary. Since developers can use the same language on the entire stack and the very same modules in the frontend and in the backend, an incredible amount of time can be saved.

Performance: Node.js is one of the best solutions for creating high-performance, real-time web applications, thanks to its non-blocking, event-driven I/O model. Combined with a microservice-based application, it can handle an extreme amount of load with low response times. By properly utilizing microservices and Node.js, it’s possible to handle the same load with only 10 percent of the hardware according to GoDaddy’s Senior Software Engineer, Stephen Commisso.

Developer Happiness: Node.js is spreading like an unstoppable virus with its 3.5 million users and 100% annual growth rate according to the Node Foundation. Its module system — npm — is much more popular and grows significantly faster than the package managers for other languages often used in an enterprise environment. Why? Because developers love it. It’s also worth noticing that Node.js is highly favored amongst the next generation developers, who don’t really want to work with statically typed languages like #C or Java anymore.

Thanks to the Linux Foundation, Node.js has Long-term Support since April 2015, which means that every major version is maintained for a period of 18+12 months. This was the last step of ensuring that it is ready for enterprise adoption alongside with microservices. Now let’s see a few success stories for enterprises using microservices with Node.js.

PayPal Got Rid of its Monolith for Good

The migration from a monolithic Java stack to a microservices-based Node environment at Paypal started in early 2013 with a prototype project. At that time, their engineering teams were separated into groups developing the browser layer (HTML, CSS, JS) and the application layer. After introducing full-stack engineers, the artificial boundary between browsers and servers started to dissolve, according to Jeff Harrell, the leader of UI Engineering Architecture.

Since Node performed well as a prototyping platform, PayPal decided to try it out as the platform of their account overview page, one of their most trafficked app, while keeping the Java application as a fall back option in case anything goes wrong.

The results of the migration were astounding for PayPal engineering. Their Node.js app was built twice as fast with fewer people, meanwhile, the code consisted of 33 percent fewer lines and 40 percent fewer files. Regarding performance, expectations were also met: A single core Node app was able to handle double rps as the five core Java app. Response time decreased 35 percent, and pages were served 200ms faster. From this point, there was no turning back.

It’s also worth noticing that Node.js on its own is not the solely responsible for the success — the transition wouldn’t be so successful without microservices. According to Sameera Rao, senior business products engineering manager at PayPal: “Node.js and an all-Javascript development stack helped PayPal bring efficiencies in engineering and helped rethink and reboot product, design, and operational thinking.”

When PayPal worked with a monolithic architecture, one app did everything. Duplications were common, while teams copy-pasted and tweaked code all the time — and development was like working on an assembly line. Not much was being done.

After moving to a microservice mindset, they were able to modularize their stack, and global teams could roll out new features in a much faster way. For this, they created an open source model and a core GitHub repository with the proper guidelines. By organizing better how the teams worked and how the code was written, PayPal was able to scale Node.js for their global organization in a way that multiple teams were able to work on the same project with ease.

Netflix Reduced its 40 Mins Startup Time With Node

Back in 2013, Netflix ran a large monolithic application with 40 minutes long startup times and really slow builds according to Kim Trott, director of UI platform engineering. Developing this way didn’t enable them to be productive enough and innovate quickly. With Java on the server and JavaScript on the client, everything had to be written twice.

The solution was to simplify their stack, move the website to a single page application and choose a common language to write the same code: Node.js, with the philosophy of write it once, run it everywhere. They were also able to solve problems with vertical scaling, by leveraging Docker and Node to serve as data access layers to their monolithic JVM based system which accesses and mutates data.

Developer productivity rapidly increased thanks to breaking down the monolith into smaller, much more manageable pieces and using containerization to run code on local machines, as Yunong Xiao, platform architect told in Node Foundation’s enterprise conversations series. Being able to run the code locally enabled the developers to closely mirror what’s going to run in production, which was highly beneficial.

But what are they doing now and how are they utilizing Node.js and Microservices? Nowadays Netflix uses Apache Mesos for cloud-native distributed resource scheduling for a variety of use cases including real-time anomaly detection, training and model building batch jobs, machine learning orchestration, and Node.js based microservices according to their recent blog post.

GoDaddy Switched to Node.js from .Net

Charlie Robbins, director of engineering for the UX platform at GoDaddy started using Node.js in 2009, after he saw Ryan Dahl’s legendary Node.js presentation at JSConf, so it’s no wonder that he was one of the main advocates of the technology at GoDaddy.

He let us know that before Node and microservices, GoDaddy mainly used .NET, and employed Java and .NET developers with 10-plus years of monolithic stack experience. Unfortunately, they were experiencing several problems with how they built their product:

They saw that .NET doesn’t have the vibrant community of module publishers like Node.js, and they also had to rely too much on what Microsoft released. They also knew that it wasn’t the future for an agile company, so they initiated an enterprise level culture shift and began prototyping Node.js applications in 2013, according to Stephen Comissio, senior developer at GoDaddy.

But why did they choose Node? Because it is possible to easily build, unit test, integration test and deploy applications with it. Their expectations were met when they faced one of their biggest scaling challenges, a SuperBowl ad urging 100 million people to visit one of their websites. They were able to handle 10.000 requests per second without zero downtime thanks to Node.js and a cluster of 12 servers. GoDaddy can now handle the same load than before with only 10% of the hardware thanks to Node.js, while serving 1.7 million requests per month.

GoDaddy was also able to achieve agility by implementing a continuous integration pipeline, and thanks to transitioning to microservices, they are able to deploy into production in less than a minute now, according to Shaheeda Nizar, GoDaddy’s senior director of OpenStack engineering. Their architecture is a distributed system built on a “shared-nothing” architecture, so deployment is easy and resilient.

Conclusion

Highly innovative enterprises already know that Node.js and Microservices are a great combination for achieving high performance, increased productivity, reduced costs, and satisfied developers. This is why the community is looking forward to Node Interactive, which lets us developers to exchange best practices and experiences of using Node.js with Microservices. If you have any questions regarding this topic, reach out to me in Amsterdam, listen to my talk “Breaking Down the Monolith” or ping me on Twitter.

If you’d like to read more about the successes of enterprises with Node.js, I recommend to check out the “Enterprise Conversation” series on the official Node.js YouTube Channel.

Feature Image via Pixabay.