Yahoo! scale Node.js
        @Fabian_Frank
     <fabian@pagefault.de>




     The Yahoo! Axis Team
     http://axis.yahoo.com
Challenges

• Being able to share code (across
  applications)
• Dynamic configuration, per environment
• Stability and performance
Code re-use

• Different applications (teams), same
  problems


• Potential side effects, e.g. through
  unexpected updates
npm

• Package manager for Node.js packages
• resolves dependencies automatically
• hosts packages in a central registry
Mojito and npm

• Every Mojito application can specify its
  dependencies in package.json


• Mojito probes node_modules/, when
  loading Mojito resources


      http://developer.yahoo.com/cocktails/mojito/docs/topics/mojito_npm.html
Mojito resource

• YUI Module

• Mojito add-on

• Mojit (views, a controller, models)
npm dependencies
"dependencies": {
    "mojito": "=0.3.26",
    "mojito-shaker": "~0.7.5",
    "yui": ">=3.5.1"
}


$ npm shrinkwrap
               http://npmjs.org/doc/shrinkwrap.html
Internal npm
• Only the build system can publish packages

• Packages are published only after unit and
  functional tests passed


• immutable packages
Dynamic configuration
• Change application behavior without
  redeployment


• JSON is a common way to express
  configuration in JavaScript applications


• YQL Storage holds JSON
         http://developer.yahoo.com/yql/guide/yql-cloud-chapter.html
Configuration through YQL




        http://developer.yahoo.com/yql/console/
Node.js 0.6

• transparent change for Mojito users

• important fixes and improvements in HTTP
  and DNS
YUI 3.5

• officially supports Node.js
• removed jsdom dependency
• Y.io uses request as transport layer

     http://yuilibrary.com/yui/docs/yui/nodejs.html https://github.com/mikeal/request
Node.js 0.8
Performance




http://www.slideshare.net/FabianFrankDe/nodejs-performance-case-study
Performance

• Mojito&Manhattan compared to
  Apache&PHP
• CPU bound
• found that Manhattan can serve twice the
  amount of requests at half the latency
Performance
Stability
• Yahoo! Axis is served using Mojito and
  Manhattan
• Hundreds of requests per second
• Static HTML and CSS, dynamic pages,
  API entry points
• Monitoring
Building and Maintenance

   • Need to know only one language and
         framework, no context switches.
   • Allows to postpone design decisions
   • Easier to revert design decisions
   • Easier deployment and resource allocation

http://developer.yahoo.com/blogs/ydn/posts/2011/11/yahoo-announces-cocktails-%E2%80%93-shaken-not-stirred/
Conclusion

• Mojito works for our computers

• Mojito works for us, as engineers
Thank you!

• Fabio Hirata, @fabiohh
• Caridy Patiño, @caridy
• Eugene Kashida, @ekashida
• Fabian Frank, @Fabian_Frank

Yahoo! scale Node.js

  • 1.
    Yahoo! scale Node.js @Fabian_Frank <fabian@pagefault.de> The Yahoo! Axis Team http://axis.yahoo.com
  • 2.
    Challenges • Being ableto share code (across applications) • Dynamic configuration, per environment • Stability and performance
  • 3.
    Code re-use • Differentapplications (teams), same problems • Potential side effects, e.g. through unexpected updates
  • 4.
    npm • Package managerfor Node.js packages • resolves dependencies automatically • hosts packages in a central registry
  • 5.
    Mojito and npm •Every Mojito application can specify its dependencies in package.json • Mojito probes node_modules/, when loading Mojito resources http://developer.yahoo.com/cocktails/mojito/docs/topics/mojito_npm.html
  • 6.
    Mojito resource • YUIModule • Mojito add-on • Mojit (views, a controller, models)
  • 7.
    npm dependencies "dependencies": { "mojito": "=0.3.26", "mojito-shaker": "~0.7.5", "yui": ">=3.5.1" } $ npm shrinkwrap http://npmjs.org/doc/shrinkwrap.html
  • 8.
    Internal npm • Onlythe build system can publish packages • Packages are published only after unit and functional tests passed • immutable packages
  • 9.
    Dynamic configuration • Changeapplication behavior without redeployment • JSON is a common way to express configuration in JavaScript applications • YQL Storage holds JSON http://developer.yahoo.com/yql/guide/yql-cloud-chapter.html
  • 10.
    Configuration through YQL http://developer.yahoo.com/yql/console/
  • 11.
    Node.js 0.6 • transparentchange for Mojito users • important fixes and improvements in HTTP and DNS
  • 12.
    YUI 3.5 • officiallysupports Node.js • removed jsdom dependency • Y.io uses request as transport layer http://yuilibrary.com/yui/docs/yui/nodejs.html https://github.com/mikeal/request
  • 13.
  • 14.
  • 15.
    Performance • Mojito&Manhattan comparedto Apache&PHP • CPU bound • found that Manhattan can serve twice the amount of requests at half the latency
  • 16.
  • 17.
    Stability • Yahoo! Axisis served using Mojito and Manhattan • Hundreds of requests per second • Static HTML and CSS, dynamic pages, API entry points • Monitoring
  • 18.
    Building and Maintenance • Need to know only one language and framework, no context switches. • Allows to postpone design decisions • Easier to revert design decisions • Easier deployment and resource allocation http://developer.yahoo.com/blogs/ydn/posts/2011/11/yahoo-announces-cocktails-%E2%80%93-shaken-not-stirred/
  • 19.
    Conclusion • Mojito worksfor our computers • Mojito works for us, as engineers
  • 20.
    Thank you! • FabioHirata, @fabiohh • Caridy Patiño, @caridy • Eugene Kashida, @ekashida • Fabian Frank, @Fabian_Frank

Editor's Notes