Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Netflix ML Impression Store - Distributed Data ...

Avatar for Nitin S Nitin S
August 15, 2018

Netflix ML Impression Store - Distributed Data Summit 2018

Avatar for Nitin S

Nitin S

August 15, 2018

More Decks by Nitin S

Other Decks in Technology

Transcript

  1. • 129M+ active members • 190+ countries • Increasing launch

    of originals • 2 Trillion kafka events/day Recommendations @Scale
  2. • Signals: ◦ Impressions, Plays, View History ◦ Searches, My

    Lists etc. • Compute: ◦ Offline Compute ◦ Online Compute Netflix Recommendation Signals
  3. • Raw impressions: ◦ Large dataset (PBs every day) ◦

    10s of trillions of rows ◦ $$$$ • Lack of signal: ◦ Too noisy ◦ Custom aggregation - expensive Storage Philosophy
  4. • Impression fatigue , Familiarity effect • Under vs over

    Impressing • Use in Recommendations - Score Online Goals
  5. • Want: I want all impressions • Need: ◦ Meaningful

    way to capture impressions ◦ (W/O storing full impressions) • Idea: ◦ EMA Counts # of times - <User, Video> over multiple decay windows. How many times has a show been recommended to you?
  6. • Representation: ◦ Exponential Moving Average (EMA) Score ◦ Rate

    of impressions over a given window ◦ EMA score over Windows: ▪ <user, video, location> => <last_seen_ts, [1d, 1w, 1m, 6m, 1y]> ▪ E.g <a, narcos, toprow> => <today, [0.9, 0.2, 0, 0, 0]> • Benefits: ◦ Better Signal ◦ Memory Footprint ◦ Extensible Data model Definition - EMA
  7. Scale & SLA Dimension Attribute Scale Storage Videos * locations

    * users ~600B + entries Raw Data size 150+TB Indexing Updates Bulk 600B+ entries < 1.5 hours Real time 50M entries < 5mins Query 99th Percentile Latency < 10s of ms Patterns Read/Update/Write Operations Cost $$ >> $$$$ Availability 99.99% [~4m downtime/30 days]
  8. Observation Attributes Stringent Flexible Predictably faster Reads Bulk + RT

    writes Strict Schema Secondary Index Easy Operations Ser/Deser at Read (aka blob storage)
  9. • Format: <K,V> storage & Schema-less • Underlying: Memcached +

    Cross Region support • Storage: In memory + Ext Storage Evcache
  10. • In Memory: ◦ $$$$ ◦ No persistence ◦ Lack

    of consistency - Node crash etc • Layered Storage? But wait...
  11. • Scenario: ◦ 10% of active items => 90% of

    hits ◦ Large values eat up RAM • Philosophy: ◦ LRU <k,v> on disk; Index in RAM ◦ MRU key + value in RAM ◦ Values => NVMe; SSD Ext Storage
  12. Ext Storage • Effects: ◦ Reduce overall RAM ◦ Reduce

    Server Count ◦ Increase overall Cache size
  13. Cost : 1 TB of storage space EVCache - RAM

    Only 20 r4.2xlarge EVCache - Flash 1 i3.xlarge Network Bandwidth : ~40 Gbps Network Bandwidth : ~2.5 Gbps
  14. Region B Region A APP APP Repl Proxy Repl Relay

    1 mutate 2 send metadata 3 poll msg 5 https send m sg 6 mutate 4 get data for set Kafka Repl Relay Kafka Repl Proxy Cross-Region Replication 7 read
  15. • Cross Region: ◦ Relay: Event forward through kafka ◦

    Proxy: Event receiver and mutate cache ▪ Stateless ▪ Easy Throttle • CAS: ▪ Client-> Replica ▪ Client -> Kafka ▪ Write Retries (by proxy) until replica is consistent. Characteristics
  16. • Client Side ◦ Writes: All replicas in a region

    ◦ Compression: Gzip ◦ Reads: ▪ Quorum - Latches ▪ Consistency All • Server Side ◦ Writes: Cross regions [replication] ◦ Reads: Basic read repairs [Compare & Set] ◦ Storage: Mem & External Client & Server Responsibilities
  17. Backup & Restore Architecture Cache Warmer (Spark) Application Client Library

    Client Control S3 Data Flow Metadata Flow Control Flow
  18. • Protobuf • EMA Payload: ◦ (last_seen_ts, Float[1d, 1w, 1m,

    6m, 1y]) • Overall: ◦ Map<VideoId,Map<locationId,EMA>> EMA Representation
  19. Client Side Write Trade-offs Client Client • Writes: ◦ Read->De-ser

    -> Update -> Ser -> Write • Schema evolution
  20. • Engine: Apache Flink • Processing Semantics: ◦ Exactly once

    ◦ Late arriving events • RocksDB: ◦ Zero data loss: ▪ Failures/Crashes - Checkpoints/Savepoints ◦ State Management: ▪ Application state RT Indexing Infrastructure
  21. Chaos Engineering • Region Failovers • Crash Proof ?: ◦

    Replicas ◦ Tail Latency tests • Cross Region Replication: ◦ Kafka: ▪ 2-3x data ◦ Low Lag: ▪ Scale up Replay Proxies
  22. Tiered Storage: ◦ Memory ◦ SSD/Nvme ◦ EBS (Nitro based)

    ▪ 80,000 IOPS ▪ 14Gbps Future Work