Going Node At Netflix

1,987
-1

Published on

Slides from my talk "Going Node at Netflix" talk where I talk a bit about how we built a Node.js application at Netflix.

Published in: Engineering, Technology
1 Comment
13 Likes
Statistics
Notes
  • This truly shows the potential that Javascript can bring to the table. At Neev, having worked on diverse JS-based projects, we have realized that Javascript is the technology for the future and needs to be tapped right.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
1,987
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
26
Comments
1
Likes
13
Embeds 0
No embeds

No notes for slide

Going Node At Netflix

  1. 1. Going at
  2. 2. About Me Senior UI Engineer At Netflix! ranklam@netflix.com! @bittersweetryan
  3. 3. The Rest! 44% Facebook BitTorrent iTunes YouTube! 13% Netflix! 34% Peak Downstream Traffic 1H 2014 https://www.sandvine.com/downloads/general/global-internet-phenomena/2014/1h-2014-global-internet-phenomena-report.pdf
  4. 4. "MS Freedom of the Seas in its maiden voyage" by Andres Manuel Rodriguez - We have this Stable
  5. 5. "MS Freedom of the Seas in its maiden voyage" by Andres Manuel Rodriguez - We have this Full Featured
  6. 6. "MS Freedom of the Seas in its maiden voyage" by Andres Manuel Rodriguez - We have this Needs a diverse crew
  7. 7. "MS Freedom of the Seas in its maiden voyage" by Andres Manuel Rodriguez - We have this Not very agile
  8. 8. "Lewis Hamilton 2014 China Race" by emperornie We want this
  9. 9. …but not for the reason you think Modular
  10. 10. …but not for the reason you think Lightweight
  11. 11. …but not for the reason you think Very Agile
  12. 12. Shakti
  13. 13. Why Node?
  14. 14. UI Engineers Write the JavaScript They Love
  15. 15. Node is the New UI Layer Client Node Request Time HTML Post Request HTML Service Calls Client JS Services Build Process
  16. 16. The event loop fits our needs well
  17. 17. The Node Event Loop http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/ function contextMiddleware( req, res, next ){ var movieId = req.params.movieId || 0; movie.fetch( movieId, function( movieData ){ res.set( { movieData : movieData } ) next(); } ); }
  18. 18. The Node Event Loop http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/ function contextMiddleware( req, res, next ){ var movieId = req.params.movieId || 0; movie.fetch( movieId, function( movieData ){ res.set( { movieData : movieData } ) next(); } ); }
  19. 19. The Node Event Loop http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/ function contextMiddleware( req, res, next ){ var movieId = req.params.movieId || 0; movie.fetch( movieId, function( movieData ){ res.set( { movieData : movieData } ) next(); } ); }
  20. 20. The Node Event Loop http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/ function contextMiddleware( req, res, next ){ var movieId = req.params.movieId || 0; movie.fetch( movieId, function( movieData ){ res.set( { movieData : movieData } ) next(); } ); }
  21. 21. Allowed us to remove many runtime dependencies
  22. 22. Shakti was built with a few core principals
  23. 23. Embrace the JavaScript Ecosystem.
  24. 24. Embrace the JavaScript Ecosystem. express web application framework for node
  25. 25. Embrace the JavaScript Ecosystem.
  26. 26. Embrace the JavaScript Ecosystem. {dust}
  27. 27. Embrace the JavaScript Ecosystem.
  28. 28. Use Existing Infrastructure Jasori Lewis
  29. 29. Simple API, Reduce Depencencies http://www.launchphotography.com/Discovery_Flight_Deck.html
  30. 30. http://www.launchphotography.com/Discovery_Flight_Deck.html Simplify By Removing Dependencies
  31. 31. We do have a few unique challenges http://sjmagazine.net/wp-content/uploads/2014/07/NUP_163855_0336.jpg
  32. 32. Assets http://www.wired.com/wp-content/uploads/blogs/wiredenterprise/wp-content/uploads/2012/10/ff_googleinfrastructure_large.jpg
  33. 33. Templating / i18n http://2.bp.blogspot.com/-4KCTn2jSdU0/TlZFNNwofPI/AAAAAAAAFc0/K0ogqSByYlY/s1600/IMG_5947.JPG
  34. 34. Middle Tier Services
  35. 35. Build Process http://3.bp.blogspot.com/-o-LcrSq_w1o/T1ywq9G57gI/AAAAAAAACQU/sRYxh6A6fBA/s1600/P1120378.jpg
  36. 36. Modules http://www.launchphotography.com/Discovery_Flight_Deck.html commonjs
  37. 37. Modules http://www.launchphotography.com/Discovery_Flight_Deck.html es6
  38. 38. Modules http://www.launchphotography.com/Discovery_Flight_Deck.html NPM
  39. 39. We Learned A Few Things On Our Journey http://i.huffpost.com/gen/951056/thumbs/o-CANADA-LIGHT-BULB-BAN-facebook.jpg
  40. 40. Nothing Is Ever Done
  41. 41. Engineers are opinionated creative.
  42. 42. Automate as many things is you can
  43. 43. Allow for diverse inputs, always have predictable outputs
  44. 44. function getLocalizedStrings( arrayOrBundle, key, callback ){ if( arrayOrBundle.isArray() ){ return new Promise( function( resolve, reject ){ //return localized object } ); } else if( typeof arrayOrBundle === ‘string’ ){ return new Promise( function( resolve, reject ){ //return localized object } ); } }
  45. 45. Keep async API’s async
  46. 46. function getLocalizedString( package, key, callback ){ if( this.cache[ package ] && this.cache[ package ][ key ] ){ callback( this.cache[ package ][ key ] ); //not async } else{ this.getString( package, key, callback ); //async call } }
  47. 47. function getLocalizedString( package, key, callback ){ if( this.cache[ package ] && this.cache[ package ][ key ] ){ setTimeout( function( ){ callback( this.cache[ package ][ key ] ); }, 0 ); } else{ this.getString( package, key, callback ); } }
  48. 48. Questions http://eugenebrandt.files.wordpress.com/2013/09/hands-voting.jpg
  49. 49. Thank You! Please stop me in the halls and talk to me about all the cool things Netflix is doing with JavaScript! I love to talk about this stuff! ranklam@netflix.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×