Upgrade to Pro — share decks privately, control downloads, hide ads and more …

This is Node.js

This is Node.js

The talk I gave on UA Dev Club, 8-Jul-2014

Alexander Beletsky

July 09, 2014
Tweet

More Decks by Alexander Beletsky

Other Decks in Programming

Transcript

  1. This is
    Node.js

    View Slide

  2. [email protected]
    http://beletsky.net
    http://twitter.com/alexbeletsky

    View Slide

  3. "I was concerned about the ability to
    program advanced push features into
    the website like I had seen in Gmail"
    Ryan Dahl
    the creator of Node.js

    View Slide

  4. V8
    Google's open source JavaScript engine.
    V8 can run standalone, or can be embedded into any C++ application.

    View Slide

  5. LibUV
    High performance evented I/O
    Originally based on LibEV switch to LibUV with support of Windows

    View Slide

  6. JavaScript
    Dynamic, prototype-based language
    Highly popular due to browser programming

    View Slide

  7. http://jsconf.eu/2009/speakers.html

    View Slide

  8. Why JavaScript?
    functions as first-class citizen

    View Slide

  9. Why JavaScript?
    function as first-class citizen
    //closures..

    View Slide

  10. JavaScript designed for event-oriented systems
    There was a natural fit V8 + LibEV + JavaScript

    View Slide

  11. “Node.js is a platform for easily building
    scalable network applications. Node.js
    uses an event-driven (single threaded),
    non-blocking I/O model that makes it
    lightweight and efficient…”
    http://nodejs.org

    View Slide

  12. Non Blocking I/O
    The concept of accessing I/O without blocking of application

    View Slide

  13. https://www.flickr.com/photos/papyrist/
    Line to ATM is blocking I/O

    View Slide

  14. Mac’s Drive is non-blocking I/O

    View Slide

  15. View Slide

  16. execution started from first line..
    Output:

    View Slide

  17. async operation started…
    Output:

    View Slide

  18. but execution goes on..
    > ping
    Output:

    View Slide

  19. after ~ms file is read…
    > ping
    > pong
    Output:

    View Slide

  20. Event Driven
    Application flow is driven by events

    View Slide

  21. http://misclassblog.com/interactive-web-development/node-js/

    View Slide

  22. Single Threaded
    Single-thread programming concepts is more easy to understand. Applications
    running in single thread are lightweight and efficient

    View Slide

  23. “Node.js is designed for
    building efficient
    networking applications”

    View Slide

  24. Core components:
    !
    • HTTP / HTTPS
    • TCP / UDP / Sockets
    • DNS
    • File System
    • Crypto / Arch
    • Events
    • Streams

    View Slide

  25. Efficiency & Scalability
    Build-in server, high concurrency, horizontal scalability, clustering

    View Slide

  26. NPM
    Node Package Manager - the richest collection of high quality open source
    modules

    View Slide

  27. View Slide

  28. Thanks,
    @alexbeletsky

    View Slide