Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
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

lovingl...
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 lev...
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) {
...
An Example: Chat
Archival
var dataStore = new DataStore().limit(10);
dataStore.on("new_row", function(msg) {
receivedNewMe...
An Example: Chat
Fault Tolerance
var dataStore = new DataStore();
dataStore.on("new_row", function(msg) {
receivedNewMessa...
An Example: Chat
Security
var dataStore = new DataStore();

{
}

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

dataStore.on("new_row", fun...
Conceptually Simple
There’s a lot of complexity in turning a
stream of messages into usable state

Why not just directly s...
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 ...
Data Sync not Message Passing
Don’t let the primitives dictate how your application code is structured.
Build the abstract...
Upcoming SlideShare
Loading in …5
×

RealtimeConf: Message Passing vs. Data Synchronization

786 views

Published on

Video: http://vimeo.com/77352415

This talk, presented at RealtimeConf '13, is an overview of the pros and cons of using a data synchronization approach over message passing to build modern, distributed web applications.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

RealtimeConf: Message Passing vs. Data Synchronization

  1. 1. Message Passing vs. Data Synchronization An Interlude by Quentin Cheshire Proudly Representing West RTC
  2. 2. whoami?
  3. 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. 4. Why Bother? Users don’t like waiting Are obsolete The Realtime Web is Here!
  5. 5. How will you use the force? It’s just a messaging channel!
  6. 6. Have you thought this through? Persistence Fault Tolerance Consistency Scaling Security
  7. 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. 8. Data Synchronization Most apps observe and modify data That data reflects state Your API should be built around this!
  9. 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. 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. 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. 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. 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. 14. More Efficient You have the flexibility to combine operations New clients only care about the latest state 1→2→3→4→5
  15. 15. Automatic Merge Behavior Conflicts will typically require several messages to resolve With a data abstraction, it can be a core primitive
  16. 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

×