a netflix case study: edge service architecture...a netflix case study: edge service architecture |...

40
A Netflix case study: Edge Service Architecture | Paul Bakker

Upload: others

Post on 05-Feb-2021

9 views

Category:

Documents


2 download

TRANSCRIPT

  • A Netflix case study: Edge Service Architecture

    | Paul Bakker

  • Paul BakkerEdge Developer Productivity @ Netflix

  • Contents.

    What and why Edge?Edge architectures and their tradeoffsAPI data access patternsDeveloper experience

    Architecture patterns

    How we do things

  • This talk is not a template telling you how to do micro services.

  • We want an architecture that allows us to innovate.

  • What is Edge Service Architecture?

  • Lets start with How do we expose Micro Services to devices?

  • Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    http

    Multiple calls from the clientPossibly fetching duplicate dataError handling and fallbacks are up to the clientTight coupling between client and backend servicesEvery micro service has to think about client needsDoes this allow rapid innovation?

    This is bad, but not horrible

  • Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    http

    Now it’s horrible

    Multiple calls from the clientPossibly fetching duplicate dataError handling and fallbacks are up to the clientTight coupling between client and backend servicesEvery micro service has to think about client needsDoes this allow rapid innovation?

  • Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    httpGateway service

    REST

    Clients only need a single callNo coupling between clients and backend servicesGateway takes care of error handling and fallbacksStill a one size fits all APIDoes this allow rapid innovation?

  • Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    httpGateway service

    REST

    Edge

  • Micro Service

    REST

    DRM

    Playback

    Micro Service

    REST

    Streaming logs

    Edge

    Zuul

    Edge Developer Experience

    APIServer

  • Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    http

    Gateway service

    REST

    http

    Gateway service

    REST

    Gateway service

    REST

    http

  • Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    Micro Service

    REST

    http

    Gateway service

    REST

    http

    Gateway service

    REST

    Gateway service

    REST

    http

    Who develops and manages these?

    Now every gateway service solves the same problems

    Rapid innovation?

  • Current Edge architecture(s)

  • Micro Service

    Micro Service

    Micro Service

    Micro Service

    Micro Service

    http

    http

    httpAdapterScript

    AdapterScript

    AdapterScript

    Client libraries

    API Server

  • ratings

    profiles

    videocatalog

    AdapterScript

    Client libraries

    { “userProfile”: “Paul”, “videoTitle”: “Narcos”, “rating”: “THUMBS_UP”}

    The adapter scripts fetch data from multiple services and combine the results

  • ratings

    profiles

    videocatalog

    Client libraries

    The Netflix API server

    Adapter scrips written in GroovyUploaded to the API serverFaaS from the developer point of view?

    ratings

    profiles

    AdapterScript

    Client libraries

  • The micro service monolith

  • Micro Service

    Micro Service

    Micro Service

    Micro Service

    Micro Service

    http

    http

    httpAdapterScript

    AdapterScript

    AdapterScript

    Client libraries

    API Server

  • Monoliths are scary.

    Single point of failureThe API server is BIGOne bad script, config or client library can affect availability

  • Micro Service

    Micro Service

    Micro Service

    Micro Service

    Micro Service

    http

    NodeContainer

    Adapter scripts

    NodeContainer

    Adapter scripts

    NodeContainer

    Adapter scripts

    API

    http

    http

  • Each set of endpoint scripts is deployed as a lightweight serviceUsing containers to decrease deployment overheadBetter deployment isolationBetter Developer Experience!

    Breaking things up

  • Adapter scripts

  • ratings

    profiles

    videocatalog

    AdapterScript

    Client libraries

    { “userProfile”: “Paul”, “videoTitle”: “Narcos”, “rating”: “THUMBS_UP”}

    How to write adapter scripts?

    How to deduplicate data?

    How to represent downstream errors and timeouts?

    Is JSON ideal from the client’s perspective?

  • Micro Service

    Micro Service

    Micro Service

    Micro Service

    Micro Service

    NodeContainer

    Adapter scripts

    NodeContainer

    Adapter scripts

    NodeContainer

    Adapter scripts

    API

  • There is no API

    Just declare what data you need.

    getVideoTitleById(…)getProfile(…).getName()getRatingForVideoId(…)

    [ ["currentProfile", "allVideosRated", 0,["title", "thumbRating"]] ["currentProfile", "name"]]

  • Treat multiple data sources as one logical model

  • { "allVideosRated": { "28": { "$type": "ref", "value": [ "profilesByGuid", "UXXGMAOJ3VGGLGWTQ6NMN7OPGU", "videosById", 80190279 ] } }, "videosById": { "80190279": { "thumbRating": { "$type": "atom", "value": { "rating": "THUMBS_UP", "timestamp": 1514346641221 } }, "title": "The Indian Detective" } } }

    get(["allVideosRated", 28, [“title”, “thumbRating"]]);

    JSON Graph - refs.

    Deduplicate dataAccess data as a logical model

  • API Discovery

  • If “there is no API”….

    How do I know what to do?

  • Discovering paths and putting them together

  • Edge PaaS - Developer Experience

    The right balance between serverless and developer experience?

  • “API Script” developersDisappointed

    Can’t run code locallyNo step debuggingNo unit testing

    But spoiledDeployment is trivialEasy to support many versionsNothing to manage!

  • Developer Experience

    Projects runs in container on developer machineLocal editing and debuggingExternal routing to developer machineRun locally what runs in production

  • NodeQuark demo

  • MetricsAlertsStreaming loggingDeployment pipelinesCanary analysis

    Out of the box.

  • Thank you.

    Paul Bakker@pbakker