How Node.js and Microservices Change Your Business

From this article you are going to learn how Node.js, containers and microservices change the way you do business today, and what benefits your company will gain after implementing these technologies. This is a summary of the Dreamforce talk Gergely Nemeth gave.

Before diving into the details, let’s take a look at how software development evolved in the past years.

The Evolution of Software Development

In the past decade software development evolved a lot. In the early 2000s, most companies had their data centers. Building them and maintaining them required a lot of effort — not just on the monetary side, but a lot of workforces as well.

In the lack of widely available solutions, smaller companies usually did not have the chance to do proper automation. Enterprises still had the opportunity to do it — but the cost of entry was high.

Luckily, due to dozens of Software-as-a-Service automation solution appearing on the market, in the past years, it has changed a lot. These have the following characteristics in common: they are all affordable and easy to setup.

Nowadays most companies are building hybrid applications — it means, that they have a legacy application, but new features are added to standalone feature services or microservices connected to the legacy application.

In the years to come, a lot more companies will adopt a so-called cloud-first approach — meaning that their primary infrastructure will be in the cloud.

The Benefits of the Cloud-first Approach

The cloud-first approach has several advantages:

  • rapid innovation, which means, that the feedback loop of a product can be low for a week or even for days,
  • shorter time-to-market, as the ease of deployments, and proven product concept (because of the feedback loop),
  • cost savings, because the reduced cost of the infrastructure — if your application has peak times, you don’t have to buy the extra hardware, just rent it.

Why Node.js?

Node.js is a JavaScript runtime, first announced in 2009 by Ryan Dahl. It enables server-side application to be written using JavaScript. It implements an event-driven, asynchronous I/O. We have collected some reasons why companies should implement it.

Node.js is Performant

“Haven’t seen a response time over 8ms so far today” — Jason Pincin, Walmart

On Black Friday in 2014 1.5 billion dollars were spent online in the US on a single day. It is crucial that your site can keep up with the traffic — Walmart, one of the biggest retailers is using Node.js to serve 500 million page views on Black Friday, without a hitch.

Node.js makes your developers a lot more productive

When PayPal started using Node.js, they reported a 2x increase in productivity compared to the previous Java stack. How is that even possible?

“I’m making the bold claim: To every organization, Node.js is absolutely essential.” — Scott Rahner, Dow Jones

NPM has an incredible amount of modules that can be used instantly. This saves a lot of development effort on your side.

Also, as in the browser JavaScript is a first-class citizen, the entire stack can be written using JavaScript. This enables developers to quickly understand — even modify — every part of the system.

Node.js has a Long-Term Support roadmap

As of 2015, Node.js is governed by the Node.js Foundation — a non-profit organization with the goal to make Node.js even more successful in the next years and aid enterprise adoption.

Node.js makes your developers happier

Finding great talent is a hard challenge as well as retaining them. We all like working in environments where we can strive and solve problems efficiently. Development is no different.

Node.js helps you to create such an environment — being cutting-edge and mature enough for most developers to find it exciting to work with.

Why Containers?

Operating-system-level virtualization is a server virtualization method in which the kernel of an operating system allows the existence of multiple isolated user-space instances, instead of just one.

The most popular technologies to do operating-system-level virtualization is Docker or rkt.

Isolation of processes

Container technologies enable easy separation and isolation of running processes. In practice, running processes cannot have a side effect on other processes.

Containers make your deployments more secure

The extra security comes from the isolation of processes. If they keep crashing, taking a lot of memory or CPU, the problem can be handled on a container level, and rogue processes cannot take down the whole systems, as they have limited resources allocated.

Containers enable immutable deployments

Immutable infrastructures consist of data and everything else. The “everything else” part is what’s replaced on every deploy. It is important to note, that not even security patches or configuration changes can be done on production systems — they can be done only with a new deployment. It helps you to create a delivery pipeline that always produces the same result, no matter where you deploy to.

Why Microservices?

Applications with a microservice architecture consist of a set of narrowly focused, independently deployable services. —

Microservices let you build scalable infrastructures

“If you’re worried about scaling to hundreds of millions of users, you build your system in a way that you scale components independently” — Kevin Goldsmith, VP of Engineering at Spotify

Microservices help you to scale your applications’ part separately — you only have to replicate the service that’s used the most, saving you a lot of the operational costs of the infrastructure.

Microservices keep your teams more productive

Microservices also help in another aspect of scalability — that on the organization level. Distributed teams can work on separate features without affecting each other’s’ work — they are no longer blocked by each other.

Service complexity is low

Microservices are small by nature — they have a limited number of dependencies, and are easy to understand in a small amount of time.

Because of this, new developers can quickly join a team and become productive — as they only have to understand a small project first.

Also, as a result of this, microservices on their own are easy to deploy.

New Challenges

Microservices help solving challenges like keeping distributed teams productive, helps separate scaling and brings faster product cycles. But it also brings a new set of problems. In microservices, the application complexity is moving to the network level, and it needs different tools to debug issues.

Stack traces are gone — an error can be a result of a cooperation of multiple services. To discover bottlenecks and find problems in such a system, you need a new kind of monitoring approach like distributed tracing.

With distributed tracing, you can easily track specific transactions. Essentially, when one service is calling another one, it passes a correlation ID. From these correlation IDs you can rebuild the transaction or even visualize it. With the right tool, it’s possible to see the issue immediately in a microservices call chain and reduce or eliminate the complexity of debugging.

Such a tool is Trace by RisingStack, which is a monitoring tool built from scratch for microservices and distributed applications. It’s distributed tracing feature automatically collects the transactions with errors and visualizes them. In Trace there is no need to pass correlation IDs between services manually, it’s all handled by the tool.

The original slides from Dreamforce