Welcome!

Linux Containers Authors: Stefana Muller, Elizabeth White, Zakia Bouachraoui, Yeshim Deniz, Pat Romanski

Related Topics: @DevOpsSummit, Microservices Expo, Linux Containers, Containers Expo Blog, @CloudExpo, @ThingsExpo

@DevOpsSummit: Article

About Node.js 4.0.0 | @DevOpsSummit #API #DevOps #IoT #M2M

Node.js 4.0.0 aims to provide an easy update path for current users of io.js & node so there are no major/breaking API changes

What You Need to Know About Node.js 4.0.0

Now - that Node.js 4.0.0 was officially released - you may wonder what it delivers to you and if you should upgrade right away, or not. This post covers the most important changes you need to know, and some key implications you may have to take into account in making your decision.

The Story So Far
The last few months were really exciting for the Node.js community.

At the start of this year Joyent Inc. handed over the project to the community around io.js, a fork of Node.js. Soon after that, it was decided that there should be only one version that incorporates all current features of io.js and Node.js in the future.

Bringing together two codebases that drifted away from each other for many months is a huge endeavor. When I was told about it at NodeConf in June, initially I was pessimistic about the planned time frame of about 3 months.

I'm really stunned that actually a new converged Node.js 4.0.0 has just landed.

Why "4.0.0"?
The io.js project uses semantic versioning (semver) with its first major release being a 1.0.

The current main line of io.js is 3.x. To avoid collisions with the 0.x scheme of Node.js it was decided that the converged version should be a 4.0.0 and will also be following the semver scheme <major>.<minor>.<patch> from now on.

So ... What's New
Node.js 4.0.0 aims to provide an easy update path for current users of io.js and node and so there are no major/breaking API changes. Nevertheless there are many small improvements and changes. I recommend reviewing the the LTS Wiki (we'll speak about LTS further down) and running extensive tests before updating your production environments.

Let's review the most important changes.

New V8 Version (and Its Implications)
One reason for creating io.js in the first place were unpredictable and long release cycles.
Node.js and io.js heavily depend on Googles V8 JavaScript engine which is under constant development and improvement and the project was falling behind quickly.

Node.js 4.0.0 now uses a recent version of V8 (4.5 compared to 3.28.x in node 0.12, to be exact) - this is great because it offers new language features (see below) but comes with a cost:

Node.js projects usually heavily depend on modules. A fraction of them are native - this means that they are written in C++ and are linked against V8.

Without precautions every new V8 version will break all native modules. To remedy this, there is an abstraction library called Nan that provides Macros and an API for different versions of V8. So one module that uses Nan will usually work with all versions from 0.8 to 0.12.

With Node.js 4.0.0 Nan took the chance to do some refactoring and also bumped its version from 1.x to 2.x, introducing breaking changes.

This means that a native module needs to be modified to use Nan 2.x to work with Node.js 4.0.0.

For regular users of Node.js the consequence is that some native modules used their projects may cease to work if there is no update available. This might be a deal breaker for some but maybe this is also a chance to closely review all the modules used and look for actively maintained alternatives.

You are also free to fork modules and port them to Nan2. I just did this with node-gc-profiler. Here's also a diff that shows the changes that were necessary.

After covering the not-so-exiting implications let's look at what you get in return:

Extended ES6 support
ECMA-262 is the latest version of the JavaScript language specification and - by building on a recent V8 version - Node.js 4.0.0 supports many new language features out of the box.

Here are some examples

  • Block scoping using let and const
  • Classes. Yes really, JavaScript now supports classes but they are just syntactic sugar built around the prototypical inheritance model of JavaScript. So if you are using CoffeeScriptbecause you just can not live without having a ‘class' keyword this new feature is for you.
  • Generators (function*, next and yield) It makes sense to get used to- and understand them. They will be heavily used in the future. koa.js, for instance, was built by the express folks and heavily depends on them.

Please find a complete list of currently supported ES6 features here: ES6 in Node.js 4.0.0.

Performance
I've run some benchmarks using express with Node.js 0.10, 0.12 and 4.0.0 and I was really hoping that I could provide some exiting performance gains but the truth is ... well let's look at it.

This is no longer true. I ran my initial performance tests against an early release candidate and there were no significant performance gains. After release candidate 4 introduced improved V8 ArrayBuffer handling I redid my tests with the final release and now ... well let's look at it.

For my tests I used a simple express application and created some load using ab.

First I wanted to know the difference in request performance and collected the number of requests per second and the time a single request took.

Figure 1: Overall performance of Node.js 4.0.0 compared to 0.12 and and 0.10

Click here for the full article

More Stories By Daniel Khan

Daniel Khan has over 15 years experience as full stack developer, architect and technical lead in the field of web engineering proving his strong problem solving skills in hundreds of projects. He is passionate about constant learning, using new technologies and sharing his findings with others. As technology strategist, Daniel focuses on driving support for emerging technologies like Node.js and MongoDB at Dynatrace.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
Machine learning has taken residence at our cities' cores and now we can finally have "smart cities." Cities are a collection of buildings made to provide the structure and safety necessary for people to function, create and survive. Buildings are a pool of ever-changing performance data from large automated systems such as heating and cooling to the people that live and work within them. Through machine learning, buildings can optimize performance, reduce costs, and improve occupant comfort by ...
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...