Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Node.js, toy or power tool ?

Node.js, toy or power tool ?

Node.js is a relatively newcomer in server side platforms but has garnered the attention of both developers and businesses. We will explore if it lives up to the hype, the ecosystem, where is it a good fit and where it falls short.

Ovidiu Dimulescu

October 06, 2012
Tweet

More Decks by Ovidiu Dimulescu

Other Decks in Technology

Transcript

  1. Node.js, toy or power tool? Jacksonville Code Camp, 2012 Ovidiu

    Dimulescu @odimulescu speakerdeck.com/odimulescu
  2. • What problem? • How’s Node.js helping? • Use cases

    • Industry support • Coding in Node.js • Ecosystem • Questions ? Agenda
  3. About @odimulescu • Working on the Web since 1997 •

    • Organizer for JaxMUG.com • Co-Organizer for Jax Big Data meetup
  4. Node.js - What’s the problem? Fast CPUs Spinning wheels How

    do we saturate the CPU doing useful work?
  5. Node.js - Concurrency Node.js Event Loop Rq1 Rq2 Rq1 Rq2

    Green - Request Executing Red - IO wait
  6. Node.js - Been there, done that Event Machines • -

    Twisted • - EventMachine • - Mina, Netty, Atmosphere, vertx.io • - POE Others • Erlang • Scala / Akka
  7. Node.js - But ... They mix async with sync and

    the mentality is towards sync in libraries, drivers etc.
  8. • Proxy between different data layers • Soft real-time apps

    • Crawlers • CLI tools • Quick prototyping • Lower HW and Operational cost* Node.js - Use Cases
  9. • Culture mismatch • Uses Javascript • Requests are CPU

    intensive • Apps relies on specific libraries / functionality • Transactional systems Node.js - Not best fit
  10. 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 Node.js - Installation
  11. 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 Node.js - Server Installation
  12. Lowest privileges Unix: drop to non-root via setuid / setguid

    Front with a secure Proxy Enable safeguards “use strict” Node.js - Considerations
  13. 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. Node.js - Flow libraries
  14. Node.js - Modules require(‘mylib’) - Lookup order 1. package.json ->

    ./lib/mylib.js 2. index.js 3. index.node package.json
  15. • console • log4js • Winston • GELF - Graylog

    Extended Log Format • Windows Event Log ... Node.js - Logging
  16. $ npm install node-inspector $ node --debug-brk myapp.js $ node

    --debug myapp.js debugger listening on port 5858 $ node-inspector visit http://0.0.0.0:8080/debug?port=5858 to start debugging Debuggers WebKit based: Chrome Eclipse V8 Debugger Plugin, JetBrains WebStorm Other Tools v8-profiler, node-profiler nodetime.com Node.js - Debugging
  17. Database Drivers MS SQL, MongoDB, PostgreSQL, MySQL, Oracle, SQLite, Redis,

    CouchDB, Hive, Riak, Cassandra ORMs sequelize, persist, LazyBoy, Model, jugglingdb, node-orm Transactions, Connection Pooling node-mysql-queues Node.js - DB / ORM
  18. • Derby • Express • Flatiron • Meteor • Mojito

    • Tower ... Browserify - Node to Browser conversion Node.js - Web frameworks
  19. • assert - built in • API Easy • Cucumber

    • httpmock, nock, mockery • NodeUnit • Soda ... Node.js - Testing frameworks
  20. • 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 Node.js - Wrapping up