SlideShare a Scribd company logo
1 of 16
Download to read offline
Message Passing
vs.
Data Synchronization
An Interlude by Quentin Cheshire
Proudly Representing West RTC
whoami?
What’s all this fuss about?
Lo and Behold!
Introducing...

was all the rage...
...which evolved into
Long-polling

lovingly known as “Comet”

WebSockets
Data Channels
Why Bother?

Users don’t like waiting

Are obsolete

The Realtime Web is Here!
How will you use the force?
It’s just a messaging channel!
Have you thought this through?
Persistence

Fault Tolerance

Consistency

Scaling

Security
Message Passing is a Primitive

Are better tools in order?

“All problems in computer science can be solved by another level of indirection abstraction”
Data Synchronization
Most apps observe and modify data
That data reflects state
Your API should be built around this!
An Example: Chat
var channel = new MessageChannel();

var dataStore = new DataStore();

channel.subscribe(function(msg) {
receivedNewMessage(msg);
});

dataStore.on("new_row", function(msg) {
receivedNewMessage(msg);
});

function sendMsg(msg) {
channel.send(msg);
}

function sendMsg(msg) {
dataStore.addRow(msg);
}
An Example: Chat
Archival
var dataStore = new DataStore().limit(10);
dataStore.on("new_row", function(msg) {
receivedNewMessage(msg);
});
function sendMsg(msg) {
dataStore.addRow(msg);
}
An Example: Chat
Fault Tolerance
var dataStore = new DataStore();
dataStore.on("new_row", function(msg) {
receivedNewMessage(msg);
});
function sendMsg(msg) {
dataStore.addRow(msg);
}
An Example: Chat
Security
var dataStore = new DataStore();

{
}

".read": "msg.to == auth.id"

dataStore.on("new_row", function(msg) {
receivedNewMessage(msg);
});
function sendMsg(msg) {
dataStore.addRow(msg);
}
Conceptually Simple
There’s a lot of complexity in turning a
stream of messages into usable state

Why not just directly store state?
More Efficient
You have the flexibility to combine operations
New clients only care about the latest state

1→2→3→4→5
Automatic Merge Behavior
Conflicts will typically require several messages to resolve
With a data abstraction, it can be a core primitive
Data Sync not Message Passing
Don’t let the primitives dictate how your application code is structured.
Build the abstractions you need (Or use one of the available ones!)
Store state - don’t pass messages
(Except when that’s really what you want to do)

Thank you!

www
github
twitter
email

kix.in
anantn
@anantn
anant@firebase.com

More Related Content

More from Anant Narayanan

WebRTC: User Security & Privacy
WebRTC: User Security & PrivacyWebRTC: User Security & Privacy
WebRTC: User Security & PrivacyAnant Narayanan
 
Firefox Architecture Overview
Firefox Architecture OverviewFirefox Architecture Overview
Firefox Architecture OverviewAnant Narayanan
 
Next Generation Browser Add-Ons
Next Generation Browser Add-OnsNext Generation Browser Add-Ons
Next Generation Browser Add-OnsAnant Narayanan
 
An Overview of Distributed Debugging
An Overview of Distributed DebuggingAn Overview of Distributed Debugging
An Overview of Distributed DebuggingAnant Narayanan
 
A Brief Incursion into Botnet Detection
A Brief Incursion into Botnet DetectionA Brief Incursion into Botnet Detection
A Brief Incursion into Botnet DetectionAnant Narayanan
 
Mozilla Weave: Integrating Services into the Browser
Mozilla Weave: Integrating Services into the BrowserMozilla Weave: Integrating Services into the Browser
Mozilla Weave: Integrating Services into the BrowserAnant Narayanan
 
Distributed File Systems: An Overview
Distributed File Systems: An OverviewDistributed File Systems: An Overview
Distributed File Systems: An OverviewAnant Narayanan
 
Innovating with Mozilla Labs
Innovating with Mozilla LabsInnovating with Mozilla Labs
Innovating with Mozilla LabsAnant Narayanan
 
Glendix: The Why and the How
Glendix: The Why and the HowGlendix: The Why and the How
Glendix: The Why and the HowAnant Narayanan
 
Introduction to XPConnect
Introduction to XPConnectIntroduction to XPConnect
Introduction to XPConnectAnant Narayanan
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsAnant Narayanan
 
Introducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsIntroducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsAnant Narayanan
 
Extending Python with ctypes
Extending Python with ctypesExtending Python with ctypes
Extending Python with ctypesAnant Narayanan
 
Building Web Applications with MochiKit and Dojo
Building Web Applications with MochiKit and DojoBuilding Web Applications with MochiKit and Dojo
Building Web Applications with MochiKit and DojoAnant Narayanan
 

More from Anant Narayanan (18)

WebRTC: User Security & Privacy
WebRTC: User Security & PrivacyWebRTC: User Security & Privacy
WebRTC: User Security & Privacy
 
Firefox Architecture Overview
Firefox Architecture OverviewFirefox Architecture Overview
Firefox Architecture Overview
 
πP
πPπP
πP
 
Next Generation Browser Add-Ons
Next Generation Browser Add-OnsNext Generation Browser Add-Ons
Next Generation Browser Add-Ons
 
An Overview of Distributed Debugging
An Overview of Distributed DebuggingAn Overview of Distributed Debugging
An Overview of Distributed Debugging
 
A Brief Incursion into Botnet Detection
A Brief Incursion into Botnet DetectionA Brief Incursion into Botnet Detection
A Brief Incursion into Botnet Detection
 
Mozilla Weave: Integrating Services into the Browser
Mozilla Weave: Integrating Services into the BrowserMozilla Weave: Integrating Services into the Browser
Mozilla Weave: Integrating Services into the Browser
 
about:labs
about:labsabout:labs
about:labs
 
Distributed File Systems: An Overview
Distributed File Systems: An OverviewDistributed File Systems: An Overview
Distributed File Systems: An Overview
 
Innovating with Mozilla Labs
Innovating with Mozilla LabsInnovating with Mozilla Labs
Innovating with Mozilla Labs
 
Glendix: The Why and the How
Glendix: The Why and the HowGlendix: The Why and the How
Glendix: The Why and the How
 
Mozilla Prism
Mozilla PrismMozilla Prism
Mozilla Prism
 
Making Gentoo Tick
Making Gentoo TickMaking Gentoo Tick
Making Gentoo Tick
 
Introduction to XPConnect
Introduction to XPConnectIntroduction to XPConnect
Introduction to XPConnect
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell Labs
 
Introducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsIntroducing Plan9 from Bell Labs
Introducing Plan9 from Bell Labs
 
Extending Python with ctypes
Extending Python with ctypesExtending Python with ctypes
Extending Python with ctypes
 
Building Web Applications with MochiKit and Dojo
Building Web Applications with MochiKit and DojoBuilding Web Applications with MochiKit and Dojo
Building Web Applications with MochiKit and Dojo
 

Recently uploaded

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

RealtimeConf: Message Passing vs. Data Synchronization

  • 1. Message Passing vs. Data Synchronization An Interlude by Quentin Cheshire Proudly Representing West RTC
  • 3. What’s all this fuss about? Lo and Behold! Introducing... was all the rage... ...which evolved into Long-polling lovingly known as “Comet” WebSockets Data Channels
  • 4. Why Bother? Users don’t like waiting Are obsolete The Realtime Web is Here!
  • 5. How will you use the force? It’s just a messaging channel!
  • 6. Have you thought this through? Persistence Fault Tolerance Consistency Scaling Security
  • 7. Message Passing is a Primitive Are better tools in order? “All problems in computer science can be solved by another level of indirection abstraction”
  • 8. Data Synchronization Most apps observe and modify data That data reflects state Your API should be built around this!
  • 9. An Example: Chat var channel = new MessageChannel(); var dataStore = new DataStore(); channel.subscribe(function(msg) { receivedNewMessage(msg); }); dataStore.on("new_row", function(msg) { receivedNewMessage(msg); }); function sendMsg(msg) { channel.send(msg); } function sendMsg(msg) { dataStore.addRow(msg); }
  • 10. An Example: Chat Archival var dataStore = new DataStore().limit(10); dataStore.on("new_row", function(msg) { receivedNewMessage(msg); }); function sendMsg(msg) { dataStore.addRow(msg); }
  • 11. An Example: Chat Fault Tolerance var dataStore = new DataStore(); dataStore.on("new_row", function(msg) { receivedNewMessage(msg); }); function sendMsg(msg) { dataStore.addRow(msg); }
  • 12. An Example: Chat Security var dataStore = new DataStore(); { } ".read": "msg.to == auth.id" dataStore.on("new_row", function(msg) { receivedNewMessage(msg); }); function sendMsg(msg) { dataStore.addRow(msg); }
  • 13. Conceptually Simple There’s a lot of complexity in turning a stream of messages into usable state Why not just directly store state?
  • 14. More Efficient You have the flexibility to combine operations New clients only care about the latest state 1→2→3→4→5
  • 15. Automatic Merge Behavior Conflicts will typically require several messages to resolve With a data abstraction, it can be a core primitive
  • 16. Data Sync not Message Passing Don’t let the primitives dictate how your application code is structured. Build the abstractions you need (Or use one of the available ones!) Store state - don’t pass messages (Except when that’s really what you want to do) Thank you! www github twitter email kix.in anantn @anantn anant@firebase.com