What’s New in io.js 1.0 Beta? – Streams3

Node Streams are a powerful way to build modules and applications that deal with large streams of data. The Streams API has gone through a few revisions and has steadily been improving. Streams 1 introduced push-streams to allow developers to consume data efficiently. Streams 2 added pull-streams in addition to push-streams to allow advanced use-cases, however, the two styles could not be used together. Streams 3 solves this issue in an elegant manner and allows the same stream to be used in both push and pull mode. Streams3 is available in Node v0.11/v0.12 and io.js.

Read on to dig into the details.

10613667595_e2f53e8725_z

Photo by Thomas Wensing

Read more

StrongLoop Announces Support for io.js with StrongNode

We are excited to announce that the first beta release of io.js will be made available this week. Congratulations to all the developers who worked on getting the release out in just a few short weeks! What’s io.js? it’s a fork of Node.js that ships with the latest version of of Google’s V8 JavaScript engine which boasts many new features currently not available in the official Node.js distribution.

1.0.0

  • New ECMAScript6 features: the most anticipated being generators, which is no longer behind the --harmony flag. Learn more.
  • All the new features of Node v0.12: including performance optimizations, clustered round-robin load balancing, the ability to run multiple instances in a single process and more. Learn more.
  • Improved memory management: In v0.10 memory is allocated internally in large chunks. In io.js the allocations are managed more carefully. The result of this is lower likelihood of memory leaks.
  • streams3: A new version of the streams API for simplified data flowing and passive data listening
  • HTTP keepalive agent improvements: Node’s HTTP client didn’t respect keepalive so it would disconnect and reconnect on sequential connections to the same destination. Now it tries harder to keep the connection alive which improves performance for applications that make many outbound connections. For example, we see improvements in LoopBack applications using the REST and SOAP connectors.
  • Support for asyncwrap: This is an internal API that can be used by core developers and advanced module developers. For example to help with wrapping APIs with promises or generators, or to insert monitoring. For some of StrongLoop’s work in this area, see async-tracker and Zones which are working prototypes of upcoming features.

For a complete list of technical differences between io.js and Node v0.12 (unreleased), StrongLoop’s Bert Belder is maintaining a comparison here.

Introducing StrongNode: support and consulting for Node and io.js

At StrongLoop we understand that some companies are looking to adopt io.js and its cutting edge features in their API, web, mobile and IoT projects. Since there is now Node and io.js to choose from, they may wonder which to use and how to stay future-proof. In response to this demand, we are excited to announce the immediate availability of StrongNode. StrongNode is a subscription support offering from StrongLoop that gives individual developers and organizations the confidence to build their projects with open source software from the Node ecosystem. So, regardless if you choose Node or io.js for your project, StrongLoop is here to make sure you are successful!

More specifically, StrongNode is technical support for Node and io.js core modules plus the Loopback and Express frameworks. Also included in StrongNode is support for LoopBack’s open source data connectors, mobile and gateway features. Multiple plans are available to suit your budget and SLA. To learn more about the StrongNode subscription, contact sales or visit our subscriptions page.

Read more

Generators in Node.js: Common Misconceptions and Three Good Use Cases

Generators have been all the rage lately. Many Node developers (including myself!) are excited and intrigued about writing their asynchronous code like this:

However, this is just one use case (although a clever one) of using generators.

In this article, we will explore the strengths of using generators. There is a GitHub repository with the code samples we will go through that you can check out. You will also need Node 0.11.x (w/ the --harmony flag) or greater to run these examples. I personally use nvm for this. Read more

What’s New in Node.js v0.12 – Running Multiple Instances in a Single Process

An oft-requested feature is the ability to embed Node.js in other applications, particularly in ways that let it integrate with other event loops and (“while you’re at it”) with support for multiple Node execution contexts: that is, the ability to have multiple instances of Node co-exist peacefully within the same process. Imagine a node-webkit application where each window runs its own Node instance that is isolated from all other windows.* Or Node embedded in a phone or network switch where it is performing routing logic for multiple connections, but in a single process and you’re not far off.

GitHub came to us needed this kind of functionality for the Atom editor they were developing. It’s a pretty tall order because Node started out as – and still is – a single-threaded application, built around the concept of a single event loop, with hundreds of global variables that store various bits of state.

You can imagine how retro-fitting thread safety onto such a code base is a highly error-prone task and so that’s not what we did – or rather, haven’t done yet. We wanted to make this change affordable to the client and an incremental step that would help the entire community. Incidentally, if you find yourself needing some changes to Node but without the time to figure out how to make the changes yourself, we can help!

Introducing Multi-Context

Instead, we made it possible in Node v0.12 to use multiple execution contexts from within the same event loop. Don’t worry: from a user perspective, there are no visible changes, everything still works like before. But if you are an embedder or a native add-on author, read on!

Read more

Announcing a StrongLoop npm Registry Mirror on Rackspace

We are excited to see that the public npm registry has undergone some changes architecturally to increase its availability and performance characteristics. If you are a developer that makes heavy use of npm like we do at StrongLoop, you know that the sporadic outages and slowdowns can cut into your productivity big time. Npm’s flakiness is unfortunately a complaint we hear from time to time from customers.

At the same time you’ve got to respect the folks that are running the npm service at webscale. Because webscale isn’t easy. When thousands of developers depend on a service every day, it can be both a blessing and a curse. Alex Young even wrote down a few tips a while back on how to survive npm downtime. A cool tidbit is that it looks like npmjs.org is about a month away from becoming the largest package repository of any language. Maven Central and RubyGems.org are currently on top, but losing their lead rapidly.

Read more