SlideShare a Scribd company logo
1 of 64
Time and Ordering in
Streaming Distributed Systems
Zhenzhong Xu
Real-time Data Infrastructure
Netflix
@ZhenzhongXu
Time and Ordering in
Streaming Distributed Systems
Zhenzhong Xu
Real-time Data Infrastructure
.
@ZhenzhongXu
Software engineers think of time as -
● Uniformly measurable
● One directional
● Infinite precision
● Time manifests ordering of events
“Time no longer appears to us as a
gigantic, world-dominating chronos,
nor as a primitive entity, but as
something derived from phenomena
themselves. It is a figment of my
thinking.”
— Schrödinger, Erwin.
“Time is an illusion.”
— Einstein, Albert.
Distributed System
No shared memory, only message
passing via unreliable network with
variable delays, and the system may
suffer from partial failures, unreliable
clocks and processing pauses.
Stream processing connects
distributed systems together, over
space and time, designed with
unbounded data set in mind.
Stream Processing at Netflix
● Keystone Data Pipeline
● Operation insights
● Business analytics
● Event sourcing pattern
Categories of streaming
● Time agnostic
● Transformation
● Filtering
● Projection
● Enrichment
● Inner joins
Categories of streaming
● Time agnostic
● Approximation
● Approximate top-n
● Streaming k-means
● etc
Categories of streaming
● Time agnostic
● Approximation
● Windowing
● Fixed / Tumbling
● Sliding / Hopping
● Session / Dynamic
Project Delta
Eventual consistent, event-
driven data synchronization
platform
● Event sourcing
● Windowing
Challenges:
● Semantics of ordering
● Latency vs. durability
● CDC
● etc
… via the three lens of time
● Uniformity of time
● Arrow of time
● Perception of time
#1
Uniformity of time
Time is a tool ...
Time is a tool ...
Time is a tool ...
Need for synchronization?
= uniform time
Standing on the shoulder of giants
Time flows slower closer to a black hole
Scene from the movie Interstella, depicts time flows slow closer to the supermassive blackhole “Gargantuan”
Clock
synchronization
over network
“NTP can usually maintain time to
within tens of milliseconds over the
public Internet, and can achieve
better than one millisecond accuracy
in local area networks under ideal
conditions. Asymmetric routes and
network congestion can cause errors
of 100 ms or more.”
https://en.wikipedia.org/wiki/Network_Time_Protocol
Figure referenced from Designing Data Intensive Applications by Martin Kleppmann, Chapter 8 Trouble with Distributed Systems
Relying on synchronized wall clock timestamps?
Time in
Stream
Processing
https://ci.apache.org/projects/flink/flink-docs-stable/concepts/programming-model.html
Why time skews
● Information travel takes time
● Low power device
● Process failure
● Unpredictable network congestions
● Timeouts and unbounded delays
● Unreliable clock
● Process pauses
● etc
Figure referenced from Streaming Systems by Tyler Akidau el al, Chapter 1 Streaming 101
Watermark
in action
Animation referenced from Streaming Systems by Tyler Akidau el al, http://streamingbook.net/fig/2-11
Use watermark to bound the
uncertainties of time
● Allowed lateness
Figure referenced from Streaming Systems by Tyler Akidau el al, Chapter 2 Going Streaming: When and How
Project Delta
Watermark and
allowed lateness
POST arrives
outside allowed
lateness boundary
PRE event
duplicated
#2
Arrow of time
Boltzmann’s entropy formula
PRE ts: GMT: Saturday, November 17,
2018 7:10:00 AM
POST ts: GMT: Saturday, November
17, 2018 7:09:00 AM
Stream Processing
Custom windowing
Embed our blurred vision to
represent arrow of time in
custom triggers logic
Out of order event timestamp
#3
Perception of time
This is a story
about me and my
uncle ...
Me,
4 years old
My uncle, 2
years old
Imagine an ancestry tree includes all modern human
beings ...
When forcing a global generation order...
Can Bob and Dave be logically the
same generation?
What’s the meaning of “now”?
Light travels in a cone shape
over time ...
The light cone
representing the
past, present, and
future ...
https://en.wikipedia.org/wiki/Light_cone
Light cone
spacetime diagram
Revisit the ancestry
tree
The cone shape shows the
causal/partial ordering from
Dave’s frame of reference.
Lorentz transformation
Observers in different frame of
references perceive different
ordering of events
Relativity of Simultaneity
Time and Ordering depends
on frame of reference (space
and time!)
There is no deterministic global
ordering.
In a distributed system, it is
sometimes impossible to say
that one of two events
occurred first. The relation
“happened before” is
therefore only a partial
ordering of the events in the
system.
Figure referenced from wikipedia: https://en.wikipedia.org/wiki/Vector_clock
Partial/Causal ordering
An irreflexive partial ordering on a set A is
a relation on A that satisfies three
properties.
1. irreflexivity: a ⊀ a
2. antisymmetry: if a < b then b ⊀ a
3. transitivity: if a < b and b < c then a < c
Total ordering
An irreflexive total ordering is a irreflexive
partial ordering that satisfies another
condition.
4. totality: if a ≠ b then a < b or b< a.
Causal/Partial vs
Total ordering
Causal/Partial vs
Total ordering
Distributed Consensus and Atomic
Broadcast is the same thing!
Both requires total order broadcast.
Linearizability
… to make a system appear as if there is
only a single copy of the data.
Linearizability is the C in CAP theorem.
(practically no CA system, only CP)
Linearizability requires total ordering…
Consensus in a synchronous
environment can be resilient to faults.
FLP result shows that in an async
setting, where only one processor
might crash, there is no distributed
algorithm that solves the consensus
problem.
What happens when
an event get close to a
black hole’s event
horizon
This is very similar to how
process fails in distributed
systems, observer will never be
able to tell whether the process
crashed or simply will take long
time to respond
The 3 lens of time
● No uniformity of time
● Blurred direction of time
● Limited perception of time
Thank you.
Time and ordering in streaming distributed systems

More Related Content

What's hot

What's hot (20)

CS80A Foothill College Open Source Talk
CS80A Foothill College Open Source TalkCS80A Foothill College Open Source Talk
CS80A Foothill College Open Source Talk
 
Docker Usage Patterns - Meetup Docker Paris - November, 10th 2015
Docker Usage Patterns - Meetup Docker Paris - November, 10th 2015Docker Usage Patterns - Meetup Docker Paris - November, 10th 2015
Docker Usage Patterns - Meetup Docker Paris - November, 10th 2015
 
Microservices, Monoliths, SOA and How We Got Here
Microservices, Monoliths, SOA and How We Got HereMicroservices, Monoliths, SOA and How We Got Here
Microservices, Monoliths, SOA and How We Got Here
 
Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015Triangle Devops Meetup 10/2015
Triangle Devops Meetup 10/2015
 
Azure Messaging Crossroads
Azure Messaging CrossroadsAzure Messaging Crossroads
Azure Messaging Crossroads
 
Lifting the Blinds: Monitoring Windows Server 2012
Lifting the Blinds: Monitoring Windows Server 2012Lifting the Blinds: Monitoring Windows Server 2012
Lifting the Blinds: Monitoring Windows Server 2012
 
NetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & ContainersNetflixOSS Meetup S6E1 - Titus & Containers
NetflixOSS Meetup S6E1 - Titus & Containers
 
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
Monitoring Big Data Systems Done "The Simple Way" - Demi Ben-Ari - Codemotion...
 
Engineering Leader opportunity @ Netflix - Playback Data Systems
Engineering Leader opportunity @ Netflix - Playback Data SystemsEngineering Leader opportunity @ Netflix - Playback Data Systems
Engineering Leader opportunity @ Netflix - Playback Data Systems
 
Enforcing Application SLA with Congress and Monasca
Enforcing Application SLA with Congress and MonascaEnforcing Application SLA with Congress and Monasca
Enforcing Application SLA with Congress and Monasca
 
Netflix Cloud Platform and Open Source
Netflix Cloud Platform and Open SourceNetflix Cloud Platform and Open Source
Netflix Cloud Platform and Open Source
 
Keystone - ApacheCon 2016
Keystone - ApacheCon 2016Keystone - ApacheCon 2016
Keystone - ApacheCon 2016
 
Kafka Summit NYC 2017 - Every Message Counts: Kafka as a Foundation for Highl...
Kafka Summit NYC 2017 - Every Message Counts: Kafka as a Foundation for Highl...Kafka Summit NYC 2017 - Every Message Counts: Kafka as a Foundation for Highl...
Kafka Summit NYC 2017 - Every Message Counts: Kafka as a Foundation for Highl...
 
BDX 2016- Monal daxini @ Netflix
BDX 2016-  Monal daxini  @ NetflixBDX 2016-  Monal daxini  @ Netflix
BDX 2016- Monal daxini @ Netflix
 
Ceilosca
CeiloscaCeilosca
Ceilosca
 
Keystone - Leverage Big Data 2016
Keystone - Leverage Big Data 2016Keystone - Leverage Big Data 2016
Keystone - Leverage Big Data 2016
 
NetflixOSS Meetup S6E2 - Spinnaker, Kayenta
NetflixOSS Meetup S6E2 - Spinnaker, KayentaNetflixOSS Meetup S6E2 - Spinnaker, Kayenta
NetflixOSS Meetup S6E2 - Spinnaker, Kayenta
 
Leveraging services in stream processor apps at Ticketmaster (Derek Cline, Ti...
Leveraging services in stream processor apps at Ticketmaster (Derek Cline, Ti...Leveraging services in stream processor apps at Ticketmaster (Derek Cline, Ti...
Leveraging services in stream processor apps at Ticketmaster (Derek Cline, Ti...
 
Netflix Container Runtime - Titus - for Container Camp 2016
Netflix Container Runtime - Titus - for Container Camp 2016Netflix Container Runtime - Titus - for Container Camp 2016
Netflix Container Runtime - Titus - for Container Camp 2016
 
Virtualization at Gilt - Rangarajan Radhakrishnan
Virtualization at Gilt - Rangarajan RadhakrishnanVirtualization at Gilt - Rangarajan Radhakrishnan
Virtualization at Gilt - Rangarajan Radhakrishnan
 

Similar to Time and ordering in streaming distributed systems

Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...
Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...
Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...
Angelo Corsaro
 
Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.
Mikhail Panchenko
 
BIL406-Chapter-1-Introduction.ppt
BIL406-Chapter-1-Introduction.pptBIL406-Chapter-1-Introduction.ppt
BIL406-Chapter-1-Introduction.ppt
Kadri20
 

Similar to Time and ordering in streaming distributed systems (20)

Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...
Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...
Coupling-Based Internal Clock Synchronization for Large Scale Dynamic Distrib...
 
Ds ppt imp.
Ds ppt imp.Ds ppt imp.
Ds ppt imp.
 
Debunking Common Myths in Stream Processing
Debunking Common Myths in Stream ProcessingDebunking Common Myths in Stream Processing
Debunking Common Myths in Stream Processing
 
Sharing-akka-pub
Sharing-akka-pubSharing-akka-pub
Sharing-akka-pub
 
Clock.pdf
Clock.pdfClock.pdf
Clock.pdf
 
Impromptu ideas in respect of v2 v and other
Impromptu ideas in respect of v2 v and otherImpromptu ideas in respect of v2 v and other
Impromptu ideas in respect of v2 v and other
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere Mortals
 
Stream Processing Overview
Stream Processing OverviewStream Processing Overview
Stream Processing Overview
 
The CAP Theorem
The CAP Theorem The CAP Theorem
The CAP Theorem
 
Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.
 
Time in distributed systmes
Time in distributed systmesTime in distributed systmes
Time in distributed systmes
 
Time Series Analysis… using an Event Streaming Platform
Time Series Analysis… using an Event Streaming PlatformTime Series Analysis… using an Event Streaming Platform
Time Series Analysis… using an Event Streaming Platform
 
Time Series Analysis Using an Event Streaming Platform
 Time Series Analysis Using an Event Streaming Platform Time Series Analysis Using an Event Streaming Platform
Time Series Analysis Using an Event Streaming Platform
 
From Simulation to Online Gaming: the need for adaptive solutions
From Simulation to Online Gaming: the need for adaptive solutions From Simulation to Online Gaming: the need for adaptive solutions
From Simulation to Online Gaming: the need for adaptive solutions
 
VeriFlow Presentation
VeriFlow PresentationVeriFlow Presentation
VeriFlow Presentation
 
BIL406-Chapter-1-Introduction.ppt
BIL406-Chapter-1-Introduction.pptBIL406-Chapter-1-Introduction.ppt
BIL406-Chapter-1-Introduction.ppt
 
A Systematic Review of Congestion Control in Ad Hoc Network
A Systematic Review of Congestion Control in Ad Hoc NetworkA Systematic Review of Congestion Control in Ad Hoc Network
A Systematic Review of Congestion Control in Ad Hoc Network
 
Resource management
Resource managementResource management
Resource management
 
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
Theoretical aspects of distributed systems - playfully illustrated (@pavlobaron)
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Buy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdfBuy Epson EcoTank L3210 Colour Printer Online.pdf
Buy Epson EcoTank L3210 Colour Printer Online.pdf
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 

Time and ordering in streaming distributed systems