SlideShare una empresa de Scribd logo
1 de 60
real-time delivery architecture


                                         @raffi
                                  qcon nyc 2012
http://twitpic.com/135xa -
There’s a plane in the
Hudson. I’m on a ferry
going to pick up the
people. Crazy.
15 Jan 09
Janis Krums @jkrums
this is barack - let's get
this started! -bo
24 May 12
The White House
@whitehouse
what are the goals?
⇢ evolve from being solely a web stack
ROUTING   PRESENTATION   LOGIC   STORAGE &
                                 RETRIEVAL




                                   T-Bird




                                  T-Flock +
                                    Haplo

             Monorail


                                  Darkwing




                                  Flock(s)
what are the goals?
⇢ evolve from being solely a web stack
⇢ isolate responsibilities and concerns
⇢ site speed and reliability
⇢ developer innovation speed
Pull                Push
Targeted twitter.com          User / Site Streams
          home_timeline API   Mobile Push (SMS, etc.)

Queried Search API            Track / Follow Streams
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Cache
                                                         HTTP Push
Redis                       Redis
 Redis                       Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Write API




                                                                   Social
         Ingester                     Fanout                       Graph
                                                                   Service




insert




                                                                                                       Batch Compute
                                                 Timeline Cache




                                                                               Push Compute
                      Search Cache
                                                                  HTTP Push
         Redis                       Redis
          Redis                       Redis                                                   Hadoop
          Earlybird                    Redis

⇢ keyed off
                                                                      Mobile
                                                                      Push


  “recipient”
                                     Timeline

⇢ pipelined 4k
         Blender
                                     Service



  “destinations”
  at a time
⇢ replicated
Write API




          Ingester                     Fanout




using redis




                                                                                                                   Batch Compute
                                                  Timeline Cache




                                                                                    Push Compute
                       Search Cache
                                                                   Tweet IDPush User ID
                                                                    HTTP                            Bits
          Redis                       Redis
           Redis                       Redis                                                              Hadoop
           Earlybird                    Redis                      8 bytes      8 bytes            4 bytes

⇢ native list
                                                                         Mobile
                                                                           Push


  structure
                                      Timeline

⇢ RPUSHX to
          Blender
                                      Service



  only add to
  cached
  timelines
Write API




          Ingester                     Fanout




using redis




                                                                                                                 Batch Compute
                                                  Timeline Cache




                                                                                    Push Compute
                       Search Cache
                                                                   Tweet IDPush User ID
                                                                    HTTP                           Bits
          Redis                       Redis
           Redis                       Redis                       Tweet ID     User ID            Bits Hadoop
           Earlybird                    Redis

⇢ native list
                                                                          Mobile
                                                                   Tweet ID      User ID           Bits
                                                                           Push


  structure
                                                                   Tweet ID     User ID            Bits

                                                                   Tweet ID     User ID            Bits
                                      Timeline

⇢ RPUSHX to
          Blender                                                  Tweet ID     User ID            Bits
                                      Service

                                                                   Tweet ID     User ID            Bits

  only add to                                                      Tweet ID     User ID            Bits

  cached                                                           Tweet ID     User ID            Bits


  timelines
                                                                   Tweet ID     User ID            Bits
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Cache
                                                         HTTP Push
Redis                       Redis
 Redis                       Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Pull                Push
Targeted twitter.com          User / Site Streams
          home_timeline API   Mobile Push (SMS, etc.)

Queried Search API            Track / Follow Streams
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Write API




Ingester                     Fanout




                                                         blender




                                                                                                Batch Compute
                                        Timeline Cache




                                                                        Push Compute
             Search Index
                                                           HTTP Push
Redis                       Redis
Earlybird                    Redis                                                     Hadoop
 Earlybird                    Redis

                                                         ⇢ queries one
                                                               Mobile
                                                               Push


                                                           replica of all
Blender
                            Timeline
                            Service                        indexes
                                                         ⇢ merges &
                                                           ranks results
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Pull                Push
Targeted twitter.com          User / Site Streams
          home_timeline API   Mobile Push (SMS, etc.)

Queried Search API            Track / Follow Streams
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
http push / hosebird
⇢ maintains persistent connections with
  end clients
⇢ processes tweet & social graph events
⇢ event-based “router”
Hosebird   Firehose

    Write API   Hosebird              User Streams

                           Hosebird   Track / Follow




event propagation
⇢ write API sends all events into hosebird;
  sees content creation events, social graph
  changes, etc.
⇢ different queues for public tweets,
  protected tweets, social events, etc.
Hosebird   Firehose

   Write API    Hosebird              User Streams

                           Hosebird   Track / Follow




event cascading
⇢ bandwidth management
⇢ simultaneous connection management
  (~1m long lived & open connections to this
  cluster)
Hosebird   Firehose

   Write API   Hosebird              User Streams

                          Hosebird   Track / Follow




firehose
⇢ edge machine simply outputs the public
  tweet queue
⇢ only allow a limited number of firehoses
  per hosebird box for bandwidth
  management
Hosebird   Firehose

    Write API    Hosebird              Track / Follow

                            Hosebird   User Streams




track / follow
⇢ simple query based on tweet content
⇢ keeps list of terms / users of interest
⇢ parses public tweets at the edge, and if
  term matches a token, or user is of
  interest, then route
Hosebird   Firehose

    Write API    Hosebird              Track / Follow

                            Hosebird   User Streams




user streams
⇢ replicate home timeline experience
⇢ upon login, obtain “following” list
⇢ keep cached following list coherent by
  seeing social graph updates
⇢ route tweet if from a followed user
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Pull                Push
Targeted twitter.com          User / Site Streams
          home_timeline API   Mobile Push (SMS, etc.)

Queried Search API            Track / Follow Streams
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Write API




Ingester                     Fanout




                                                                                               Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis                                                  Social
                                                             Mobile
                                                                                     Graph
                                                             Push
                                                                                     Service



                            Timeline
Blender
                            Service
Write API




Ingester                     Fanout




                                                                                               Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis                                                  Social
                                                             Mobile
                                                                                     Graph
                                                             Push
                                                                                     Service



                            Timeline
Blender
                            Service
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Pull                Push
Targeted twitter.com          User / Site Streams
          home_timeline API   Mobile Push (SMS, etc.)

Queried Search API            Track / Follow Streams
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
Synchronous Path

                            Write API




Ingester                     Fanout




                                                                                     Asynchronous Path




                                                                                                    Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                       Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender                                                                                     Query Path
                            Service
Synchronous Path

                            Write API




Ingester                     Fanout




                                                                                     Asynchronous Path




                                                                                                    Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                       Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender                                                                                     Query Path
                            Service
Synchronous Path

                            Write API




Ingester                     Fanout




                                                                                     Asynchronous Path




                                                                                                    Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                       Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender                                                                                     Query Path
                            Service
Write API
Read Path




                                                                                  Write Path
            Ingester                     Fanout




                                                                                                          Batch Compute
                                                    Timeline Cache




                                                                                  Push Compute
                         Search Index
                                                                     HTTP Push
            Redis                       Redis
            Earlybird                    Redis                                                   Hadoop
             Earlybird                    Redis
                                                                         Mobile
                                                                         Push



                                        Timeline
            Blender
                                        Service
Write API
Read Path




                                                                                  Write Path
            Ingester                     Fanout




                                                                                                          Batch Compute
                                                    Timeline Cache




                                                                                  Push Compute
                         Search Index
                                                                     HTTP Push
            Redis                       Redis
            Earlybird                    Redis                                                   Hadoop
             Earlybird                    Redis
                                                                         Mobile
                                                                         Push



                                        Timeline
            Blender
                                        Service
things we’re trying...
Write API




Ingester                    Fanout




                                      Timeline Cache
Redis        Search Index   Redis
Earlybird                    Redis
 Earlybird                    Redis
Write API




                     Ingester                    Fanout




                                                           Timeline Cache
                     Redis        Search Index   Redis
                     Earlybird                    Redis
                      Earlybird                    Redis




search index                                               fanout index
⇢[‘hello’,‘world’]                                    ⇢[@danadanger, ...]
User Intent          Query Expansion

    “Hello, world”       “Hello” AND “world”


@raffi’s home timeline   home_timeline:raffi
User Intent            Query Expansion

    “Hello, world”         “Hello” AND “world”

                           user_timeline:nelson
@raffi’s home timeline              OR
                         user_timeline:danadanger
Write API



fan-in                                                                fan-out
⇢ O(1) write                                                          ⇢ O(n) write
               Ingester                    Fanout




⇢ O(n) read                                                           ⇢ O(1) read




                                                     Timeline Cache
               Redis        Search Index   Redis
               Earlybird                    Redis
                Earlybird                    Redis
User Intent          Query Expansion

    “Hello, world”       “Hello” AND “world”


@raffi’s home timeline   home_timeline:raffi
User Intent             Query Expansion

    “Hello, world”          “Hello” AND “world”

                            home_timeline:raffi
@raffi’s home timeline               OR
                         user_timeline:taylorswift13
streaming compute
⇢ continuous computation
⇢ driven by the events that come into
  twitter
⇢ generalizing the push mechanism
Write API




Ingester                     Fanout




                                                                                              Batch Compute
                                        Timeline Cache




                                                                      Push Compute
             Search Index
                                                         HTTP Push
Redis                       Redis
Earlybird                    Redis                                                   Hadoop
 Earlybird                    Redis
                                                             Mobile
                                                             Push



                            Timeline
Blender
                            Service
timeline query statistics
⇢ >150m active users worldwide
⇢ 300k qps poll-based timelines
  @ 1ms p50 / 4ms p99
⇢ 30k qps search-based timelines
tweet input
⇢ ~340m tweets per day
⇢ ~4K/sec daily average
⇢ ~6K/sec daily peak
⇢ >10K/sec during large events
followed by   following
timeline delivery statistics
⇢ 26b deliveries / day (~18m / min)
⇢ 3.5 seconds @ p50 to deliver to 1m
⇢ ~300k deliveries / sec
thanks!

Más contenido relacionado

Destacado

Mobile Application Architecture Strategy
Mobile Application Architecture StrategyMobile Application Architecture Strategy
Mobile Application Architecture StrategyGary Wong
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Developmentjini james
 
architecture of mobile software applications
architecture of mobile software applicationsarchitecture of mobile software applications
architecture of mobile software applicationsHassan Dar
 
Mobile Application Design & Development
Mobile Application Design & DevelopmentMobile Application Design & Development
Mobile Application Design & DevelopmentRonnie Liew
 
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907NodejsFoundation
 

Destacado (6)

Mobile Application Architecture Strategy
Mobile Application Architecture StrategyMobile Application Architecture Strategy
Mobile Application Architecture Strategy
 
Mobile Application Development
Mobile Application DevelopmentMobile Application Development
Mobile Application Development
 
architecture of mobile software applications
architecture of mobile software applicationsarchitecture of mobile software applications
architecture of mobile software applications
 
Mobile Application Design & Development
Mobile Application Design & DevelopmentMobile Application Design & Development
Mobile Application Design & Development
 
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907
 
The AI Rush
The AI RushThe AI Rush
The AI Rush
 

Más de Raffi Krikorian

Re-architecting on the Fly #OReillySACon
Re-architecting on the Fly #OReillySACon Re-architecting on the Fly #OReillySACon
Re-architecting on the Fly #OReillySACon Raffi Krikorian
 
Twitter: Engineering for Real-Time (Stanford ACM 2011)
Twitter: Engineering for Real-Time (Stanford ACM 2011)Twitter: Engineering for Real-Time (Stanford ACM 2011)
Twitter: Engineering for Real-Time (Stanford ACM 2011)Raffi Krikorian
 
Securing Your Ecosystem (FOWA Las Vegas 2011)
Securing Your Ecosystem (FOWA Las Vegas 2011)Securing Your Ecosystem (FOWA Las Vegas 2011)
Securing Your Ecosystem (FOWA Las Vegas 2011)Raffi Krikorian
 
Developing for @twitterapi (Techcrunch Disrupt Hackathon)
Developing for @twitterapi (Techcrunch Disrupt Hackathon)Developing for @twitterapi (Techcrunch Disrupt Hackathon)
Developing for @twitterapi (Techcrunch Disrupt Hackathon)Raffi Krikorian
 
Twitter for CS10 @ Berkeley (Spring 2011)
Twitter for CS10 @ Berkeley (Spring 2011)Twitter for CS10 @ Berkeley (Spring 2011)
Twitter for CS10 @ Berkeley (Spring 2011)Raffi Krikorian
 
Twitter by the Numbers (Columbia University)
Twitter by the Numbers (Columbia University)Twitter by the Numbers (Columbia University)
Twitter by the Numbers (Columbia University)Raffi Krikorian
 
Twitter and the Real-Time Web
Twitter and the Real-Time WebTwitter and the Real-Time Web
Twitter and the Real-Time WebRaffi Krikorian
 
Twitter - Guest Lecture UC Berkeley CS10 Fall 2010
Twitter - Guest Lecture UC Berkeley CS10 Fall 2010Twitter - Guest Lecture UC Berkeley CS10 Fall 2010
Twitter - Guest Lecture UC Berkeley CS10 Fall 2010Raffi Krikorian
 
Developing for @twitterapi #hack4health
Developing for @twitterapi #hack4healthDeveloping for @twitterapi #hack4health
Developing for @twitterapi #hack4healthRaffi Krikorian
 
Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)Raffi Krikorian
 
How to use Geolocation in your webapp @ FOWA Dublin 2010
How to use Geolocation in your webapp @ FOWA Dublin 2010How to use Geolocation in your webapp @ FOWA Dublin 2010
How to use Geolocation in your webapp @ FOWA Dublin 2010Raffi Krikorian
 
Intro to developing for @twitterapi
Intro to developing for @twitterapiIntro to developing for @twitterapi
Intro to developing for @twitterapiRaffi Krikorian
 
"What's Happening" to "What's Happening Here" @ Chirp
"What's Happening" to "What's Happening Here" @ Chirp"What's Happening" to "What's Happening Here" @ Chirp
"What's Happening" to "What's Happening Here" @ ChirpRaffi Krikorian
 

Más de Raffi Krikorian (20)

Hacking Conway's Law
Hacking Conway's LawHacking Conway's Law
Hacking Conway's Law
 
Re-architecting on the Fly #OReillySACon
Re-architecting on the Fly #OReillySACon Re-architecting on the Fly #OReillySACon
Re-architecting on the Fly #OReillySACon
 
Twitter: Engineering for Real-Time (Stanford ACM 2011)
Twitter: Engineering for Real-Time (Stanford ACM 2011)Twitter: Engineering for Real-Time (Stanford ACM 2011)
Twitter: Engineering for Real-Time (Stanford ACM 2011)
 
Securing Your Ecosystem (FOWA Las Vegas 2011)
Securing Your Ecosystem (FOWA Las Vegas 2011)Securing Your Ecosystem (FOWA Las Vegas 2011)
Securing Your Ecosystem (FOWA Las Vegas 2011)
 
Developing for @twitterapi (Techcrunch Disrupt Hackathon)
Developing for @twitterapi (Techcrunch Disrupt Hackathon)Developing for @twitterapi (Techcrunch Disrupt Hackathon)
Developing for @twitterapi (Techcrunch Disrupt Hackathon)
 
#rtgeo (Where 2.0 2011)
#rtgeo (Where 2.0 2011)#rtgeo (Where 2.0 2011)
#rtgeo (Where 2.0 2011)
 
500Startups @ Twitter
500Startups @ Twitter500Startups @ Twitter
500Startups @ Twitter
 
Twitter for CS10 @ Berkeley (Spring 2011)
Twitter for CS10 @ Berkeley (Spring 2011)Twitter for CS10 @ Berkeley (Spring 2011)
Twitter for CS10 @ Berkeley (Spring 2011)
 
Twitter by the Numbers (Columbia University)
Twitter by the Numbers (Columbia University)Twitter by the Numbers (Columbia University)
Twitter by the Numbers (Columbia University)
 
Users and Geo
Users and GeoUsers and Geo
Users and Geo
 
Twitter and the Real-Time Web
Twitter and the Real-Time WebTwitter and the Real-Time Web
Twitter and the Real-Time Web
 
Twitter - Guest Lecture UC Berkeley CS10 Fall 2010
Twitter - Guest Lecture UC Berkeley CS10 Fall 2010Twitter - Guest Lecture UC Berkeley CS10 Fall 2010
Twitter - Guest Lecture UC Berkeley CS10 Fall 2010
 
Developing for @twitterapi #hack4health
Developing for @twitterapi #hack4healthDeveloping for @twitterapi #hack4health
Developing for @twitterapi #hack4health
 
Twitter by the Numbers
Twitter by the NumbersTwitter by the Numbers
Twitter by the Numbers
 
Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)Intro to developing for @twitterapi (updated)
Intro to developing for @twitterapi (updated)
 
How to use Geolocation in your webapp @ FOWA Dublin 2010
How to use Geolocation in your webapp @ FOWA Dublin 2010How to use Geolocation in your webapp @ FOWA Dublin 2010
How to use Geolocation in your webapp @ FOWA Dublin 2010
 
Intro to developing for @twitterapi
Intro to developing for @twitterapiIntro to developing for @twitterapi
Intro to developing for @twitterapi
 
Twitter API Annotations
Twitter API AnnotationsTwitter API Annotations
Twitter API Annotations
 
"What's Happening" to "What's Happening Here" @ Chirp
"What's Happening" to "What's Happening Here" @ Chirp"What's Happening" to "What's Happening Here" @ Chirp
"What's Happening" to "What's Happening Here" @ Chirp
 
Energy / Tweet
Energy / TweetEnergy / Tweet
Energy / Tweet
 

Último

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

QCon NYC 2012: Twitter's Real Time Architecture

  • 1. real-time delivery architecture @raffi qcon nyc 2012
  • 2. http://twitpic.com/135xa - There’s a plane in the Hudson. I’m on a ferry going to pick up the people. Crazy. 15 Jan 09 Janis Krums @jkrums
  • 3.
  • 4. this is barack - let's get this started! -bo 24 May 12 The White House @whitehouse
  • 5. what are the goals? ⇢ evolve from being solely a web stack
  • 6. ROUTING PRESENTATION LOGIC STORAGE & RETRIEVAL T-Bird T-Flock + Haplo Monorail Darkwing Flock(s)
  • 7. what are the goals? ⇢ evolve from being solely a web stack ⇢ isolate responsibilities and concerns ⇢ site speed and reliability ⇢ developer innovation speed
  • 8.
  • 9. Pull Push Targeted twitter.com User / Site Streams home_timeline API Mobile Push (SMS, etc.) Queried Search API Track / Follow Streams
  • 10.
  • 11.
  • 12.
  • 13. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Cache HTTP Push Redis Redis Redis Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 14. Write API Social Ingester Fanout Graph Service insert Batch Compute Timeline Cache Push Compute Search Cache HTTP Push Redis Redis Redis Redis Hadoop Earlybird Redis ⇢ keyed off Mobile Push “recipient” Timeline ⇢ pipelined 4k Blender Service “destinations” at a time ⇢ replicated
  • 15. Write API Ingester Fanout using redis Batch Compute Timeline Cache Push Compute Search Cache Tweet IDPush User ID HTTP Bits Redis Redis Redis Redis Hadoop Earlybird Redis 8 bytes 8 bytes 4 bytes ⇢ native list Mobile Push structure Timeline ⇢ RPUSHX to Blender Service only add to cached timelines
  • 16. Write API Ingester Fanout using redis Batch Compute Timeline Cache Push Compute Search Cache Tweet IDPush User ID HTTP Bits Redis Redis Redis Redis Tweet ID User ID Bits Hadoop Earlybird Redis ⇢ native list Mobile Tweet ID User ID Bits Push structure Tweet ID User ID Bits Tweet ID User ID Bits Timeline ⇢ RPUSHX to Blender Tweet ID User ID Bits Service Tweet ID User ID Bits only add to Tweet ID User ID Bits cached Tweet ID User ID Bits timelines Tweet ID User ID Bits
  • 17. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Cache HTTP Push Redis Redis Redis Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 18. Pull Push Targeted twitter.com User / Site Streams home_timeline API Mobile Push (SMS, etc.) Queried Search API Track / Follow Streams
  • 19. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 20. Write API Ingester Fanout blender Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis ⇢ queries one Mobile Push replica of all Blender Timeline Service indexes ⇢ merges & ranks results
  • 21. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 22. Pull Push Targeted twitter.com User / Site Streams home_timeline API Mobile Push (SMS, etc.) Queried Search API Track / Follow Streams
  • 23. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 24. http push / hosebird ⇢ maintains persistent connections with end clients ⇢ processes tweet & social graph events ⇢ event-based “router”
  • 25. Hosebird Firehose Write API Hosebird User Streams Hosebird Track / Follow event propagation ⇢ write API sends all events into hosebird; sees content creation events, social graph changes, etc. ⇢ different queues for public tweets, protected tweets, social events, etc.
  • 26. Hosebird Firehose Write API Hosebird User Streams Hosebird Track / Follow event cascading ⇢ bandwidth management ⇢ simultaneous connection management (~1m long lived & open connections to this cluster)
  • 27. Hosebird Firehose Write API Hosebird User Streams Hosebird Track / Follow firehose ⇢ edge machine simply outputs the public tweet queue ⇢ only allow a limited number of firehoses per hosebird box for bandwidth management
  • 28. Hosebird Firehose Write API Hosebird Track / Follow Hosebird User Streams track / follow ⇢ simple query based on tweet content ⇢ keeps list of terms / users of interest ⇢ parses public tweets at the edge, and if term matches a token, or user is of interest, then route
  • 29. Hosebird Firehose Write API Hosebird Track / Follow Hosebird User Streams user streams ⇢ replicate home timeline experience ⇢ upon login, obtain “following” list ⇢ keep cached following list coherent by seeing social graph updates ⇢ route tweet if from a followed user
  • 30. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 31. Pull Push Targeted twitter.com User / Site Streams home_timeline API Mobile Push (SMS, etc.) Queried Search API Track / Follow Streams
  • 32. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 33. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Social Mobile Graph Push Service Timeline Blender Service
  • 34. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Social Mobile Graph Push Service Timeline Blender Service
  • 35. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 36. Pull Push Targeted twitter.com User / Site Streams home_timeline API Mobile Push (SMS, etc.) Queried Search API Track / Follow Streams
  • 37. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 38. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 39. Synchronous Path Write API Ingester Fanout Asynchronous Path Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Query Path Service
  • 40. Synchronous Path Write API Ingester Fanout Asynchronous Path Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Query Path Service
  • 41. Synchronous Path Write API Ingester Fanout Asynchronous Path Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Query Path Service
  • 42. Write API Read Path Write Path Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 43. Write API Read Path Write Path Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 45.
  • 46. Write API Ingester Fanout Timeline Cache Redis Search Index Redis Earlybird Redis Earlybird Redis
  • 47. Write API Ingester Fanout Timeline Cache Redis Search Index Redis Earlybird Redis Earlybird Redis search index fanout index ⇢[‘hello’,‘world’] ⇢[@danadanger, ...]
  • 48. User Intent Query Expansion “Hello, world” “Hello” AND “world” @raffi’s home timeline home_timeline:raffi
  • 49. User Intent Query Expansion “Hello, world” “Hello” AND “world” user_timeline:nelson @raffi’s home timeline OR user_timeline:danadanger
  • 50. Write API fan-in fan-out ⇢ O(1) write ⇢ O(n) write Ingester Fanout ⇢ O(n) read ⇢ O(1) read Timeline Cache Redis Search Index Redis Earlybird Redis Earlybird Redis
  • 51. User Intent Query Expansion “Hello, world” “Hello” AND “world” @raffi’s home timeline home_timeline:raffi
  • 52. User Intent Query Expansion “Hello, world” “Hello” AND “world” home_timeline:raffi @raffi’s home timeline OR user_timeline:taylorswift13
  • 53. streaming compute ⇢ continuous computation ⇢ driven by the events that come into twitter ⇢ generalizing the push mechanism
  • 54. Write API Ingester Fanout Batch Compute Timeline Cache Push Compute Search Index HTTP Push Redis Redis Earlybird Redis Hadoop Earlybird Redis Mobile Push Timeline Blender Service
  • 55. timeline query statistics ⇢ >150m active users worldwide ⇢ 300k qps poll-based timelines @ 1ms p50 / 4ms p99 ⇢ 30k qps search-based timelines
  • 56. tweet input ⇢ ~340m tweets per day ⇢ ~4K/sec daily average ⇢ ~6K/sec daily peak ⇢ >10K/sec during large events
  • 57.
  • 58. followed by following
  • 59. timeline delivery statistics ⇢ 26b deliveries / day (~18m / min) ⇢ 3.5 seconds @ p50 to deliver to 1m ⇢ ~300k deliveries / sec