SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Downloaden Sie, um offline zu lesen
@r39132
2 Talks @ QCon London

  ™  Whitepaper : Netflix’s Transition to High-
      Availability Storage Systems

  ™  Title : Netflix’s Cloud Data Architecture
      ™  Track : Architectures You’ve Always Wondered
          About
          ™  General Overview
          ™  Data Replication Deep Dive

  ™  Title : NoSQL @ Netflix
      ™  Track : NoSQL : Where and How
          ™  SimpleDB, S3, and Cassandra

@r39132                           2
What is Netflix?

  Circa 1997

  ™  Rent a Movie
      ™  Right of first sale




  ™  Buy a Movie
      ™  Any retailer (e.g. Walmart) or e-tailer (e.g. Amazon)

@r39132                           4
What is Netflix?



  ™  A brick-and-mortar store can only hold ~1k-2k titles
      ™  Which DVD titles do they pick?
          ™  Brand New Releases
          ™  Long-standing Hits (e.g. The Godfather)
      ™  Brand New Releases are expensive
      ™  Stores profit by re-renting the same video within a short
          time frame (i.e. DVD Availability Window)
          ™  Must impose steep rental fees and steeper late fees

@r39132                             5
What is Netflix?

  Circa 1997

  ™  Netflix saw opportunity in the long-tail business
      ™  We store >120K titles in our 50+ shipping hubs
      ™  We recommend movies in the long tail,
          personalized to the customer, lowering costs




@r39132                          6
What is Netflix?

  In 1999

  ™  Netflix launches DVD rentals-by-mail
      ™    Unlimited rentals for a flat monthly fee
      ™    No due dates
      ™    No late fees
      ™    No shipping or handling fees




@r39132                             7
What is Netflix?

  After a few years…




@r39132                8
What is Netflix?

  Fast Forward to 2008
  ™  Netflix forecasts the gradual end of the DVD and
      starts switching to Movie Streaming

  ™  Upside?
      ™  We spend $500MM to $600MM annually on US Postage for
          DVD mailing
      ™  Streaming a movie is 1/100th the cost of shipping a DVD
      ™  Easier to craft a business model for international expansion




@r39132                                 9
What is Netflix?

       •  We have 20M+ subscribers in the US and Canada
       •  Uses 20% of US peak downstream bandwidth
       •  1st or 2nd largest CDN user in the US

               25
               20
               15
                10
                 5
                  0




Source: http://ir.netflix.com          10
What is Netflix?

  Grew subscribers 2008-2010 by partnering with
  device makers
  ™  Game Consoles
      ™  Xbox 360, Wii, PS3

  ™  Mobile Devices
      ™  Apple IPad, IPhone, IPod Touch, Windows 7




@r39132                          11
Migration to AWS
Our Cloud Story

  ™  Circa late 2008, Netflix had a single data center
      ™  Single-point-of-failure (a.k.a. SPOF)
      ™  Approaching limits on cooling, power, space, traffic
          capacity

  ™  Alternatives
      ™  Build more data centers
      ™  Outsource our capacity planning and scale out
          ™  Allows us to focus on core competencies




@r39132                            13
Our Cloud Story

  ™  Winner : Outsource our capacity planning and scale out
      ™  Leverage a leading Infrastructure-as-a-service provider
          ™    Amazon Web Services



  ™  Footnote : A short 2 years later, we serve >90% of our traffic out
      of AWS
      ™  excluding the video streaming bits, which come from CDNs




@r39132                                14
The Netflix Application Platform
How Netflix Uses AWS

 AWS provides various IAAS offerings, but applications
 need more!



  AWS IAAS
  •  Persistence




                             ?
     •  SimpleDB, RDS, S3,
        EBS
                                             Netflix
  •  Load Handling
     •  EC2, EMR, ASG, ELB
                                           Applications
  •  Monitoring
     •  CloudWatch




@r39132                      16
How Netflix Uses AWS

 AWS provides various IAAS offerings, but applications
 need more!

 Hence the need for Netflix’s infrastructure team to bridge
 the gap!
  AWS IAAS                   Netflix Platform
  •  Persistence             •  Platform.jar
     •  SimpleDB, RDS, S3,   •  Middle-tier Load
        EBS
  •  Load Handling
                                Balancing               Netflix
     •  EC2, EMR, ASG, ELB   •  Discovery             Applications
  •  Monitoring              •  Encryption Services
     •  CloudWatch           •  Caching
                             •  Configuration



@r39132                                  17
How Netflix Uses AWS
              AWS ELB
                                   Netflix edge services (e.g. WWW)


WWW           EC2     EC2

               ?

                                   Netflix mid-tier services (e.g. Q or
                                             Merch services)
       EC2                  EC2
        EC2                  EC2
Q                   Merch
                                    AWS IAAS

    Simple      S3           SQS
      DB


@r39132                            18
Our Cloud Story
                AWS ELB
                                        Netflix edge services (e.g. WWW)


WWW            EC2          EC2
                                         Netflix Platform

Middle Tier Load Balancer    Discovery

                                         Netflix mid-tier services (e.g. Q or
                                          Merch services) w/ platform.jar
       EC2                    EC2
        EC2                    EC2
Q                    Merch
                                          AWS IAAS

    Simple         S3             SQS
      DB


@r39132                                  19
How Netflix Uses AWS (EC2 Stack)

Application
Platform & Other Infrastructure jars        Discovery Client
                                                             MT Load Balancer
                                                        Crypto Client
                                            S3 Client
                                              SimpleDB Client
                                                    SQS Client
                                                        EVCache Client
                                            Configuration Client

Guest OS / VM / Host OS / Machine
@r39132                                20
The Netflix Data Platform
How Netflix Uses AWS

  ™  Persistence in the Cloud (c.f. NoSQL @ Netflix talk)
      ™  SimpleDB
      ™  S3
      ™  Cassandra

  ™  Data Replication
      ™  IR (a.k.a. Item Replicator)
      ™  HAProxy + Squid + Oracle à temporary




@r39132                       22
SimpleDB
Persistence : SimpleDB

  Terminology
          SimpleDB         Hash Table            Relational Databases

           Domain          Hash Table                   Table

            Item              Entry                     Row

          Item Name            Key              Mandatory Primary Key

          Attribute   Part of the Entry Value          Column




@r39132                        24
Persistence : SimpleDB
Soccer Players
Key                         Value

                                                                               Nickname = Wizard of      Teams = Leeds United,
ab12ocs12v9                 First Name = Harold       Last Name = Kewell       Oz                        Liverpool, Galatasaray
                                                                               Nickname = Czech          Teams = Lazio,
b24h3b3403b                 First Name = Pavel        Last Name = Nedved       Cannon                    Juventus
                                                                                                         Teams = Sporting,
                                                                                                         Manchester United,
cc89c9dc892                 First Name = Cristiano    Last Name = Ronaldo                                Real Madrid

SimpleDB’s salient characteristics
        •  SimpleDB offers a range of consistency options

        •  SimpleDB domains are sparse and schema-less

        •  The Key and all Attributes are indexed

        •  Each item must have a unique Key

        •  An item contains a set of Attributes
                •  Each Attribute has a name
                 •  Each Attribute has a set of values
                 •  All data is stored as UTF-8 character strings (i.e. no support for types such as numbers or dates)


@r39132                                                         25
Persistence : SimpleDB

  ™  Moved some of our largest transactional data sets to SimpleDB in
      2010
      ™  e.g. RENTAL HISTORY : Everything that anyone has watched at
          Netflix, including streaming and DVD

  ™  We have
      ™  ~ thousands of domains
      ™  ~ 1TB of OLTP/transactional data (i.e. no CLOBS or BLOBS)
      ™  ~ billions of rows of data (a.k.a. items)

  ™  We execute billions of SimpleDB statements per day




@r39132                                 26
S3
Persistence : S3

  ™  Simple KV store organized as objects in buckets
      ™  Each AWS account is given a max of 10 buckets
      ™  Each bucket can hold an unlimited number of objects

  ™  We use S3 to store data that does not fit into SimpleDB
      ™  Logs from streaming devices
      ™  Files used in movie encoding
      ™  Truncated-tail of Rental History
          ™  Good pattern introduced by Greg Kim




@r39132                          28
Item Replicator

Data Replication between Oracle, SimpleDB, S3, and
                    Cassandra
Data Replication : IR


  ™  Home-grown Data Replication Framework known as IR for Item
      Replication

  ™  Keeps data in sync between RDBMS (DC) and NoSQL (Cloud)
      ™  Mostly unidirectional: DC à Cloud

  ™  2 data capture schemes in use currently
      ™  Trigger-oriented IR
          ™  All CRUD operations on source table X are copied via a trigger
              to XLog_i journal tables (i is the shard index)
          ™  IR reads (polls) from a journal table
      ™  Simple IR
          ™  IR reads (polls) from source table X directly


@r39132                                30
IR
Data Capture Schemes : IR


    ™  Trigger-oriented IR (e.g. Movie Q)


                                  Table XLog_0   IR
                            0
  CRUD             artition
           Write p
              rite partit
                          ion 1   Table XLog_1   IR
            W
 Table X    Write partition 2
                                                      AWS
            Write             Table    XLog_2    IR
                  partit
                        ion 3
                                  Table XLog_3   IR
Netflix Data Center



 @r39132                                32
Data Capture Schemes : IR


    ™  Simple IR (e.g. Rental History)


                                       IR
                        rti   tion 0
  CRU          Re ad pa
                R ead parti
                            tion 1     IR
 Table X                                         AWS
               Read partition 2
                                       IR
               Read
                      partit
                            ion 3
                                       IR
Netflix Data Center



 @r39132                                    33
IR’s Polling Select


  ™  Anatomy of an IR Select Query
      ™  Execute the SQL below as a recurring poll
          select * from RENTAL_HISTORY r
          where r.LAST_MODIFIED_TS > checkpoint value               ß (A)
          and r.LAST_MODIFIED_TS < (now-10 seconds)                 ß (B)
          order by r.LAST_MODIFIED_TS asc                           ß (C)

      ™  (A) – preserves progress in case IR crashes and restarts
      ™  (B) – handles interesting race condition… will explain in later slide
      ™  (C) – in order read for repeatability as in (A)




@r39132                                 35
IR’s Polling Select


  ™  Anatomy of an IR Select Query
      ™  Assume previous checkpoint is T0
      ™  @ time = T4, only the top 2 records are visible and will be replicated
          ™    (B) hides The Town and Duma
          ™    {1, The Machinist} and then {2, Blood Diamond} are replicated to the
                cloud
      ™  After IR replicates this data, the checkpoint is now T2

     Customer_ID          Movie_ID                  last_modified_ts
     1                    The Machinist             T1                           ß
     2                    Blood Diamond             T2                           ß
     4                    The Town                  T4 - 3sec
     1                    Duma                      T4


@r39132                                   36
IR’s Polling Select


      ™  Anatomy of an IR Select Query
         ™  Assume previous checkpoint is T2
         ™  @ time = T4+12 sec, The 3 records pointed to by arrows are visible
             and replicated to the cloud
             ™    Of these 1 new record, The King’s Speech, became visible in time to be
                   replicated – Commit-delayed

         Customer_ID         Movie_ID                   last_modified_ts
         1                   The Machinist              T1
         2                   Blood Diamond              T2
         4                   The Town                   T4 – 3 sec                 ß
new      3                   The King’s Speech          T4                         ß
         1                   Duma                       T4                         ß
new      5                   Rescue Dawn                T4 + 11 sec

 @r39132                                     37
IR’s Polling Select


  ™  “Commit-delayed” Race Condition

  ™  Consider 2 update transactions
      ™    Transaction 1
            update RENTAL_HISTORY r
            set r.LAST_MODIFIED_TS = systimestamp,
            r.MOVIE_ID = ‘The Machinest good’
            where r.CUSTOMER_ID = 1;
            commit;
      ™    Transaction 2
            update RENTAL_HISTORY r
            set r.LAST_MODIFIED_TS = systimestamp,
            r.MOVIE_ID = ‘Blood Diamond good’
            where r.CUSTOMER_ID = 2;
            commit;
@r39132                                 38
IR’s Polling Select


  ™  One possible schedule
      ™  Transaction 1
          update RENTAL_HISTORY r
          set r.LAST_MODIFIED_TS = systimestamp @T1
          r.MOVIE_ID = ‘The Machinest good’
          where r.CUSTOMER_ID = 1;
          commit; @T4
      ™  Transaction 2
          update RENTAL_HISTORY r
          set r.LAST_MODIFIED_TS = systimestamp, @T2
          r.MOVIE_ID = ‘Blood Diamond good’
          where r.CUSTOMER_ID = 2;
          commit; @T3
@r39132                           39
IR’s Polling Select
      Customer_ID        Movie_ID               last_modified_ts
      1                  The Machinist bad      T0
      2                  Blood Diamond bad      T0
      -- Transaction 2 commits at T3, but records T2
      Customer_ID        Movie_ID               last_modified_ts
      1                  The Machinist bad      T0
      2                  Blood Diamond good T2
      -- IR replicates “Blood Diamond good” and sets checkpoint = T2
      -- Transaction 1 commits at T4, but records T1

      Customer_ID        Movie_ID               last_modified_ts
      1                  The Machinist good     T1
      2                  Blood Diamond good T2
      -- IR will never see “The Machinist good” because checkpoint
      already advanced past T1 to T2
@r39132                              40
IR’s Polling Select


  ™  Solving the “Commit-delayed” Race Condition
      ™    Transaction 1
            update RENTAL_HISTORY r
            set r.LAST_MODIFIED_TS = systimestamp,
            r.MOVIE_ID = ‘The Machinest good’
            where r.CUSTOMER_ID = 1
            and r.last_modified_ts < (now – 10 sec);
            commit;
      ™    Transaction 2
            update RENTAL_History r
            set r.LAST_MODIFIED_TS = systimestamp,
            r.MOVIE_ID = ‘Blood Diamond good’
            where r.CUSTOMER_ID = 2;
            and r.last_modified_ts < (now – 10 sec);
            commit;
@r39132                                    41
Forklifting Historical Data


  ™  Fork-lifting Data – TRICKS!
      ™  Trigger-oriented IR
          ™  Trickle-lifting
              ™    Parallel fork-lifting and incremental replication
      ™  Simple IR
          ™  Typically need to forklift by recovering a snapshot in a second
              database
              ™    Execute forklift of that data
              ™    Assume database snapshot @ time = T1
          ™  In the primary database, buffer modifications until forklift
              complete
              ™  One forklift is complete, replicate data changed after
                  time=T1

@r39132                                   43
Forklifting Historical Data




@r39132               44
Forklifting Historical Data


  ™  Trickle-lifting Data for the movie Q
      ™  User with id=6 adds a movie to his queue
      ™  Trigger fires to replicate that data to QLOG_6 (e.g. 6 % 10 shards =
          6)
      ™  Along the way, the trigger checks whether user with id=6 is found in
          the member_progress table
          ™    If not, the user id is inserted into the member_progress table
          ™    If so, no action is taken
      ™  A separate program called QTouch will notice a new record while
          polling the member_progress table : user id = 6
          ™    QTouch will execute a harmless update of all records for the user to
                fork-lift that user’s data into the cloud




@r39132                                     45
Best Practices : IR


  ™  Data Model Best Practices
      ™  Checkpoint Column
          ™  Choose a Timestamp not Date data type (i.e. for
              microsecond granularity) or an ordered sequence
          ™  Need a Before Trigger to set the timestamp or sequence
              ™  Don’t trust what is passed in by DB clients
          ™  Index the column




@r39132                               46
HAProxy + Squid + Oracle

Data lives in Oracle but is cached in the cloud
Data Replication : HAProxy+Squid+Oracle




@r39132                48
SiddharthAnand_NetflixsCloudDataArchitecture

Weitere ähnliche Inhalte

Was ist angesagt?

AmebaPico 裏側の技術やAWSの利用について
AmebaPico 裏側の技術やAWSの利用についてAmebaPico 裏側の技術やAWSの利用について
AmebaPico 裏側の技術やAWSの利用についてKohei Morino
 
Netflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconNetflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconAdrian Cockcroft
 
AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)
AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)
AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)Amazon Web Services
 
AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)
AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)
AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)Amazon Web Services
 
SV Forum Platform Architecture SIG - Netflix Open Source Platform
SV Forum Platform Architecture SIG - Netflix Open Source PlatformSV Forum Platform Architecture SIG - Netflix Open Source Platform
SV Forum Platform Architecture SIG - Netflix Open Source PlatformAdrian Cockcroft
 
(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC
(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC
(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPCAmazon Web Services
 
Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)Adrian Cockcroft
 
Introduction to Container Management on AWS
Introduction to Container Management  on AWSIntroduction to Container Management  on AWS
Introduction to Container Management on AWSAmazon Web Services
 
The Netflix Open Source Platform
The Netflix Open Source PlatformThe Netflix Open Source Platform
The Netflix Open Source PlatformRuslan Meshenberg
 
(NET403) Another Day, Another Billion Packets
(NET403) Another Day, Another Billion Packets(NET403) Another Day, Another Billion Packets
(NET403) Another Day, Another Billion PacketsAmazon Web Services
 
Netflix Global Applications - NoSQL Search Roadshow
Netflix Global Applications - NoSQL Search RoadshowNetflix Global Applications - NoSQL Search Roadshow
Netflix Global Applications - NoSQL Search RoadshowAdrian Cockcroft
 
Double Redundancy with AWS Direct Connect - Pop-up Loft Tel Aviv
Double Redundancy with AWS Direct Connect - Pop-up Loft Tel AvivDouble Redundancy with AWS Direct Connect - Pop-up Loft Tel Aviv
Double Redundancy with AWS Direct Connect - Pop-up Loft Tel AvivAmazon Web Services
 
AWS Network Topology/Architecture
AWS Network Topology/ArchitectureAWS Network Topology/Architecture
AWS Network Topology/Architecturewlscaudill
 
Edge to Instance - AWS Networking
Edge to Instance - AWS Networking Edge to Instance - AWS Networking
Edge to Instance - AWS Networking Amazon Web Services
 
Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Adrian Cockcroft
 
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitThe DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitMarco Ferrigno
 
A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013
A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013
A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013Amazon Web Services
 
Journey through Cloud front AWS
Journey through Cloud front AWSJourney through Cloud front AWS
Journey through Cloud front AWSMd. Khairul Anam
 

Was ist angesagt? (20)

AmebaPico 裏側の技術やAWSの利用について
AmebaPico 裏側の技術やAWSの利用についてAmebaPico 裏側の技術やAWSの利用について
AmebaPico 裏側の技術やAWSの利用について
 
Netflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at GlueconNetflix Architecture Tutorial at Gluecon
Netflix Architecture Tutorial at Gluecon
 
AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)
AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)
AWS re:Invent 2016: Another Day, Another Billion Packets (NET401)
 
AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)
AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)
AWS re:Invent 2016: Deep Dive: AWS Direct Connect and VPNs (NET402)
 
SV Forum Platform Architecture SIG - Netflix Open Source Platform
SV Forum Platform Architecture SIG - Netflix Open Source PlatformSV Forum Platform Architecture SIG - Netflix Open Source Platform
SV Forum Platform Architecture SIG - Netflix Open Source Platform
 
(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC
(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC
(NET409) How Twilio Migrated Its Services from EC2-Classic to EC2-VPC
 
Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)Cloud Architecture Tutorial - Platform Component Architecture (2of3)
Cloud Architecture Tutorial - Platform Component Architecture (2of3)
 
Diveinto AWS
Diveinto AWS Diveinto AWS
Diveinto AWS
 
Introduction to Container Management on AWS
Introduction to Container Management  on AWSIntroduction to Container Management  on AWS
Introduction to Container Management on AWS
 
The Netflix Open Source Platform
The Netflix Open Source PlatformThe Netflix Open Source Platform
The Netflix Open Source Platform
 
(NET403) Another Day, Another Billion Packets
(NET403) Another Day, Another Billion Packets(NET403) Another Day, Another Billion Packets
(NET403) Another Day, Another Billion Packets
 
Netflix Global Applications - NoSQL Search Roadshow
Netflix Global Applications - NoSQL Search RoadshowNetflix Global Applications - NoSQL Search Roadshow
Netflix Global Applications - NoSQL Search Roadshow
 
Double Redundancy with AWS Direct Connect - Pop-up Loft Tel Aviv
Double Redundancy with AWS Direct Connect - Pop-up Loft Tel AvivDouble Redundancy with AWS Direct Connect - Pop-up Loft Tel Aviv
Double Redundancy with AWS Direct Connect - Pop-up Loft Tel Aviv
 
AWS Network Topology/Architecture
AWS Network Topology/ArchitectureAWS Network Topology/Architecture
AWS Network Topology/Architecture
 
Edge to Instance - AWS Networking
Edge to Instance - AWS Networking Edge to Instance - AWS Networking
Edge to Instance - AWS Networking
 
Dystopia as a Service
Dystopia as a ServiceDystopia as a Service
Dystopia as a Service
 
Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)Cloud Architecture Tutorial - Running in the Cloud (3of3)
Cloud Architecture Tutorial - Running in the Cloud (3of3)
 
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkitThe DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
 
A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013
A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013
A Day in the Life of a Billion Packets (CPN401) | AWS re:Invent 2013
 
Journey through Cloud front AWS
Journey through Cloud front AWSJourney through Cloud front AWS
Journey through Cloud front AWS
 

Andere mochten auch

портфолио токарева
портфолио токаревапортфолио токарева
портфолио токареваElenaSam
 
RoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgileRoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgileKostas Mavridis
 
Pitch Deck for Startup Solopreneurs
Pitch Deck for Startup SolopreneursPitch Deck for Startup Solopreneurs
Pitch Deck for Startup SolopreneursRob Place
 
новое положение нсот
новое положение нсотновое положение нсот
новое положение нсотElenaSam
 
мама,папа 2014
мама,папа 2014мама,папа 2014
мама,папа 2014ElenaSam
 
гиа егэ 2014
гиа егэ   2014гиа егэ   2014
гиа егэ 2014ElenaSam
 
Agile — технология актуальности писем
Agile — технология актуальности писемAgile — технология актуальности писем
Agile — технология актуальности писемEMAILMATRIX
 
закон об образовании 2
закон об образовании 2закон об образовании 2
закон об образовании 2ElenaSam
 
Я во Входящих. А вы?
Я во Входящих. А вы?Я во Входящих. А вы?
Я во Входящих. А вы?EMAILMATRIX
 
Gotas de rocío.. poema de Libra *M*
Gotas de rocío.. poema de Libra *M*Gotas de rocío.. poema de Libra *M*
Gotas de rocío.. poema de Libra *M*libra_esp
 
Тактики персонализации
Тактики персонализацииТактики персонализации
Тактики персонализацииEMAILMATRIX
 
живая память
живая памятьживая память
живая памятьElenaSam
 
головина ольга Why do i learn english)
головина ольга Why do i learn english)головина ольга Why do i learn english)
головина ольга Why do i learn english)Lilia Ayatskova
 
типовая форма организации отдыха мбоу гимназия №166
типовая форма организации отдыха мбоу гимназия №166типовая форма организации отдыха мбоу гимназия №166
типовая форма организации отдыха мбоу гимназия №166ElenaSam
 

Andere mochten auch (20)

портфолио токарева
портфолио токаревапортфолио токарева
портфолио токарева
 
RoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgileRoyOsherove_TeamLeadershipInTheAgeOfAgile
RoyOsherove_TeamLeadershipInTheAgeOfAgile
 
квн
квнквн
квн
 
Pitch Deck for Startup Solopreneurs
Pitch Deck for Startup SolopreneursPitch Deck for Startup Solopreneurs
Pitch Deck for Startup Solopreneurs
 
Seccion aurea jan ove
Seccion aurea   jan oveSeccion aurea   jan ove
Seccion aurea jan ove
 
Insertion class
Insertion classInsertion class
Insertion class
 
новое положение нсот
новое положение нсотновое положение нсот
новое положение нсот
 
Food Beverages
Food BeveragesFood Beverages
Food Beverages
 
мама,папа 2014
мама,папа 2014мама,папа 2014
мама,папа 2014
 
гиа егэ 2014
гиа егэ   2014гиа егэ   2014
гиа егэ 2014
 
Agile — технология актуальности писем
Agile — технология актуальности писемAgile — технология актуальности писем
Agile — технология актуальности писем
 
закон об образовании 2
закон об образовании 2закон об образовании 2
закон об образовании 2
 
Я во Входящих. А вы?
Я во Входящих. А вы?Я во Входящих. А вы?
Я во Входящих. А вы?
 
Gotas de rocío.. poema de Libra *M*
Gotas de rocío.. poema de Libra *M*Gotas de rocío.. poema de Libra *M*
Gotas de rocío.. poema de Libra *M*
 
Тактики персонализации
Тактики персонализацииТактики персонализации
Тактики персонализации
 
живая память
живая памятьживая память
живая память
 
головина ольга Why do i learn english)
головина ольга Why do i learn english)головина ольга Why do i learn english)
головина ольга Why do i learn english)
 
2
22
2
 
типовая форма организации отдыха мбоу гимназия №166
типовая форма организации отдыха мбоу гимназия №166типовая форма организации отдыха мбоу гимназия №166
типовая форма организации отдыха мбоу гимназия №166
 
Dolinkina r. game
Dolinkina r. gameDolinkina r. game
Dolinkina r. game
 

Ähnlich wie SiddharthAnand_NetflixsCloudDataArchitecture

Linked in nosql_atnetflix_2012_v1
Linked in nosql_atnetflix_2012_v1Linked in nosql_atnetflix_2012_v1
Linked in nosql_atnetflix_2012_v1Sid Anand
 
Netflix keynote-adrian-qcon
Netflix keynote-adrian-qconNetflix keynote-adrian-qcon
Netflix keynote-adrian-qconYiwei Ma
 
Svccg nosql 2011_v4
Svccg nosql 2011_v4Svccg nosql 2011_v4
Svccg nosql 2011_v4Sid Anand
 
Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...
Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...
Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...Amazon Web Services
 
CloudFork
CloudForkCloudFork
CloudForkESUG
 
AWS Services Eagle View Dec-2017
AWS Services Eagle View Dec-2017AWS Services Eagle View Dec-2017
AWS Services Eagle View Dec-2017Amit Kapoor
 
So There’s This Amazon Thing
So There’s This Amazon ThingSo There’s This Amazon Thing
So There’s This Amazon ThingJared Faris
 
Netflix's Transition to High-Availability Storage (QCon SF 2010)
Netflix's Transition to High-Availability Storage (QCon SF 2010)Netflix's Transition to High-Availability Storage (QCon SF 2010)
Netflix's Transition to High-Availability Storage (QCon SF 2010)Sid Anand
 
Migrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global CassandraMigrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global CassandraAdrian Cockcroft
 
Randall Hunt - AWS Midwest Community Day Keynote
Randall Hunt - AWS Midwest Community Day KeynoteRandall Hunt - AWS Midwest Community Day Keynote
Randall Hunt - AWS Midwest Community Day KeynoteAWS Chicago
 
Zenko & MetalK8s @ Dublin Docker Meetup, June 2018
Zenko & MetalK8s @ Dublin Docker Meetup, June 2018Zenko & MetalK8s @ Dublin Docker Meetup, June 2018
Zenko & MetalK8s @ Dublin Docker Meetup, June 2018Laure Vergeron
 
Navigate Data Service using AWS
Navigate Data Service using AWSNavigate Data Service using AWS
Navigate Data Service using AWSArno Broekhof
 
2018 04-06 kubernetes ingress in production
2018 04-06 kubernetes ingress in production2018 04-06 kubernetes ingress in production
2018 04-06 kubernetes ingress in productionSandor Szuecs
 
AWS Services for Content Production
AWS Services for Content ProductionAWS Services for Content Production
AWS Services for Content ProductionAmazon Web Services
 
Born in the Cloud; Build it Like a Startup
Born in the Cloud; Build it Like a StartupBorn in the Cloud; Build it Like a Startup
Born in the Cloud; Build it Like a StartupAmazon Web Services
 
Dragonflow Austin Summit Talk
Dragonflow Austin Summit Talk Dragonflow Austin Summit Talk
Dragonflow Austin Summit Talk Eran Gampel
 
Building a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in dockerBuilding a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in dockerJorge Juan Mendoza
 

Ähnlich wie SiddharthAnand_NetflixsCloudDataArchitecture (20)

Linked in nosql_atnetflix_2012_v1
Linked in nosql_atnetflix_2012_v1Linked in nosql_atnetflix_2012_v1
Linked in nosql_atnetflix_2012_v1
 
Netflix keynote-adrian-qcon
Netflix keynote-adrian-qconNetflix keynote-adrian-qcon
Netflix keynote-adrian-qcon
 
Svccg nosql 2011_v4
Svccg nosql 2011_v4Svccg nosql 2011_v4
Svccg nosql 2011_v4
 
Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...
Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...
Customer Case Study: Land Registry as a Service in the Cloud - AWS PS Summit ...
 
Global Netflix Platform
Global Netflix PlatformGlobal Netflix Platform
Global Netflix Platform
 
CloudFork
CloudForkCloudFork
CloudFork
 
AWS Services Eagle View Dec-2017
AWS Services Eagle View Dec-2017AWS Services Eagle View Dec-2017
AWS Services Eagle View Dec-2017
 
Netflix in the cloud 2011
Netflix in the cloud 2011Netflix in the cloud 2011
Netflix in the cloud 2011
 
So There’s This Amazon Thing
So There’s This Amazon ThingSo There’s This Amazon Thing
So There’s This Amazon Thing
 
Netflix's Transition to High-Availability Storage (QCon SF 2010)
Netflix's Transition to High-Availability Storage (QCon SF 2010)Netflix's Transition to High-Availability Storage (QCon SF 2010)
Netflix's Transition to High-Availability Storage (QCon SF 2010)
 
Migrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global CassandraMigrating Netflix from Datacenter Oracle to Global Cassandra
Migrating Netflix from Datacenter Oracle to Global Cassandra
 
Netflix and Open Source
Netflix and Open SourceNetflix and Open Source
Netflix and Open Source
 
Randall Hunt - AWS Midwest Community Day Keynote
Randall Hunt - AWS Midwest Community Day KeynoteRandall Hunt - AWS Midwest Community Day Keynote
Randall Hunt - AWS Midwest Community Day Keynote
 
Zenko & MetalK8s @ Dublin Docker Meetup, June 2018
Zenko & MetalK8s @ Dublin Docker Meetup, June 2018Zenko & MetalK8s @ Dublin Docker Meetup, June 2018
Zenko & MetalK8s @ Dublin Docker Meetup, June 2018
 
Navigate Data Service using AWS
Navigate Data Service using AWSNavigate Data Service using AWS
Navigate Data Service using AWS
 
2018 04-06 kubernetes ingress in production
2018 04-06 kubernetes ingress in production2018 04-06 kubernetes ingress in production
2018 04-06 kubernetes ingress in production
 
AWS Services for Content Production
AWS Services for Content ProductionAWS Services for Content Production
AWS Services for Content Production
 
Born in the Cloud; Build it Like a Startup
Born in the Cloud; Build it Like a StartupBorn in the Cloud; Build it Like a Startup
Born in the Cloud; Build it Like a Startup
 
Dragonflow Austin Summit Talk
Dragonflow Austin Summit Talk Dragonflow Austin Summit Talk
Dragonflow Austin Summit Talk
 
Building a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in dockerBuilding a sdn solution for the deployment of web application stacks in docker
Building a sdn solution for the deployment of web application stacks in docker
 

Mehr von Kostas Mavridis

GlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineeringGlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineeringKostas Mavridis
 
PatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMindPatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMindKostas Mavridis
 
DanNorth_FromMonthsToMinutesUppingTheStakes
DanNorth_FromMonthsToMinutesUppingTheStakesDanNorth_FromMonthsToMinutesUppingTheStakes
DanNorth_FromMonthsToMinutesUppingTheStakesKostas Mavridis
 
KevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKostas Mavridis
 
BernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosionBernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosionKostas Mavridis
 
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...Kostas Mavridis
 
MarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCenturyMarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCenturyKostas Mavridis
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jqueryKostas Mavridis
 
NickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScaleNickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScaleKostas Mavridis
 

Mehr von Kostas Mavridis (9)

GlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineeringGlennVanderburg_CraftAndSoftwareEngineering
GlennVanderburg_CraftAndSoftwareEngineering
 
PatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMindPatrickKua_TheBeginnersMind
PatrickKua_TheBeginnersMind
 
DanNorth_FromMonthsToMinutesUppingTheStakes
DanNorth_FromMonthsToMinutesUppingTheStakesDanNorth_FromMonthsToMinutesUppingTheStakes
DanNorth_FromMonthsToMinutesUppingTheStakes
 
KevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitecture
 
BernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosionBernhardMerkle_StopTheArchitectureErosion
BernhardMerkle_StopTheArchitectureErosion
 
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
 
MarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCenturyMarkLittle_EnterpriseMiddlewareForThe21stCentury
MarkLittle_EnterpriseMiddlewareForThe21stCentury
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
NickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScaleNickKallen_DataArchitectureAtTwitterScale
NickKallen_DataArchitectureAtTwitterScale
 

SiddharthAnand_NetflixsCloudDataArchitecture

  • 2. 2 Talks @ QCon London ™  Whitepaper : Netflix’s Transition to High- Availability Storage Systems ™  Title : Netflix’s Cloud Data Architecture ™  Track : Architectures You’ve Always Wondered About ™  General Overview ™  Data Replication Deep Dive ™  Title : NoSQL @ Netflix ™  Track : NoSQL : Where and How ™  SimpleDB, S3, and Cassandra @r39132 2
  • 3.
  • 4. What is Netflix? Circa 1997 ™  Rent a Movie ™  Right of first sale ™  Buy a Movie ™  Any retailer (e.g. Walmart) or e-tailer (e.g. Amazon) @r39132 4
  • 5. What is Netflix? ™  A brick-and-mortar store can only hold ~1k-2k titles ™  Which DVD titles do they pick? ™  Brand New Releases ™  Long-standing Hits (e.g. The Godfather) ™  Brand New Releases are expensive ™  Stores profit by re-renting the same video within a short time frame (i.e. DVD Availability Window) ™  Must impose steep rental fees and steeper late fees @r39132 5
  • 6. What is Netflix? Circa 1997 ™  Netflix saw opportunity in the long-tail business ™  We store >120K titles in our 50+ shipping hubs ™  We recommend movies in the long tail, personalized to the customer, lowering costs @r39132 6
  • 7. What is Netflix? In 1999 ™  Netflix launches DVD rentals-by-mail ™  Unlimited rentals for a flat monthly fee ™  No due dates ™  No late fees ™  No shipping or handling fees @r39132 7
  • 8. What is Netflix? After a few years… @r39132 8
  • 9. What is Netflix? Fast Forward to 2008 ™  Netflix forecasts the gradual end of the DVD and starts switching to Movie Streaming ™  Upside? ™  We spend $500MM to $600MM annually on US Postage for DVD mailing ™  Streaming a movie is 1/100th the cost of shipping a DVD ™  Easier to craft a business model for international expansion @r39132 9
  • 10. What is Netflix? •  We have 20M+ subscribers in the US and Canada •  Uses 20% of US peak downstream bandwidth •  1st or 2nd largest CDN user in the US 25 20 15 10 5 0 Source: http://ir.netflix.com 10
  • 11. What is Netflix? Grew subscribers 2008-2010 by partnering with device makers ™  Game Consoles ™  Xbox 360, Wii, PS3 ™  Mobile Devices ™  Apple IPad, IPhone, IPod Touch, Windows 7 @r39132 11
  • 13. Our Cloud Story ™  Circa late 2008, Netflix had a single data center ™  Single-point-of-failure (a.k.a. SPOF) ™  Approaching limits on cooling, power, space, traffic capacity ™  Alternatives ™  Build more data centers ™  Outsource our capacity planning and scale out ™  Allows us to focus on core competencies @r39132 13
  • 14. Our Cloud Story ™  Winner : Outsource our capacity planning and scale out ™  Leverage a leading Infrastructure-as-a-service provider ™  Amazon Web Services ™  Footnote : A short 2 years later, we serve >90% of our traffic out of AWS ™  excluding the video streaming bits, which come from CDNs @r39132 14
  • 16. How Netflix Uses AWS AWS provides various IAAS offerings, but applications need more! AWS IAAS •  Persistence ? •  SimpleDB, RDS, S3, EBS Netflix •  Load Handling •  EC2, EMR, ASG, ELB Applications •  Monitoring •  CloudWatch @r39132 16
  • 17. How Netflix Uses AWS AWS provides various IAAS offerings, but applications need more! Hence the need for Netflix’s infrastructure team to bridge the gap! AWS IAAS Netflix Platform •  Persistence •  Platform.jar •  SimpleDB, RDS, S3, •  Middle-tier Load EBS •  Load Handling Balancing Netflix •  EC2, EMR, ASG, ELB •  Discovery Applications •  Monitoring •  Encryption Services •  CloudWatch •  Caching •  Configuration @r39132 17
  • 18. How Netflix Uses AWS AWS ELB Netflix edge services (e.g. WWW) WWW EC2 EC2 ? Netflix mid-tier services (e.g. Q or Merch services) EC2 EC2 EC2 EC2 Q Merch AWS IAAS Simple S3 SQS DB @r39132 18
  • 19. Our Cloud Story AWS ELB Netflix edge services (e.g. WWW) WWW EC2 EC2 Netflix Platform Middle Tier Load Balancer Discovery Netflix mid-tier services (e.g. Q or Merch services) w/ platform.jar EC2 EC2 EC2 EC2 Q Merch AWS IAAS Simple S3 SQS DB @r39132 19
  • 20. How Netflix Uses AWS (EC2 Stack) Application Platform & Other Infrastructure jars Discovery Client MT Load Balancer Crypto Client S3 Client SimpleDB Client SQS Client EVCache Client Configuration Client Guest OS / VM / Host OS / Machine @r39132 20
  • 21. The Netflix Data Platform
  • 22. How Netflix Uses AWS ™  Persistence in the Cloud (c.f. NoSQL @ Netflix talk) ™  SimpleDB ™  S3 ™  Cassandra ™  Data Replication ™  IR (a.k.a. Item Replicator) ™  HAProxy + Squid + Oracle à temporary @r39132 22
  • 24. Persistence : SimpleDB Terminology SimpleDB Hash Table Relational Databases Domain Hash Table Table Item Entry Row Item Name Key Mandatory Primary Key Attribute Part of the Entry Value Column @r39132 24
  • 25. Persistence : SimpleDB Soccer Players Key Value Nickname = Wizard of Teams = Leeds United, ab12ocs12v9 First Name = Harold Last Name = Kewell Oz Liverpool, Galatasaray Nickname = Czech Teams = Lazio, b24h3b3403b First Name = Pavel Last Name = Nedved Cannon Juventus Teams = Sporting, Manchester United, cc89c9dc892 First Name = Cristiano Last Name = Ronaldo Real Madrid SimpleDB’s salient characteristics •  SimpleDB offers a range of consistency options •  SimpleDB domains are sparse and schema-less •  The Key and all Attributes are indexed •  Each item must have a unique Key •  An item contains a set of Attributes •  Each Attribute has a name •  Each Attribute has a set of values •  All data is stored as UTF-8 character strings (i.e. no support for types such as numbers or dates) @r39132 25
  • 26. Persistence : SimpleDB ™  Moved some of our largest transactional data sets to SimpleDB in 2010 ™  e.g. RENTAL HISTORY : Everything that anyone has watched at Netflix, including streaming and DVD ™  We have ™  ~ thousands of domains ™  ~ 1TB of OLTP/transactional data (i.e. no CLOBS or BLOBS) ™  ~ billions of rows of data (a.k.a. items) ™  We execute billions of SimpleDB statements per day @r39132 26
  • 27. S3
  • 28. Persistence : S3 ™  Simple KV store organized as objects in buckets ™  Each AWS account is given a max of 10 buckets ™  Each bucket can hold an unlimited number of objects ™  We use S3 to store data that does not fit into SimpleDB ™  Logs from streaming devices ™  Files used in movie encoding ™  Truncated-tail of Rental History ™  Good pattern introduced by Greg Kim @r39132 28
  • 29. Item Replicator Data Replication between Oracle, SimpleDB, S3, and Cassandra
  • 30. Data Replication : IR ™  Home-grown Data Replication Framework known as IR for Item Replication ™  Keeps data in sync between RDBMS (DC) and NoSQL (Cloud) ™  Mostly unidirectional: DC à Cloud ™  2 data capture schemes in use currently ™  Trigger-oriented IR ™  All CRUD operations on source table X are copied via a trigger to XLog_i journal tables (i is the shard index) ™  IR reads (polls) from a journal table ™  Simple IR ™  IR reads (polls) from source table X directly @r39132 30
  • 31. IR
  • 32. Data Capture Schemes : IR ™  Trigger-oriented IR (e.g. Movie Q) Table XLog_0 IR 0 CRUD artition Write p rite partit ion 1 Table XLog_1 IR W Table X Write partition 2 AWS Write Table XLog_2 IR partit ion 3 Table XLog_3 IR Netflix Data Center @r39132 32
  • 33. Data Capture Schemes : IR ™  Simple IR (e.g. Rental History) IR rti tion 0 CRU Re ad pa R ead parti tion 1 IR Table X AWS Read partition 2 IR Read partit ion 3 IR Netflix Data Center @r39132 33
  • 34.
  • 35. IR’s Polling Select ™  Anatomy of an IR Select Query ™  Execute the SQL below as a recurring poll select * from RENTAL_HISTORY r where r.LAST_MODIFIED_TS > checkpoint value ß (A) and r.LAST_MODIFIED_TS < (now-10 seconds) ß (B) order by r.LAST_MODIFIED_TS asc ß (C) ™  (A) – preserves progress in case IR crashes and restarts ™  (B) – handles interesting race condition… will explain in later slide ™  (C) – in order read for repeatability as in (A) @r39132 35
  • 36. IR’s Polling Select ™  Anatomy of an IR Select Query ™  Assume previous checkpoint is T0 ™  @ time = T4, only the top 2 records are visible and will be replicated ™  (B) hides The Town and Duma ™  {1, The Machinist} and then {2, Blood Diamond} are replicated to the cloud ™  After IR replicates this data, the checkpoint is now T2 Customer_ID Movie_ID last_modified_ts 1 The Machinist T1 ß 2 Blood Diamond T2 ß 4 The Town T4 - 3sec 1 Duma T4 @r39132 36
  • 37. IR’s Polling Select ™  Anatomy of an IR Select Query ™  Assume previous checkpoint is T2 ™  @ time = T4+12 sec, The 3 records pointed to by arrows are visible and replicated to the cloud ™  Of these 1 new record, The King’s Speech, became visible in time to be replicated – Commit-delayed Customer_ID Movie_ID last_modified_ts 1 The Machinist T1 2 Blood Diamond T2 4 The Town T4 – 3 sec ß new 3 The King’s Speech T4 ß 1 Duma T4 ß new 5 Rescue Dawn T4 + 11 sec @r39132 37
  • 38. IR’s Polling Select ™  “Commit-delayed” Race Condition ™  Consider 2 update transactions ™  Transaction 1 update RENTAL_HISTORY r set r.LAST_MODIFIED_TS = systimestamp, r.MOVIE_ID = ‘The Machinest good’ where r.CUSTOMER_ID = 1; commit; ™  Transaction 2 update RENTAL_HISTORY r set r.LAST_MODIFIED_TS = systimestamp, r.MOVIE_ID = ‘Blood Diamond good’ where r.CUSTOMER_ID = 2; commit; @r39132 38
  • 39. IR’s Polling Select ™  One possible schedule ™  Transaction 1 update RENTAL_HISTORY r set r.LAST_MODIFIED_TS = systimestamp @T1 r.MOVIE_ID = ‘The Machinest good’ where r.CUSTOMER_ID = 1; commit; @T4 ™  Transaction 2 update RENTAL_HISTORY r set r.LAST_MODIFIED_TS = systimestamp, @T2 r.MOVIE_ID = ‘Blood Diamond good’ where r.CUSTOMER_ID = 2; commit; @T3 @r39132 39
  • 40. IR’s Polling Select Customer_ID Movie_ID last_modified_ts 1 The Machinist bad T0 2 Blood Diamond bad T0 -- Transaction 2 commits at T3, but records T2 Customer_ID Movie_ID last_modified_ts 1 The Machinist bad T0 2 Blood Diamond good T2 -- IR replicates “Blood Diamond good” and sets checkpoint = T2 -- Transaction 1 commits at T4, but records T1 Customer_ID Movie_ID last_modified_ts 1 The Machinist good T1 2 Blood Diamond good T2 -- IR will never see “The Machinist good” because checkpoint already advanced past T1 to T2 @r39132 40
  • 41. IR’s Polling Select ™  Solving the “Commit-delayed” Race Condition ™  Transaction 1 update RENTAL_HISTORY r set r.LAST_MODIFIED_TS = systimestamp, r.MOVIE_ID = ‘The Machinest good’ where r.CUSTOMER_ID = 1 and r.last_modified_ts < (now – 10 sec); commit; ™  Transaction 2 update RENTAL_History r set r.LAST_MODIFIED_TS = systimestamp, r.MOVIE_ID = ‘Blood Diamond good’ where r.CUSTOMER_ID = 2; and r.last_modified_ts < (now – 10 sec); commit; @r39132 41
  • 42.
  • 43. Forklifting Historical Data ™  Fork-lifting Data – TRICKS! ™  Trigger-oriented IR ™  Trickle-lifting ™  Parallel fork-lifting and incremental replication ™  Simple IR ™  Typically need to forklift by recovering a snapshot in a second database ™  Execute forklift of that data ™  Assume database snapshot @ time = T1 ™  In the primary database, buffer modifications until forklift complete ™  One forklift is complete, replicate data changed after time=T1 @r39132 43
  • 45. Forklifting Historical Data ™  Trickle-lifting Data for the movie Q ™  User with id=6 adds a movie to his queue ™  Trigger fires to replicate that data to QLOG_6 (e.g. 6 % 10 shards = 6) ™  Along the way, the trigger checks whether user with id=6 is found in the member_progress table ™  If not, the user id is inserted into the member_progress table ™  If so, no action is taken ™  A separate program called QTouch will notice a new record while polling the member_progress table : user id = 6 ™  QTouch will execute a harmless update of all records for the user to fork-lift that user’s data into the cloud @r39132 45
  • 46. Best Practices : IR ™  Data Model Best Practices ™  Checkpoint Column ™  Choose a Timestamp not Date data type (i.e. for microsecond granularity) or an ordered sequence ™  Need a Before Trigger to set the timestamp or sequence ™  Don’t trust what is passed in by DB clients ™  Index the column @r39132 46
  • 47. HAProxy + Squid + Oracle Data lives in Oracle but is cached in the cloud
  • 48. Data Replication : HAProxy+Squid+Oracle @r39132 48