SlideShare une entreprise Scribd logo
1  sur  39
node.js
server of many uses




          Mike Brevoort
   Colorado Springs Open Source Users Group
               23 February 2012
Mike Brevoort
    @mbrevoort

    work at...

(though opinions expressed in this presentation are
    my own and not meant to represent Pearson)
agenda

very brief intro to node.js
a tour of some
“unconventional” uses of
node.js


 * though I don’t particularly like the work conventional
node.js
An Evented I/O network server
for Javascript


       created by   sponsored by
       Ryan Dahl
“Most languages were designed to
solve computational problems, but
      Node.js is different.

   Node.js was designed from the
ground up to efficiently handle the
communication that is at the heart
   of modern web applications.”



                    http://www.joyentcloud.com/products/smart-appliances/
                                    node-js-smartmachine/
generating load
Chris Johnson @mast3rof0
“Mozilla uses a single node
thread to simulate 180K users! I
have commercial testing gear that
can't do that! #nodesummit”
                        - 1/24/2012
https://gist.github.com/1861747
interprocess RPC
DNode             async rpc through
                  sockets/JSON

        symmetric remote function calling

        between processes

        to/from the browser via socket.io

        JSON protocol

        dnode ports in ruby, java, php,
        perl


               https://github.com/substack/dnode
server   client
headless testing
fast headless simulated
zombie.js
            browser testing




    emulation
fast headless simulated
zombie.js
                   browser testing

  HTML5 parsing and        Cookies and Web
  dealing with tag         Storage
  soups
                           XMLHttpRequest in all
  DOM Level 3              its glory
  implementation
                           setTimeout/
  HTML5 form fields        setInterval
  (search, url, etc)
                           pushState, popstate
  CSS3 Selectors with      and hashchange events
  some extensions
                           alert, confirm and
                           prompt
headless WebKit with
         JavaScript API



Fast and native
NOT node.js
But node is commonly used as an
orchestrator
phantomjs-node




   “...implements a nauseously
      clever bridge between
        Phantom and Node”
screenshotting
screenshot-app                   web screenshotting




  curl http://localhost:3000/cnn.com > cnn.png




              https://github.com/visionmedia/screenshot-app
webcrawling
browser APIs or
   fallbacks
node-canvas HTML5 server-side canvas
                 API fallback

     run canvas API calls in node, send
     an image back to the client

     great for some mobile use cases

     legacy browser fallback




          https://github.com/LearnBoost/node-canvas
Deployments
Propagit multi-server git deployment
                        over http
                                                                drone   repos/somerepo.git




                                                                drone   repos/somerepo.git



git push http://hubhost:6001/
       somerepo master                      Hub

                                                                drone   repos/somerepo.git




                                                                drone   repos/somerepo.git




                         https://github.com/substack/propagit
Propagit multi-server git deployment
                          over http
                                                                               deploy/
                                                                  drone   somerepo.ed56c...




propagit deploy --hub=hubhost:6000 --secret=beepboop 
   somerepo ed56c6e85731d412fe22cf437cb63130afc34b07
                                                                               deploy/
                                                                  drone   somerepo.ed56c...



                                              Hub
                                                                               deploy/
                                                                  drone   somerepo.ed56c...




                                                                               deploy/
                                                                  drone   somerepo.ed56c...




                           https://github.com/substack/propagit
Propagit multi-server git deployment
                         over http
                                                                              deploy/
                                                                         somerepo.ed56c...
                                                                 drone
propagit spawn --hub=hubhost:6000 --secret=beepboop 
  somerepo ed56c6e85731d412fe22cf437cb63130afc34b07 
                -- node server.js 8085
                                                                              deploy/
                                                                 drone   somerepo.ed56c...



                                              Hub
                                                                              deploy/
                                                                 drone   somerepo.ed56c...




                                                                              deploy/
                                                                 drone   somerepo.ed56c...




                          https://github.com/substack/propagit
load balancing
Bouncy   programmatic http load
         balancer and router




         https://github.com/substack/bouncy
Bouncy   programmatic http load
         balancer and router




         https://github.com/substack/bouncy
network tracing
node_pcap       libpcap bindings

     decode, print and analyze
     packets
     node makes it very nice since
     each packet is emitted as a
     Buffer by the EventEmitter




            https://github.com/mranney/node_pcap
shell scripting
shell scripting
fs core library - abstract OS or
shell implementation details

can leverage the node module
ecosystem

great if you need to do I/O beyond
filesystem

npm client
fs.watch(filename, [options], listener)
Procstreams pipe-able and composable
                shell scripting in node




          https://github.com/polotek/procstreams
tip of the
           iceberg
Load generation   Browser fallbacks

IPC               Deployment

Testing           Load balancing

Screenshotting    Network tracing

Webcrawling       Shell scripting
Thanks!

Questions?


     Mike Brevoort
     @mbrevoort

Contenu connexe

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

En vedette

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Node.js Server of Many Uses

  • 1. node.js server of many uses Mike Brevoort Colorado Springs Open Source Users Group 23 February 2012
  • 2. Mike Brevoort @mbrevoort work at... (though opinions expressed in this presentation are my own and not meant to represent Pearson)
  • 3. agenda very brief intro to node.js a tour of some “unconventional” uses of node.js * though I don’t particularly like the work conventional
  • 4. node.js An Evented I/O network server for Javascript created by sponsored by Ryan Dahl
  • 5. “Most languages were designed to solve computational problems, but Node.js is different. Node.js was designed from the ground up to efficiently handle the communication that is at the heart of modern web applications.” http://www.joyentcloud.com/products/smart-appliances/ node-js-smartmachine/
  • 7. Chris Johnson @mast3rof0 “Mozilla uses a single node thread to simulate 180K users! I have commercial testing gear that can't do that! #nodesummit” - 1/24/2012
  • 9.
  • 11. DNode async rpc through sockets/JSON symmetric remote function calling between processes to/from the browser via socket.io JSON protocol dnode ports in ruby, java, php, perl https://github.com/substack/dnode
  • 12. server client
  • 14. fast headless simulated zombie.js browser testing emulation
  • 15. fast headless simulated zombie.js browser testing HTML5 parsing and Cookies and Web dealing with tag Storage soups XMLHttpRequest in all DOM Level 3 its glory implementation setTimeout/ HTML5 form fields setInterval (search, url, etc) pushState, popstate CSS3 Selectors with and hashchange events some extensions alert, confirm and prompt
  • 16. headless WebKit with JavaScript API Fast and native NOT node.js But node is commonly used as an orchestrator
  • 17. phantomjs-node “...implements a nauseously clever bridge between Phantom and Node”
  • 19. screenshot-app web screenshotting curl http://localhost:3000/cnn.com > cnn.png https://github.com/visionmedia/screenshot-app
  • 21.
  • 22.
  • 23. browser APIs or fallbacks
  • 24. node-canvas HTML5 server-side canvas API fallback run canvas API calls in node, send an image back to the client great for some mobile use cases legacy browser fallback https://github.com/LearnBoost/node-canvas
  • 26. Propagit multi-server git deployment over http drone repos/somerepo.git drone repos/somerepo.git git push http://hubhost:6001/ somerepo master Hub drone repos/somerepo.git drone repos/somerepo.git https://github.com/substack/propagit
  • 27. Propagit multi-server git deployment over http deploy/ drone somerepo.ed56c... propagit deploy --hub=hubhost:6000 --secret=beepboop somerepo ed56c6e85731d412fe22cf437cb63130afc34b07 deploy/ drone somerepo.ed56c... Hub deploy/ drone somerepo.ed56c... deploy/ drone somerepo.ed56c... https://github.com/substack/propagit
  • 28. Propagit multi-server git deployment over http deploy/ somerepo.ed56c... drone propagit spawn --hub=hubhost:6000 --secret=beepboop somerepo ed56c6e85731d412fe22cf437cb63130afc34b07 -- node server.js 8085 deploy/ drone somerepo.ed56c... Hub deploy/ drone somerepo.ed56c... deploy/ drone somerepo.ed56c... https://github.com/substack/propagit
  • 30. Bouncy programmatic http load balancer and router https://github.com/substack/bouncy
  • 31. Bouncy programmatic http load balancer and router https://github.com/substack/bouncy
  • 33. node_pcap libpcap bindings decode, print and analyze packets node makes it very nice since each packet is emitted as a Buffer by the EventEmitter https://github.com/mranney/node_pcap
  • 35. shell scripting fs core library - abstract OS or shell implementation details can leverage the node module ecosystem great if you need to do I/O beyond filesystem npm client
  • 37. Procstreams pipe-able and composable shell scripting in node https://github.com/polotek/procstreams
  • 38. tip of the iceberg Load generation Browser fallbacks IPC Deployment Testing Load balancing Screenshotting Network tracing Webcrawling Shell scripting
  • 39. Thanks! Questions? Mike Brevoort @mbrevoort

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. node is like a project manager\n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n