Feeds

Node.js Native breakthrough: cloudy C++ on steroids

Cancer or performance buster?

Business security measures using SSL

Cancer or not, Node.js is attracting plenty of interest, and just like smoking cigarettes at school Node.js is seen as the cool thing to do.

Started by Ryan Dahl in 2009, this server-side scripting environment has in less than three years attracted enough coverage to persuade Microsoft, the world's largest software company, that Node.js is worth fine tuning for Windows and its anti-Amazon Azure cloud to win developer converts.

Some say Node.js is the new Ruby on Rails; this may, or may not, be a flattering comparison given the steam seems to have escaped from that particular engine and attentions have moved elsewhere as you don't hear so much about RoR today as a few years back.

Also, the numbers for this proclamation of popularity are suspicious: these smelly, Alexa-style market statistics are based on GitHub commits and conversations on Twitter. Tim O'Reilly once made similar assertions about RoR based on sales of books by his company about the language.

The allure of Node.js is undeniable: it harnesses server strength to the flexibility of JavaScript - all on Google's V8 JS execution engine. This is exciting as JavaScript applications increase in scale and complexity.

But here's a question: Node.js is written in C/C++ and Javascript - so what happens if you strip out the JS and keep the C++, which is already known for its blazing fast performance once compiled?

That's what programmer Daniel Kang from South Korea is attempting, with a project porting Node.js to latest update of the language - C++11 - published last year. The project is called Node.js Native.

"I thought this was the time for us to go back to native languages for cloud computing," he told The Reg during a call from his home in the peninsula republic.

Kang's port doesn't just remove the JavaScript bits, it also turfs out the V8 engine that was injected by Dahl. The port would be straight C++ (Node) on C++ (application) action with the intermediary layers stripped away.

Scream if you want to go faster

According to Kang, Node.js performance is fast enough for most projects on the client and server, but he's started to see more that are straining the environment. He said: "I saw interesting projects [on GitHub] using Node.js and they required more performance on their operations."

He cites the example of one backend system under development to collect .dat image file information from Microsoft's Kinect Xbox controller to redirect that to other services.

"Because it's not a frontend service it requires some very complicated operations and instructions. In such cases we need to use C++ as the frontend language", he said. "If I put C++ on top of that, we don't have any middleware or abstraction layers. We are just talking between two interpretive systems."

Why C++ is doubleplusgood

Invented by Bjarne Stroustrup more than 30 years ago, C++ is a statically typed language that delivers fast performance partly because it can be compiled into native instructions the processor can execute directly, rather than interpreting it at runtime - as happens with dynamic languages like Javascript.

C++ is so compelling that much of the world's most popular software still uses it - OS X, Facebook, Chrome, MapReduce, Windows 7, Firefox and MySQL to name just a few.

Kang reckoned a port to native C++ is more than 80 per cent faster than "conventional" Node.js, according to a highly unofficial "hello world" benchmark here.

Like many attracted to the original Node.js, Kang likes the non-blocking architecture; this is something that supposedly can handle thousands of concurrent user connections without the application slowing down while it waits for requests to be processed. Node.js does this because it combines all user requests as a single thread but offloads I/O operations that can slow things down for things such as disk or database operations from that main thread.

Kang picked C++ for porting because it's already his main programming language, and reckons he's not "naturally a Node.js developer" because most of his JavaScript experience is on the client side on AJAX.

"I'd tried different frameworks - AppEngine, Jungle, Flask and finally Node... but when I first saw Node I thought this is a very real thing - it was the simplicity and performance that attracted me," he said.

The port was only made possible thanks to C++11, according to Kang. Completed last year, and the first major revision to the language since 1998, C++11 was designed to make it more suited to distributed computing using CPUs with multiple cores.

C++ introduced a standardized memory model that means C++ developers no longer have to build or pick their own libraries to achieve concurrency in C++ applications. A standard memory model means greater consistency in the way apps are built when running on multi-core processors that power servers found in cloud data centres.

Other changes saw features such as lambda expressions introduced to help make coding in C++ a lot easier. C++11 "completely changed the former standard" Kang reckoned.

Kang, currently moving to start a coding job in Silicon Valley, started Node.js Native just three weeks ago. While it's a very preliminary stage, and despite his move, he promised: "I'm focused on the project." Challenges remain, though. The goal is for a first release in a month or two.

Whether Node.js means cancer is coming to C++ is unclear: the internet is littered with plenty of the latest hot framework or new programming language from either individuals or small teams of devs, which either lose the backing of the participants or that forever ride the narrow end of the "long tail". What ever happens with Node.js Native, you can keep track of the project, and potentially contribute, here. ®

New hybrid storage solutions

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
prev story

Whitepapers

Providing a secure and efficient Helpdesk
A single remote control platform for user support is be key to providing an efficient helpdesk. Retain full control over the way in which screen and keystroke data is transmitted.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
Storage capacity and performance optimization at Mizuno USA
Mizuno USA turn to Tegile storage technology to solve both their SAN and backup issues.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Security and trust: The backbone of doing business over the internet
Explores the current state of website security and the contributions Symantec is making to help organizations protect critical data and build trust with customers.