Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Netflix API

2,123 views

Published on

This

Published in: Technology, Business
  • Be the first to comment

Netflix API

  1. 1. djacobson@netflix.com@daniel_jacobsonhttp://www.linkedin.com/in/danieljacobsonhttp://www.slideshare.net/danieljacobsonDaniel JacobsonDirector of Engineering, Netflix API
  2. 2. There are comments on eachslide in the Notes field belowproviding the full context ofthis presentation
  3. 3. Techniques for Scaling the Netflix APIAgenda• Intro to Netflix• History and Future of the Netflix API• The Cloud• Deployment and Testing• Resiliency
  4. 4. Techniques for Scaling the Netflix APIAgenda• Intro to Netflix• History and Future of the Netflix API• The Cloud• Development and Testing• Resiliency
  5. 5. Build the Best Global Streaming Product
  6. 6. More than 36 Million SubscribersMore than 50 Countries & Territories
  7. 7. Netflix Accounts for 33% of PeakInternet Traffic in North AmericaNetflix subscribers are watching more than 1 billion hours a month
  8. 8. Coming to Netflix on May 26th
  9. 9. 1,000+ DifferentDevice Types
  10. 10. Build the Best Global Streaming ProductTwo aspects of the Streaming Product:• Discovery• Streaming
  11. 11. Discovery
  12. 12. Discovery
  13. 13. Streaming
  14. 14. Netflix API Powers Discovery
  15. 15. Techniques for Scaling the Netflix APIAgenda• Intro into Netflix• History and Future of the Netflix API• The Cloud• Development and Testing• Resiliency
  16. 16. 2007
  17. 17. Netflix REST API:One-Size-Fits-All Solution
  18. 18. Netflix API Requests by AudienceAt Launch In 2008ExternalDevelopers
  19. 19. Netflix API Requests by AudienceFrom 2011ExternalDevelopers
  20. 20. 1000+ Device Types
  21. 21. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesReviewsA/B TestEngineDozens of Dependencies
  22. 22. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  23. 23. Change in Audience = Change in Design
  24. 24. Redesign: Areas of Focus• Chattiness• Variability Across Devices• Innovation Rates
  25. 25. Chattiness
  26. 26. Growth of Netflix API Requests0.620.741.7-51015202530354045Jan-10 Jan-11 Jan-12RequestinBillions70x growth in two years!
  27. 27. Growth of the Netflix API2 billion requests per dayExploding out to 14 billion dependency calls per day
  28. 28. <catalog_titles><number_of_results>1140</number_of_results><start_index>0</start_index><results_per_page>10</results_per_page><catalog_title><id>http://api.netflix.com/catalog/titles/movies/60021896</id><title short="Star" regular="Star"></title><box_art small="http://alien2.netflix.com/us/boxshots/tiny/60021896.jpg"medium="http://alien2.netflix.com/us/boxshots/small/60021896.jpg"large="http://alien2.netflix.com/us/boxshots/large/60021896.jpg"></box_art><link href="http://api.netflix.com/catalog/titles/movies/60021896/synopsis"rel="http://schemas.netflix.com/catalog/titles/synopsis" title="synopsis"></link><release_year>2001</release_year><category scheme="http://api.netflix.com/catalog/titles/mpaa_ratings" label="NR"></category><category scheme="http://api.netflix.com/categories/genres" label="Foreign"></category><link href="http://api.netflix.com/catalog/titles/movies/60021896/cast"rel="http://schemas.netflix.com/catalog/people.cast" title="cast"></link><link href="http://api.netflix.com/catalog/titles/movies/60021896/screen_formats" rel="http://schemas.netflix.com/catalog/titles/screen_formats" title="screenformats"></link<link href="http://api.netflix.com/catalog/titles/movies/60021896/languages_and_audio" rel="http://schemas.netflix.com/catalog/titles/languages_and_audio"title="languages and audio"></link><average_rating>1.9</average_rating><link href="http://api.netflix.com/catalog/titles/movies/60021896/similars" rel="http://schemas.netflix.com/catalog/titles.similars" title="similars"></link><link href="http://www.netflix.com/Movie/Star/60021896" rel="alternate" title="webpage"></link></catalog_title><catalog_title><id>http://api.netflix.com/catalog/titles/movies/17985448</id><title short="Lone Star" regular="Lone Star"></title><box_art small="http://alien2.netflix.com/us/boxshots/tiny/17985448.jpg" medium="http://alien2.netflix.com/us/boxshots/small/17985448.jpg" large=""></box_art><link href="http://api.netflix.com/catalog/titles/movies/17985448/synopsis" rel="http://schemas.netflix.com/catalog/titles/synopsis" title="synopsis"></link><release_year>1996</release_year><category scheme="http://api.netflix.com/catalog/titles/mpaa_ratings" label="R"></category><category scheme="http://api.netflix.com/categories/genres" label="Drama"></category><link href="http://api.netflix.com/catalog/titles/movies/17985448/awards" rel="http://schemas.netflix.com/catalog/titles/awards" title="awards"></link><link href="http://api.netflix.com/catalog/titles/movies/17985448/format_availability" rel="http://schemas.netflix.com/catalog/titles/format_availability"title="formats"></link><link href="http://api.netflix.com/catalog/titles/movies/17985448/screen_formats" rel="http://schemas.netflix.com/catalog/titles/screen_formats" title="screenformats"></link><link href="http://api.netflix.com/catalog/titles/movies/17985448/languages_and_audio" rel="http://schemas.netflix.com/catalog/titles/languages_and_audio"title="languages and audio"></link><average_rating>3.7</average_rating><link href="http://api.netflix.com/catalog/titles/movies/17985448/previews" rel="http://schemas.netflix.com/catalog/titles/previews" title="previews"></link><link href="http://api.netflix.com/catalog/titles/movies/17985448/similars" rel="http://schemas.netflix.com/catalog/titles.similars" title="similars"></link><link href="http://www.netflix.com/Movie/Lone_Star/17985448" rel="alternate" title="webpage"></link></catalog_title></catalog_titles>
  29. 29. {"catalog_title":{"id":"http://api.netflix.com/catalog/titles/movies/60034967","title":{"title_short":"Rosencrantz and Guildenstern Are Dead","regular":"Rosencrantz and Guildenstern Are Dead"},"maturity_level":60,"release_year":"1990","average_rating":3.7,"box_art":{"284pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/ghd/60034967.jpg","110pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/large/60034967.jpg","38pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/tiny/60034967.jpg","64pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/small/60034967.jpg","150pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/150/60034967.jpg","88pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/88/60034967.jpg","124pix_w":"http://cdn-7.nflximg.com/en_US/boxshots/124/60034967.jpg"},"language":"en","web_page":"http://www.netflix.com/Movie/Rosencrantz_and_Guildenstern_Are_Dead/60034967","tiny_url":"http://movi.es/ApUP9"},"meta":{"expand":["@directors","@bonus_materials","@cast","@awards","@short_synopsis","@synopsis","@box_art","@screen_formats","@"links":{"id":"http://api.netflix.com/catalog/titles/movies/60034967","languages_and_audio":"http://api.netflix.com/catalog/titles/movies/60034967/languages_and_audio","title":"http://api.netflix.com/catalog/titles/movies/60034967/title","screen_formats":"http://api.netflix.com/catalog/titles/movies/60034967/screen_formats","cast":"http://api.netflix.com/catalog/titles/movies/60034967/cast","awards":"http://api.netflix.com/catalog/titles/movies/60034967/awards","short_synopsis":"http://api.netflix.com/catalog/titles/movies/60034967/short_synopsis","box_art":"http://api.netflix.com/catalog/titles/movies/60034967/box_art","synopsis":"http://api.netflix.com/catalog/titles/movies/60034967/synopsis","directors":"http://api.netflix.com/catalog/titles/movies/60034967/directors","similars":"http://api.netflix.com/catalog/titles/movies/60034967/similars","format_availability":"http://api.netflix.com/catalog/titles/movies/60034967/format_availability"}}}
  30. 30. Improve Efficiency of API RequestsCould it have been 300 million requests per day? Or less?(Assuming everything else remained the same)
  31. 31. Variability Across Devices
  32. 32. Screen Real Estate
  33. 33. Controller
  34. 34. Technical Capabilities
  35. 35. Innovation Rates
  36. 36. One-Size-Fits-AllAPIRequestRequestRequest
  37. 37. Our Solution…
  38. 38. Move away from theOne-Size-Fits-All API model
  39. 39. Resource-Based APIvs.Experience-Based API
  40. 40. Resource-Based Requests• /users/<id>/ratings/title• /users/<id>/queues• /users/<id>/queues/instant• /users/<id>/recommendations• /catalog/titles/movie• /catalog/titles/series• /catalog/people
  41. 41. OSFA APIRECOMMENDATIONSMOVIEDATASIMILARMOVIESAUTHMEMBERDATAA/BTESTSSTART-UPRATINGSNetwork Border Network Border
  42. 42. RECOMMENDATIONSMOVIEDATASIMILARMOVIESAUTHMEMBERDATAA/BTESTSSTART-UPRATINGSOSFA APINetwork Border Network BorderSERVER CODECLIENT CODE
  43. 43. RECOMMENDATIONSMOVIEDATASIMILARMOVIESAUTHMEMBERDATAA/BTESTSSTART-UPRATINGSOSFA APINetwork Border Network BorderDATA GATHERING,FORMATTING,AND DELIVERYUSER INTERFACERENDERING
  44. 44. Experience-Based Requests• /ps3/homescreen
  45. 45. JAVA APINetwork Border Network BorderRECOMMENDATIONSMOVIEDATASIMILARMOVIESAUTHMEMBERDATAA/BTESTSSTART-UPRATINGSGroovy Layer
  46. 46. RECOMMENDATIONSAZXSXX CCCCMOVIEDATASIMILARMOVIESAUTHMEMBERDATAA/BTESTSSTART-UPRATINGSJAVA APISERVER CODECLIENT CODECLIENT ADAPTER CODE(WRITTEN BY CLIENT TEAMS, DYNAMICALLY UPLOADED TO SERVER)Network Border Network Border
  47. 47. RECOMMENDATIONSAZXSXX CCCCMOVIEDATASIMILARMOVIESAUTHMEMBERDATAA/BTESTSSTART-UPRATINGSJAVA APIDATA GATHERINGDATA FORMATTINGAND DELIVERYUSER INTERFACERENDERINGNetwork Border Network Border
  48. 48. Techniques for Scaling the Netflix APIAgenda• Intro to Netflix• History and Future of the Netflix API• The Cloud• Development and Testing• Resiliency
  49. 49. AWS Cloud
  50. 50. Autoscaling
  51. 51. Autoscaling
  52. 52. Autoscaling
  53. 53. Techniques for Scaling the Netflix APIAgenda• Intro to Netflix• History and Future of the Netflix API• The Cloud• Development and Testing• Resiliency
  54. 54. Development / TestingPhilosophyAct fast, react fast
  55. 55. That Doesn’t Mean We Don’t Test• Unit tests• Functional tests• Regression scripts• Continuous integration• Capacity planning• Load / Performance tests
  56. 56. Cloud-Based Deployment Techniques
  57. 57. Current CodeIn ProductionAPI Requests fromthe Internet
  58. 58. Current CodeIn ProductionAPI Requests fromthe InternetSingle Canary InstanceTo Test New Code with Production Traffic(around 1% or less of traffic)Error!
  59. 59. Current CodeIn ProductionAPI Requests fromthe Internet
  60. 60. Current CodeIn ProductionAPI Requests fromthe InternetSingle Canary InstanceTo Test New Code with Production Traffic(around 1% or less of traffic)Perfect!
  61. 61. Current CodeIn ProductionNew CodeGetting Prepared for ProductionAPI Requests fromthe Internet
  62. 62. Old CodePrepared For RollbackCurrent CodeIn ProductionAPI Requests fromthe InternetError!
  63. 63. Old CodeRolled Back into ProductionNew CodeOut of ProductionAPI Requests fromthe Internet
  64. 64. Current CodeIn ProductionAPI Requests fromthe InternetPerfect!
  65. 65. Current CodeIn ProductionNew CodeGetting Prepared for ProductionAPI Requests fromthe Internet
  66. 66. Old CodePrepared For RollbackCurrent CodeIn ProductionAPI Requests fromthe Internet
  67. 67. Current CodeIn ProductionAPI Requests fromthe Internet
  68. 68. Techniques for Scaling the Netflix APIAgenda• Intro into Netflix• History and Future of the Netflix API• The Cloud• Development and Testing• Resiliency
  69. 69. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  70. 70. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  71. 71. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  72. 72. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  73. 73. Circuit Breaker Dashboard & Turbine(also open sourced on GitHub)
  74. 74. Call Volume and Health / Last 10 Seconds
  75. 75. Call Volume / Last 2 Minutes
  76. 76. Successful Requests
  77. 77. Successful, But Slower Than Expected
  78. 78. Short-Circuited Requests, Delivering Fallbacks
  79. 79. Timeouts, Delivering Fallbacks
  80. 80. Thread Pool & Task Queue Full, Delivering Fallbacks
  81. 81. Exceptions, Delivering Fallbacks
  82. 82. Error Rate# + # + # + # / (# + # + # + # + #) = Error Rate
  83. 83. Status of Fallback Circuit
  84. 84. Requests per Second, Over Last 10 Seconds
  85. 85. SLA Information
  86. 86. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  87. 87. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  88. 88. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngine
  89. 89. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngineFallback
  90. 90. PersonalizationEngineUser InfoMovieMetadataMovieRatingsSimilarMoviesAPIReviewsA/B TestEngineFallback
  91. 91. One Last Point…
  92. 92. http://www.netflix.com/jobs
  93. 93. Feel free to contact me at:djacobson@netflix.com@daniel_jacobsonhttp://www.linkedin.com/in/danieljacobsonhttp://www.slideshare.net/danieljacobson

×