Netflix API - Separation of Concerns

8,496 views

Published on

Most API providers focus on solving all three of the key challenges for APIs: data gathering, data formatting and data delivery. All three of these functions are critical for the success of an API, however, not all should be solved by the API provider. Rather, the API consumers have a strong, vested interest in the formatting and delivery. As a result, API design should be addressed based on the true separation of concerns between the needs of the API provider and the various API consumers.

This presentation goes into the separation of concerns. It also goes into depth in how Netflix has solved for this problem through a very different approach to API design.

This presentation was given at the following API Meetup in SF:

http://www.meetup.com/API-Meetup/events/171255242/

Published in: Technology, Education
  • Api is a separation of concern within the application but as the api call flow extends out to the architecture to request tooling and response tooling, you have a shared cross cutting concern.

    Naturally you can't have a separation of concern in the application and a shared concern in external tooling... this is contradictory. You need to abstract functionality and data to synchronize across tooling and instances in the architecture.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Netflix API - Separation of Concerns

  1. 1. SEPARATION OF CONCERNS Daniel Jacobson @daniel_jacobson http://www.linkedin.com/in/danieljacobson http://www.slideshare.net/danieljacobson
  2. 2. APIs Do Lots of Things!
  3. 3. Data Gathering Data Formatting Data Delivery Security Authorization Authentication System Scaling Discoverability Data Consistency Translations Throttling Orchestration APIs Do Lots of Things! These are some of the many things APIs do.
  4. 4. Data Gathering Data Formatting Data Delivery Security Authorization Authentication System Scaling Discoverability Data Consistency Translations Throttling Orchestration APIs Do Lots of Things! These three are at the core. All others ultimately support them.
  5. 5. Definitions • Data Gathering – Retrieving the requested data from one or many local or remote data sources • Data Formatting – Preparing a structured payload to the requesting agent • Data Delivery – Delivering the structured payload to the requesting agent
  6. 6. Meanwhile… There are two players in APIs
  7. 7. API Provider
  8. 8. API Provider API Consumer
  9. 9. API Provider PROVIDES API Consumer CONSUMES Traditional API Interactions
  10. 10. API Provider PROVIDES EVERYTHING API Consumer CONSUMES Everything means, API Provider does: • Data Gathering • Data Formatting • Data Delivery • (among other things) Traditional API Interactions
  11. 11. Why do most API providers provide everything? • API design tends to be easier for teams closer to the source • Centralized API functions makes them easier to support • Many APIs have a large set of unknown and external developers
  12. 12. Why do most API providers provide everything? • API design tends to be easier for teams closer to the source • Centralized API functions makes them easier to support • Many APIs have a large set of unknown and external developers
  13. 13. Data Gathering Data Formatting Data Delivery API Consumer API Provider Separation of Concerns To be a better provider, the API should address the separation of concerns of the three core functions
  14. 14. Data Gathering Data Formatting Data Delivery API Consumer Don’t care how data is gathered, as long as it is gathered API Provider Care a lot about how the data is gathered Separation of Concerns
  15. 15. Data Gathering Data Formatting Data Delivery API Consumer Don’t care how data is gathered, as long as it is gathered Each consumer cares a lot about the format for that specific use API Provider Care a lot about how the data is gathered Only cares about the format to the extent it is easy to support Separation of Concerns
  16. 16. Data Gathering Data Formatting Data Delivery API Consumer Don’t care how data is gathered, as long as it is gathered Each consumer cares a lot about the format for that specific use Each consumer cares a lot about how payload is delivered API Provider Care a lot about how the data is gathered Only cares about the format to the extent it is easy to support Only cares about delivery method to the extent it is easy to support Separation of Concerns
  17. 17. Because of our separation of concerns, the Netflix API team is enabled to focus on different charters
  18. 18. Key Responsibilities • Broker data between services and UIs • Maintain a resilient front-door • Scale the system vertically and horizontally • Maintain high velocity • Provide detailed insights into the system health
  19. 19. Brokering Data to 1,000+ Device Types
  20. 20. Most API Providers
  21. 21. Screen Real Estate
  22. 22. Controller
  23. 23. Technical Capabilities
  24. 24. One-Size-Fits-All API Request Request Request
  25. 25. Courtesy of South Florida Classical Review
  26. 26. Resource-Based API vs. Experience-Based API
  27. 27. 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
  28. 28. REST API RECOMME NDATIONS MOVIE DATA SIMILAR MOVIES AUTH MEMBER DATA A/B TESTS START- UP RATINGS Network Border Network Border
  29. 29. RECOMME NDATIONS MOVIE DATA SIMILAR MOVIES AUTH MEMBER DATA A/B TESTS START- UP RATINGS OSFA API Network Border Network Border SERVER CODE CLIENT CODE
  30. 30. RECOMME NDATIONS MOVIE DATA SIMILAR MOVIES AUTH MEMBER DATA A/B TESTS START- UP RATINGS OSFA API Network Border Network Border DATA GATHERING, FORMATTING, AND DELIVERY USER INTERFACE RENDERING
  31. 31. Experience-Based Requests • /ps3/homescreen
  32. 32. JAVA API Network Border Network Border RECOMME NDATIONS MOVIE DATA SIMILAR MOVIES AUTH MEMBER DATA A/B TESTS START- UP RATINGS Groovy Layer
  33. 33. RECOMME NDATIONSA ZXSXX C CCC MOVIE DATA SIMILAR MOVIES AUTH MEMBER DATA A/B TESTS START- UP RATINGS JAVA API SERVER CODE CLIENT CODE CLIENT ADAPTER CODE (WRITTEN BY CLIENT TEAMS, DYNAMICALLY UPLOADED TO SERVER) Network Border Network Border
  34. 34. RECOMME NDATIONSA ZXSXX C CCC MOVIE DATA SIMILAR MOVIES AUTH MEMBER DATA A/B TESTS START- UP RATINGS JAVA API DATA GATHERING DATA FORMATTING AND DELIVERY USER INTERFACE RENDERING Network Border Network Border
  35. 35. SEPARATION OF CONCERNS Daniel Jacobson @daniel_jacobson http://www.linkedin.com/in/danieljacobson http://www.slideshare.net/danieljacobson Want to help us solve some of our concerns? http://www.netflix.com/jobs

×