SlideShare une entreprise Scribd logo
1  sur  37
Node.js, toy or power tool?
                            Jax CodeCamp, Oct 2012

                                 Ovidiu Dimulescu




Saturday, October 6, 12
Agenda
                      •   What problem?
                      •   How’s Node.js helping?
                      •   Use cases
                      •   Industry support
                      •   Coding in Node.js
                      •   Ecosystem
                      •   Q &A




Saturday, October 6, 12
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
Node.js - What’s the problem?
        Fast CPUs Spinning wheels




        How do we saturate the CPU doing useful work?

Saturday, October 6, 12
Node.js - How’s it helping?




                          • Uses event-driven, non-blocking IO
                          • Enforces async throughout*




Saturday, October 6, 12
Multi-Threaded Servers




       *Credit: blog.cloudfoundry.com

Saturday, October 6, 12
Node.js - Single Thread, Event-ed




       *Credit: blog.cloudfoundry.com

Saturday, October 6, 12
Node.js - Concurrency

                          Node.js Event Loop


              Rq1                              Rq1

              Rq2                              Rq2


              Green - Request Executing
              Red - IO wait


Saturday, October 6, 12
Node.js - Concurrency

                          Thread

                          Node.js

                                    Higher Concurrency
                                    Same Latency




Saturday, October 6, 12
Node.js - Been there, done that
         Event Machines
              •           - Twisted
              •           - EventMachine
              •           - Mina, Netty, Atmosphere, vertx.io
              •           - POE


         Others
              • Erlang
              • Scala / Akka



Saturday, October 6, 12
Node.js - But ...




                          They mix async with sync and the mentality is
                          towards sync in libraries, drivers etc.




Saturday, October 6, 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
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
Node.js - Industry Support




Saturday, October 6, 12
Node.js - Industry Usage




Saturday, October 6, 12
Node.js - Installation



                          1. Go to nodejs.org
                          2. Download and run installer




Saturday, October 6, 12
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
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
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
Node.js - Hello World
         CLI Version - helloworld.js
              console.log(“Hello world”);
              $ node helloworld.js
              Hello World

         Web Version




Saturday, October 6, 12
Node.js - Hello World
         Web - Router Version




Saturday, October 6, 12
Node.js - I will call you back




Saturday, October 6, 12
Node.js - When, then




Saturday, October 6, 12
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
Node.js - Modules
         Module - mymodule.js




         Client mymodule_client.js




Saturday, October 6, 12
Node.js - Modules

        package.json




        require(‘mylib’) - Lookup order

               1. package.json -> ./lib/mylib.js

               2. index.js

               3. index.node




Saturday, October 6, 12
Node.js - Logging
              •     console
              •     log4js
              •     Winston
              •     GELF - Graylog Extended Log Format
              •     Windows Event Log
              ...




Saturday, October 6, 12
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.com



Saturday, October 6, 12
Node.js - Inspector




Saturday, October 6, 12
Node.js - Debugging




Saturday, October 6, 12
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-queues




Saturday, October 6, 12
Node.js - Web frameworks
              •      Derby
              •      Express
              •      Flatiron
              •      Meteor
              •      Mojito
              •      Tower
               ...
         Browserify - Node to Browser conversion




Saturday, October 6, 12
Node.js - Testing frameworks
              •      assert - built in
              •      API Easy
              •      Cucumber
              •      httpmock, nock, mockery
              •      NodeUnit
              •      Soda
               ...




Saturday, October 6, 12
Node.js - Scaling out




Saturday, October 6, 12
Node.js - Scaling out




     *Credit: blog.evantahler.com



Saturday, October 6, 12
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
Q &A




Saturday, October 6, 12

Contenu connexe

Tendances

vert.x - asynchronous event-driven web applications on the JVM
vert.x - asynchronous event-driven web applications on the JVMvert.x - asynchronous event-driven web applications on the JVM
vert.x - asynchronous event-driven web applications on the JVMjbandi
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleDmytro Semenov
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...Edureka!
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...Edureka!
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event LoopTorontoNodeJS
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureColin Mackay
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Ganesh Kondal
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 
Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?Maciej Lasyk
 
Real World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xReal World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xSascha Möllering
 
Development with Vert.x: an event-driven application framework for the JVM
Development with Vert.x: an event-driven application framework for the JVMDevelopment with Vert.x: an event-driven application framework for the JVM
Development with Vert.x: an event-driven application framework for the JVMDavid Wu
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Tomer Gabel
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and ActivatorKevin Webber
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.jsDinesh U
 

Tendances (20)

vert.x - asynchronous event-driven web applications on the JVM
vert.x - asynchronous event-driven web applications on the JVMvert.x - asynchronous event-driven web applications on the JVM
vert.x - asynchronous event-driven web applications on the JVM
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
 
Understanding the Single Thread Event Loop
Understanding the Single Thread Event LoopUnderstanding the Single Thread Event Loop
Understanding the Single Thread Event Loop
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6Tech io nodejs_20130531_v0.6
Tech io nodejs_20130531_v0.6
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 
Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
Real World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.xReal World Enterprise Reactive Programming using Vert.x
Real World Enterprise Reactive Programming using Vert.x
 
Development with Vert.x: an event-driven application framework for the JVM
Development with Vert.x: an event-driven application framework for the JVMDevelopment with Vert.x: an event-driven application framework for the JVM
Development with Vert.x: an event-driven application framework for the JVM
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)Nashorn: JavaScript that doesn’t suck (ILJUG)
Nashorn: JavaScript that doesn’t suck (ILJUG)
 
Play Framework and Activator
Play Framework and ActivatorPlay Framework and Activator
Play Framework and Activator
 
Node js internal
Node js internalNode js internal
Node js internal
 
Vert.x
Vert.xVert.x
Vert.x
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 

Similaire à Node.js, toy or power tool?

Offience's Node showcase
Offience's Node showcaseOffience's Node showcase
Offience's Node showcasecloud4le
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.jsKhalid Farhan
 
OpenSky Infrastructure
OpenSky InfrastructureOpenSky Infrastructure
OpenSky InfrastructureJonathan Wage
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
Building A Scalable Open Source Storage Solution
Building A Scalable Open Source Storage SolutionBuilding A Scalable Open Source Storage Solution
Building A Scalable Open Source Storage SolutionPhil Cryer
 
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...Alexandre Morgaut
 
Node js实践
Node js实践Node js实践
Node js实践jay li
 
Introduction to Napa.js
Introduction to Napa.jsIntroduction to Napa.js
Introduction to Napa.jsDaiyi Peng
 
NDH2k12 Cloud Computing Security
NDH2k12 Cloud Computing SecurityNDH2k12 Cloud Computing Security
NDH2k12 Cloud Computing SecurityMatthieu Bouthors
 
Distributed Fuzzing Framework Design
Distributed Fuzzing Framework DesignDistributed Fuzzing Framework Design
Distributed Fuzzing Framework Designbannedit
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
Openstack In Real Life
Openstack In Real LifeOpenstack In Real Life
Openstack In Real LifePaul Guth
 
Cloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesCloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesRyan Koop
 
Cloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloudCamp Chicago
 
Apereo OAE - Architectural overview
Apereo OAE - Architectural overviewApereo OAE - Architectural overview
Apereo OAE - Architectural overviewNicolaas Matthijs
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJSJITENDRA KUMAR PATEL
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.jsJames Carr
 

Similaire à Node.js, toy or power tool? (20)

Offience's Node showcase
Offience's Node showcaseOffience's Node showcase
Offience's Node showcase
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.js
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
 
OpenSky Infrastructure
OpenSky InfrastructureOpenSky Infrastructure
OpenSky Infrastructure
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
Building A Scalable Open Source Storage Solution
Building A Scalable Open Source Storage SolutionBuilding A Scalable Open Source Storage Solution
Building A Scalable Open Source Storage Solution
 
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
State of the art: Server-Side JavaScript - WebWorkersCamp IV - Open World For...
 
HTML5, are we there yet?
HTML5, are we there yet?HTML5, are we there yet?
HTML5, are we there yet?
 
Node js实践
Node js实践Node js实践
Node js实践
 
Introduction to Napa.js
Introduction to Napa.jsIntroduction to Napa.js
Introduction to Napa.js
 
NDH2k12 Cloud Computing Security
NDH2k12 Cloud Computing SecurityNDH2k12 Cloud Computing Security
NDH2k12 Cloud Computing Security
 
Distributed Fuzzing Framework Design
Distributed Fuzzing Framework DesignDistributed Fuzzing Framework Design
Distributed Fuzzing Framework Design
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
Openstack In Real Life
Openstack In Real LifeOpenstack In Real Life
Openstack In Real Life
 
Cloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesCloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 Slides
 
Cloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentations
 
Apereo OAE - Architectural overview
Apereo OAE - Architectural overviewApereo OAE - Architectural overview
Apereo OAE - Architectural overview
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Intro to Node.js
Intro to Node.jsIntro to Node.js
Intro to Node.js
 

Plus de Ovidiu Dimulescu

Plus de Ovidiu Dimulescu (9)

Microservices - Yet another buzzword
Microservices - Yet another buzzwordMicroservices - Yet another buzzword
Microservices - Yet another buzzword
 
Journeyman to Master
Journeyman to MasterJourneyman to Master
Journeyman to Master
 
The Rise of DevOps
The Rise of DevOpsThe Rise of DevOps
The Rise of DevOps
 
Hadoop on Azure, Blue elephants
Hadoop on Azure,  Blue elephantsHadoop on Azure,  Blue elephants
Hadoop on Azure, Blue elephants
 
Git for Windows
Git for WindowsGit for Windows
Git for Windows
 
Hadoop, Taming Elephants
Hadoop, Taming ElephantsHadoop, Taming Elephants
Hadoop, Taming Elephants
 
Introduction to Hadoop
Introduction to HadoopIntroduction to Hadoop
Introduction to Hadoop
 
Git SVN Migrate Reasons
Git SVN Migrate ReasonsGit SVN Migrate Reasons
Git SVN Migrate Reasons
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 

Dernier

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Dernier (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

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
  • 6. Multi-Threaded Servers *Credit: blog.cloudfoundry.com Saturday, October 6, 12
  • 7. Node.js - Single Thread, Event-ed *Credit: blog.cloudfoundry.com Saturday, October 6, 12
  • 8. Node.js - Concurrency Node.js Event Loop Rq1 Rq1 Rq2 Rq2 Green - Request Executing Red - IO wait Saturday, October 6, 12
  • 9. Node.js - Concurrency Thread Node.js Higher Concurrency Same Latency Saturday, October 6, 12
  • 10. Node.js - Been there, done that Event Machines • - Twisted • - EventMachine • - Mina, Netty, Atmosphere, vertx.io • - POE Others • Erlang • Scala / Akka 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
  • 14. Node.js - Industry Support Saturday, October 6, 12
  • 15. Node.js - Industry Usage 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
  • 23. Node.js - When, then 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
  • 25. Node.js - Modules Module - mymodule.js Client mymodule_client.js Saturday, October 6, 12
  • 26. Node.js - Modules package.json require(‘mylib’) - Lookup order 1. package.json -> ./lib/mylib.js 2. index.js 3. index.node Saturday, 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.com Saturday, 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-queues Saturday, October 6, 12
  • 32. Node.js - Web frameworks • Derby • Express • Flatiron • Meteor • Mojito • Tower ... Browserify - Node to Browser conversion Saturday, 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 out 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