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 full-size slide

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

    View full-size 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 full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  8. Why JavaScript?
    functions as first-class citizen

    View full-size slide

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

    View full-size slide

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

    View full-size 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 full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  15. execution started from first line..
    Output:

    View full-size slide

  16. async operation started…
    Output:

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  19. Event Driven
    Application flow is driven by events

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  26. Thanks,
    @alexbeletsky

    View full-size slide