Your SlideShare is downloading. ×
0
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Node.js, toy or power tool?
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Node.js, toy or power tool?

5,285

Published on

Published in: Technology
0 Comments
12 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,285
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
12
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Node.js, toy or power tool? Jax CodeCamp, Oct 2012 Ovidiu DimulescuSaturday, October 6, 12
  • 2. Agenda • What problem? • How’s Node.js helping? • Use cases • Industry support • Coding in Node.js • Ecosystem • Q &ASaturday, 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 meetupSaturday, 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
  • 6. Multi-Threaded Servers *Credit: blog.cloudfoundry.comSaturday, October 6, 12
  • 7. Node.js - Single Thread, Event-ed *Credit: blog.cloudfoundry.comSaturday, October 6, 12
  • 8. Node.js - Concurrency Node.js Event Loop Rq1 Rq1 Rq2 Rq2 Green - Request Executing Red - IO waitSaturday, October 6, 12
  • 9. Node.js - Concurrency Thread Node.js Higher Concurrency Same LatencySaturday, October 6, 12
  • 10. Node.js - Been there, done that Event Machines • - Twisted • - EventMachine • - Mina, Netty, Atmosphere, vertx.io • - POE Others • Erlang • Scala / AkkaSaturday, 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 systemsSaturday, October 6, 12
  • 14. Node.js - Industry SupportSaturday, October 6, 12
  • 15. Node.js - Industry UsageSaturday, October 6, 12
  • 16. Node.js - Installation 1. Go to nodejs.org 2. Download and run installerSaturday, 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, dnsSaturday, 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, stunnelSaturday, 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 VersionSaturday, October 6, 12
  • 21. Node.js - Hello World Web - Router VersionSaturday, October 6, 12
  • 22. Node.js - I will call you backSaturday, October 6, 12
  • 23. Node.js - When, thenSaturday, 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
  • 25. Node.js - Modules Module - mymodule.js Client mymodule_client.jsSaturday, October 6, 12
  • 26. Node.js - Modules package.json require(‘mylib’) - Lookup order 1. package.json -> ./lib/mylib.js 2. index.js 3. index.nodeSaturday, October 6, 12
  • 27. Node.js - Logging • console • log4js • Winston • GELF - Graylog Extended Log Format • Windows Event Log ...Saturday, October 6, 12
  • 28. Node.js - Debugging $ 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.comSaturday, October 6, 12
  • 29. Node.js - InspectorSaturday, October 6, 12
  • 30. Node.js - DebuggingSaturday, October 6, 12
  • 31. Node.js - DB / ORM 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-queuesSaturday, October 6, 12
  • 32. Node.js - Web frameworks • Derby • Express • Flatiron • Meteor • Mojito • Tower ... Browserify - Node to Browser conversionSaturday, October 6, 12
  • 33. Node.js - Testing frameworks • assert - built in • API Easy • Cucumber • httpmock, nock, mockery • NodeUnit • Soda ...Saturday, October 6, 12
  • 34. Node.js - Scaling outSaturday, October 6, 12
  • 35. Node.js - Scaling out *Credit: blog.evantahler.comSaturday, 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 supportSaturday, October 6, 12
  • 37. Q &ASaturday, October 6, 12

×