headline
play

Headline Architecture Suudhan Rangarajan (@suudhan) Senior - PowerPoint PPT Presentation

Netflix Play API Why we built an Evolutionary Headline Architecture Suudhan Rangarajan (@suudhan) Senior Software Engineer Netflix Play API Why we built an Evolutionary Headline Architecture Suudhan Rangarajan (@suudhan) Senior Software


  1. Netflix Play API Why we built an Evolutionary Headline Architecture Suudhan Rangarajan (@suudhan) Senior Software Engineer

  2. Netflix Play API Why we built an Evolutionary Headline Architecture Suudhan Rangarajan (@suudhan) Senior Software Engineer

  3. Previous Architecture Workflow API Service Sign-up Content API Proxy Discovery Service Playback Domain specific Microservices Devices ← Services hosted in AWS →

  4. Signup Workflow API Service Sign-up Content API Proxy Signup API Discovery Service Playback Domain specific Microservices Devices ← Services hosted in AWS →

  5. Content Discovery Workflow API Service Sign-up Content API Proxy Discovery Discovery Service API Playback Domain specific Microservices Devices ← Services hosted in AWS →

  6. Playback Workflow API Service Sign-up Content API Proxy Play API Discovery Service Playback Domain specific Microservices Devices ← Services hosted in AWS →

  7. Previous Architecture API Service Sign-up Signup API Content API Proxy Discovery Discovery Service API Play API Playback Domain specific Microservices Devices ← Services hosted in AWS →

  8. Identity Type 1/2 Decisions Evolvability

  9. Identity Type 1/2 Decisions Evolvability

  10. Start with WHY: Ask why your service exists

  11. Lead the Internet TV revolution to entertain billions of people across the world Maximize customer engagement P from signup to streaming Enable acquisition, discovery, P playback functionality 24/7

  12. API Identity: Deliver Acquisition, Discovery and Playback functions with high availability

  13. Single Responsibility Principle: Be wary of multiple-identities rolled up into a single service

  14. Previous Architecture Current Architecture Signup API Signup API Discovery Discovery API API Play API Play API One API Service API Service Per function

  15. Lead the Internet TV revolution to entertain billions of people across the world Maximize user engagement of P Netflix customer from signup to streaming Enable non-member, discovery, P playback functionality 24/7 Deliver Playback P Lifecycle 24/7

  16. Decide best playback experience Authorize API Proxy Play API playback Service experience Track events to measure playback experience Devices

  17. Decide best playback experience Authorize API Proxy playback Service experience Track events to measure High Coupling, playback Low Evolvability experience Devices

  18. Play API Identity: Orchestrate Playback Lifecycle with stable abstractions

  19. Guiding Principle: We believe in a simple singular identity for our services. The identity relates to and complements the identities of the company, organization, team and its peer services

  20. Identity Type 1/2 Decisions Evolvability

  21. “ Some decisions are consequential and irreversible or nearly irreversible – one-way doors – and these decisions must be made methodically, carefully, slowly, with great deliberation and consultation [...] We can call these Type 1 decisions… ” Quote from Jeff Bezos

  22. “ ...But most decisions aren’t like that – they are changeable, reversible – they’re two-way doors. If you’ve made a suboptimal Type 2 decision, you don’t have to live with the consequences for that long [...] Type 2 decisions can and should be made quickly by high judgment individuals or small groups. ” Quote from Jeff Bezos

  23. Three Type 1 Decisions to Consider Appropriate Synchronous & Data Architecture Coupling Asynchronous

  24. Two types of Shared Libraries Client 1 Utilities Client 2 Shared Libraries with cache common Client 3 functions Metrics Client Libraries used for inter-service communications Play API Service

  25. 1) Binary Coupling “Thick” shared libraries with 100s of dependent libraries (e.g. utilities jar) Previous Architecture

  26. Binary coupling => Distributed Monolith Utilities Utilities Hundreds of shared libraries Service1 Service2 spanning services across network boundaries Utilities Previous Architecture Service3

  27. “The evils of too much coupling between services are far worse than the problems caused by code duplication” - Sam Newman (Building Microservices)

  28. Play API Service Playback Playback Decision Decision Service Client Previous Architecture

  29. Clients with heavy Fallbacks Requests Per Increase in Second of API Latencies Service Execution of from the API Fallback via Service Play Decision Client

  30. 2) Operational Coupling Play API Service Playback Playback Decision Decision Service Client Previous Architecture

  31. “Operational Coupling” might be an ok choice, if some services/teams are not yet ready to own and operate a highly available service.

  32. Operational Coupling impacts Availability Many of the client libraries had the potential to bring down the API Service Play API Service Previous Architecture

  33. 3) Language Coupling Play API Service Playback Decisions Service client Java Java Previous Architecture

  34. Communication Protocol Jersey Framework Play API Service Playback Decisions Service client REST over HTTP 1.1 Unidirectional ● (Request/ Response type APIs) Previous Architecture

  35. Requirements Operationally “thin” Clients No or limited shared libraries Auto-generated clients for Bi-Directional Communication Polyglot support

  36. REST vs RPC At Netflix, most use-cases were modelled as Request/Response ● REST was a simple and easy way of communicating between services; so ○ choice of REST was more incidental rather than intentional Most of the services were not following RESTful principles. ● The URL didn’t represent a unique resource, instead the parameters passed ○ in the call determined the response - effectively made them a RPC call So we were agnostic to REST vs RPC as long as it meets our requirements ●

  37. Previous Architecture Current Architecture Play API Service Play API Service Playback Playback Decisions Decisions gRPC/ REST/ HTTP2 Playback HTTP1 Playback Authorize Authorize Playback Playback Events Events 1) Minimal Operational Coupling 1) Operationally Coupled Clients 2) Limited Binary Coupling 2) High Binary Coupling 3) Beyond Java 3) Only Java 4) Beyond Request/ Response 4) Unidirectional communication

  38. Type 1 Decision: Appropriate Coupling Consider “thin” auto-generated clients with bi-directional communication and minimize code reuse across service boundaries

  39. Three Type 1 Decisions to Consider Appropriate Synchronous vs Data Architecture Coupling Asynchronous

  40. PlayData getPlayData(string customerId, string titleId, string deviceId){ CustomerInfo custInfo = getCustomerInfo(customerId); DeviceInfo deviceInfo = getDeviceInfo(deviceId); PlayData playdata = decidePlayData(custInfo, deviceInfo, titleId); return playdata; }

  41. Typical Synchronous Architecture Request Handler Client Thread pool Thread pool

  42. Typical Synchronous Architecture getPlayData getCustomerInfo Customer Service getDeviceInfo decidePlayData Device Service Return Play Data Decision Request Handler Service One thread per request Client Thread pool Thread pool

  43. Typical Synchronous Architecture getPlayData getCustomerInfo Customer Service getDeviceInfo decidePlayData Device Service Return Play Data Decision Request Handler Service One thread per request Client Thread pool Thread pool Blocking Request Handler Blocking Client I/O

  44. Typical Synchronous Architecture Works for Simple Request/Response getPlayData getCustomerInfo Works for Limited Clients getDeviceInfo decidePlayData Return Request Handler One thread per request Client Thread pool Thread pool Blocking Request Handler Blocking Client I/O

  45. Beyond Request/Response One Request - One Response One Request - Stream Response Request Play-data for Titles X,Y,Z Request Play-data for Title X Receive Play-data for Title X Receive Play-data for Title X Receive Play-data for Title Y Receive Play-data for Title Z Stream Request - One Response Stream Request - Stream Response Request Play-data for Title X Request Play-data for Title X Request Play-data for Title Y Request Play-data for Title Y Request Play-data for Title Z Receive Play-data for Title X Get Play-data for Title Z Receive Play-data for Titles X,Y,Z Receive Play-data for Title Y Receive Play-data for Title Z

  46. Asynchronous Architecture Request/Response Worker Threads Event Loop Outgoing Event Loop per client

  47. PlayData getPlayData(string customerId, string titleId, string deviceId){ Zip(getCustomerInfo(customerId), getDeviceInfo(deviceId), (custInfo, deviceInfo) -> return decidePlayData(custInfo, deviceInfo, titleId) ); }

  48. Asynchronous Architecture Customer Service setup Device Service Request/Response Event Loop PlayData Service Outgoing Event Loop per client Workflow spans many worker threads

  49. Asynchronous Architecture Customer Service getCustomerInfo Device Service Request/Response Event Loop PlayData Service Outgoing Event Loop per client Workflow spans many worker threads

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend