Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Node.js, toy or power tool?
1. Node.js, toy or power tool?
Jax CodeCamp, Oct 2012
Ovidiu Dimulescu
Saturday, October 6, 12
2. Agenda
• What problem?
• How’s Node.js helping?
• Use cases
• Industry support
• Coding in Node.js
• Ecosystem
• Q &A
Saturday, October 6, 12
3. About @odimulescu
• Working on the Web since 1997
• Into startup and engineering cultures
• Speaker at user groups
• Organizer for JaxMUG.com
• Co-Organizer for Jax Big Data meetup
Saturday, October 6, 12
4. Node.js - What’s the problem?
Fast CPUs Spinning wheels
How do we saturate the CPU doing useful work?
Saturday, October 6, 12
5. Node.js - How’s it helping?
• Uses event-driven, non-blocking IO
• Enforces async throughout*
Saturday, October 6, 12
11. Node.js - But ...
They mix async with sync and the mentality is
towards sync in libraries, drivers etc.
Saturday, October 6, 12
12. Node.js - Use Cases
• Proxy between different data layers
• Soft real-time apps
• Crawlers
• CLI tools
• Quick prototyping
• Lower HW and Operational cost*
Saturday, October 6, 12
13. Node.js - Not best fit
• Culture mismatch
• Uses Javascript
• Requests are CPU intensive
• Apps relies on specific libraries / functionality
• Transactional systems
Saturday, October 6, 12
16. Node.js - Installation
1. Go to nodejs.org
2. Download and run installer
Saturday, October 6, 12
17. Node.js - Installation
1. Go to nodejs.org
2. Download and run installer
What’s included?
node - binary
npm - cli package manager
built-in support for http, net, dns
Saturday, October 6, 12
18. Node.js - Server Installation
1. Regular Installation
2. Make it a service
Windows - NSSM, srvany, etc.
Unix - Distro dependent
3. Front-end WS Integration
IIS 7+ Integration - iisnode
Apache - mod_proxy or mod_rewrite
Nginx - rewrite or proxy
HAProxy, stunnel
Saturday, October 6, 12
19. Node.js - Considerations
Lowest privileges
Unix: drop to non-root via setuid / setguid
Front with a secure Proxy
Enable safeguards
“use strict”
Saturday, October 6, 12
20. Node.js - Hello World
CLI Version - helloworld.js
console.log(“Hello world”);
$ node helloworld.js
Hello World
Web Version
Saturday, October 6, 12
21. Node.js - Hello World
Web - Router Version
Saturday, October 6, 12
22. Node.js - I will call you back
Saturday, October 6, 12
24. Node.js - Flow libraries
Serial independent
Runs a series of functions one after the previous function completed
Serial dependent
Runs a series of functions passing previous results into next function
Parallel fashion
Runs a series of function in parallel
Queue
Runs a series of function in parallel up to desired concurrency
Library Choices
Async, Groupie, Step, Q, etc.
Saturday, October 6, 12
35. Node.js - Scaling out
*Credit: blog.evantahler.com
Saturday, October 6, 12
36. Node.js - Wrapping up
• Reuse existing JavaScript skill and code
• Low resource usage
• Performant VM (Google’s V8)
• Active Community, Lots of resources
• Package Manager
• Enforces Async across
• Quick Prototyping
• Growing Industry support
Saturday, October 6, 12