Steve Workman's Blog

Node & Tell at London Web Standards

Posted on by Steve Workman About 3 min reading time

February 2012's London Web Standards event at Forward London was an introduction to Node.js, the server-side javscript framework designed for high concurrency and real-time events. There were two sessions at the event, George Ornbo (@shapeshed) giving an introduction to Node, and a "Node & Tell" session, where four sets of developers came and told the gathered crowd how they'd been using Node in their work.

Introduction to Node.js - George Ornbo

George is a front-end javascript developer who wanted a simpler way to create web apps quickly, and in a language that he knows. Enter Node.js, with its "Event driven I/O", or better put as "Network programming with javascript".

George fired up his browser, and gave the attendees the IP address of his laptop, which was running a simple Node.js chat server, which coped incredibly well with 100 people trying to join from their phones and laptops, showing how resilient it can be on a small laptop. We were then treated to a demo of a "Love/Hate" measure, taking a data feed from Twitter in real-time, it counted and displayed a graph of the percentage of love and hate on Twitter within the last 10 minutes. Seeing the data streaming in, and then the 30 lines of code used to create that was amazing. Node is a framework that does all the hard stuff for you, and enables you to write applications quickly and efficiently.

George then explained why it was so fast - Node works on an event loop, rather than threads. The idea is that no operation should be blocking so that Node can always keep getting http requests and fire of requests to the database or any other data sources asyncronously. It's a big of a head scratcher to anyone who hasn't done much high-performance javascript before, but it's a very efficient way to program. George showed two graphs (roughly transcribed to the notes) on node performance vs apache for high concurrency and memory usage: node wipes the floor with it. Note: since this talk took place, Apache 2.4 has come out. These graphs are a bit different now but Ngix is still well ahead on speed

In summary, Node is great for high concurrency situations and for making server back-ends quickly. It's a break from your normal programming style but is is just JavaScript when you're over that hurdle. Give it a go!

Node & Tell

All of these 4 people gave it a go and were kind enough to show us what they'd been doing.

First was Maired Buchan from Head who had made a voting system based on an Arduino and Node to collect the data. Other than that the voting machine use marble runs to capture votes, she explained that they'd tried a number of places to put the Node server to get maximum performance, eventually settling on a separate server, allowing the Arduino to just count and send a message to Node. The source code is now on GitHub.

The second talk was from Andrew Nesbitt talking about the London Node User Group (which me mentioned on and off), and showing off how he'd made the LNUG website with Node and GitHub.

The third talk was Simon Thompson talking about how he's used Node as a prototyping language, making a drag & drop filing cabinet backed by a MongoDB. He was really impressed with how simple everything was and how little setup you needed to do before everything was working.

The final talk from Daniel Knell and Jason Grant showed a responsive web app that found interesting things to do in your local area. Using Node to help them make some of the more complex geolocation calculations, the web app is a very simple idea that is well executed. It is so good that it won first place at a recent hack day, and they finished in half the time they were given.

Node Training

If you want to learn more, go to LNUG.org or look into Remy Sharp's training course, which is an excellent introduction to Node

London Web Standard crowd at Forward