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

Node.js and Yahoo

Reid Burke
February 10, 2015

Node.js and Yahoo

Node is used at Yahoo for an increasing number of our products and for building, testing, provisioning, and deploying them. Learn about where Yahoo uses Node, why we continue to use Node, and the practices that help us use Node effectively.

Reid Burke

February 10, 2015
Tweet

Other Decks in Technology

Transcript

  1. Node.js
    & Yahoo

    View full-size slide

  2. Node.js
    & Yahoo

    View full-size slide

  3. yahoo.com
    flickr.com

    View full-size slide

  4. CI/CD
    Internal npm registry

    View full-size slide

  5. Yahoo
    & Yahoo devs

    View full-size slide

  6. “...simple, easy-to-
    understand solutions
    that we trust.”
    — Instagram

    View full-size slide

  7. Our products
    are cutting edge

    View full-size slide

  8. Our products
    are cutting edge
    (Not our technology)

    View full-size slide

  9. Node
    Understood and
    tested for years

    View full-size slide

  10. Node
    Used by Yahoo devs

    View full-size slide

  11. Node
    Used by Yahoo devs
    then Yahoo itself

    View full-size slide

  12. Node
    Where do we use it?

    View full-size slide

  13. Node
    Where do we use it?
    For hosted apps

    View full-size slide

  14. Node
    Where do we use it?
    For hosted apps
    and building them

    View full-size slide

  15. Node
    Where do we use it?
    Building
    mobile apps

    View full-size slide

  16. Node
    Where do we use it?
    Building
    websites

    View full-size slide

  17. Node
    Where do we use it?
    Building
    nearly everything

    View full-size slide

  18. Homepage
    My Yahoo
    Flickr
    Advertising
    Video Analytics

    View full-size slide

  19. Internal
    hosting
    platform

    View full-size slide

  20. We use
    Node to
    push Node

    View full-size slide

  21. CI/CD
    What I work on

    View full-size slide

  22. DPS
    What I work on

    View full-size slide

  23. Builds orchestrated
    with Node

    View full-size slide

  24. ynpm install yahoo-ci -g

    View full-size slide

  25. Our Mission
    Everything at Yahoo
    built and deployed
    with Node programs

    View full-size slide

  26. Massive
    Central CI

    View full-size slide

  27. Docker:
    Crazy fast

    View full-size slide

  28. Jenkins
    is terrible

    View full-size slide

  29. Node for build scripts
    Node for build data

    View full-size slide

  30. Node for build scripts
    Node for build data
    Node for deploy APIs

    View full-size slide

  31. We took
    over an
    entire floor

    View full-size slide

  32. Deploy &
    Provision
    APIs

    View full-size slide

  33. Small
    modules

    View full-size slide

  34. require
    (“hapi”)

    View full-size slide

  35. Shared hapi
    plugins for auth,
    routes from RDL,
    metrics…

    View full-size slide

  36. Validate
    with joi

    View full-size slide

  37. jenkins-mocha
    Mocha & Istanbul
    Tests & code coverage
    Puts results where CI expects

    View full-size slide

  38. Publish
    to ynpm

    View full-size slide

  39. Rapid
    iteration

    View full-size slide

  40. Source of truth
    Share modules
    Automate testing
    Pair programming
    Validate your inputs

    View full-size slide

  41. Local utilities
    Cross-platform
    Easy installation

    View full-size slide

  42. Errors &
    Metrics

    View full-size slide

  43. Tagged logs
    Configurable per env
    Easy to search

    View full-size slide

  44. Wrap errors
    Brief user message
    Verbose log message
    Example: verror

    View full-size slide

  45. Unwrapped
    myserver: Error: connect
    ECONNREFUSED

    View full-size slide

  46. Wrapped
    myserver: failed to start up:
    failed to load configuration:
    failed to connect to
    database server: failed to
    connect to 127.0.0.1 port
    1234: connect ECONNREFUSED

    View full-size slide

  47. Example
    var verror = require('verror');
    var err1 = new Error(
    'No such file or directory');
    var err2 = new verror.VError(
    err1, 'failed to stat "%s"', '/junk');
    var err3 = new verror.WError(
    err2, 'request failed');
    reply(err3.message); // simple

    View full-size slide

  48. Example
    var verror = require('verror');
    var err1 = new Error(
    'No such file or directory');
    var err2 = new verror.VError(
    err1, 'failed to stat "%s"', '/junk');
    var err3 = new verror.WError(
    err2, 'request failed');
    console.error(err3.toString()); // verbose

    View full-size slide

  49. Automate build & test
    Validate your inputs
    Wrap errors
    Use delightful tools

    View full-size slide