My notes from LNUG November 2015

2015-11-29
~
3 min read

Craft beer, two rounds of tasty pizza, bunch of friendly people and three talks about Node.js. That’s LNUG — a monthly event for server-side JavaScript enthusiasts in London.

Following a brief change of venue in October, the group moved back to the familiar Stack Overflow offices of Bentima House at Old Street this Wednesday to meet for the last time in 2015. How did it go?

MVP Diagrams that can do things

Matt Forrester kicked off the evening with an interesting talk about making diagrams. Simple illustrations are an invaluable tool for conveying complex ideas on paper as well as email or Slack. But it can take a while to make one with the typical GUI tools for that purpose.

First, Matt showed a few ways of quickly making diagrams using GraphViz and Mike Daines’s viz.js library which brings it to the web (see the live demo here).

Then he went to introduce his spare-time project called DB DiaYAML — a handy tool for drawing database diagrams with just a few lines of YAML. Without having to worry about the layout or formatting, you simply provide the names of your tables, fields and links and get the finished diagram.

Check out Matthew’s blog to learn more.

A JavaScript to C++ transpiler!

The second one to take the stage was Fábio Santos (mind the á) to speak about his JS to C++ transpiler written in CoffeeScript. Yeah, that’s right.

Fábio noted that this toy project was inspired by the similarities between C++11 spec and JavaScript. So far, it can transpile functions using simple data types like numbers and strings. console.log, recursion, closures and objects are also supported.

The highlight came later on in the talk when Fábio did the EPIC FIB() BENCHMARK (calculating the first 45 numbers in the Fibonacci sequence). The transpiled version brought the V8 to it’s binary knees and was about 3 times faster.

Check out the repository on GitHub to learn how it works.

Scaling Node.js using Docker

Ben Hall delivered the last talk for the evening about using Docker to scale Node-based services over several CPUs and machines. If you deploy on a multi-core machine, you aren’t really using its full potential since Node.js always runs in a single process.

To make use of the extra CPUs, you can change your npm start to spawn several processes (based on the number of cores), each one listening on a different port. To make them look like a single one from the outside, Ben uses an nginx proxy that distributes requests amongst the processes (like this — link added by me).

To scale the setup even further, you can make it into an Docker image and deploy to several machines in a cluster with weave in front of it to do the load balancing.

Ben uses this approach to run the Katacoda.com learning platform for developers.

The end

Anyone with some residual upper-body strength (despite the programmer’s lifestyle) helped to carry the tables out of the side room to recreate the cafeteria that normally is there. The crowd thinned as people finished their conversations and collected the last stickers from the desk opposite the reception. In the end, the braver ones headed to the Old Fountain for more craft beer goodness.

That was LNUG November 2015! Many thanks to Ian Crowther and all the organisers for another year of great meetups for fun or profit. See you all next year!