Feeds

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

Cancer or performance buster?

Combat fraud and increase customer satisfaction

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. ®

Combat fraud and increase customer satisfaction

More from The Register

next story
Ubuntu 14.04 LTS: Great changes, but sssh don't mention the...
Why HELLO Amazon! You weren't here last time
This time it's 'Personal': new Office 365 sub covers just two devices
Redmond also brings Office into Google's back yard
Next Windows obsolescence panic is 450 days from … NOW!
The clock is ticking louder for Windows Server 2003 R2 users
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
OpenBSD founder wants to bin buggy OpenSSL library, launches fork
One Heartbleed vuln was too many for Theo de Raadt
Got Windows 8.1 Update yet? Get ready for YET ANOTHER ONE – rumor
Leaker claims big release due this fall as Microsoft herds us into the CLOUD
Batten down the hatches, Ubuntu 14.04 LTS due in TWO DAYS
Admins dab straining server brows in advance of Trusty Tahr's long-term support landing
Red Hat to ship RHEL 7 release candidate with a taste of container tech
Grab 'near-final' version of next Enterprise Linux next week
Apple inaugurates free OS X beta program for world+dog
Prerelease software now open to anyone, not just developers – as long as you keep quiet
prev story

Whitepapers

Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Securing web applications made simple and scalable
In this whitepaper learn how automated security testing can provide a simple and scalable way to protect your web applications.
Combat fraud and increase customer satisfaction
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.