SlideShare une entreprise Scribd logo
1  sur  25
Steve Marx 
Developer advocate 
Dropbox
“Data synchronization is the process of 
establishing consistency among data from 
a source to a target data storage and vice 
versa and the continuous harmonization 
of the data over time.” 
– Wikipedia
Cloud storage
DEMO 
Let’s build cloud storage.
Simple cloud storage 
if request.method == 'PUT' then 
storage.data = request.body 
end 
return storage.data
Concurrency
Concurrency anti-pattern 
This algorithm doesn’t work: 
1. GET latest from the server 
2. PUT update 
What if things change between 1 and 2?
if (file.exists) { 
file.open(); 
}
Optimistic concurrency
Optimistic concurrency 
• Try update “optimistically” 
• Conditionally update if nothing changed 
• Else change is rejected 
• HTTP has Etag and If-Match headers
DEMO 
Improved cloud storage, now without data loss!
local hash = 
crypto.sha256(storage.data or '').hexdigest() 
if request.method == 'PUT' then 
if request.headers['If-Match'] == hash then 
storage.data = request.body or '' 
return 200 
else 
return 409 
end 
end
Conflict resolution
Transactions 
Algorithm for applying an operation: 
1. Read current value 
2. Apply operation to value 
3. Send to server 
4. If rejected, GOTO 1
function increment() { 
superagent.put('https://sync.webscript.io') 
.set('If-Match', etag).send(counter + 1) 
.done(function (res) { 
if (res.status !== 200) { 
counter = parseInt(res.text); 
etag = res.headers.etag; 
increment(); 
} 
}); 
}
Transaction downsides 
• Commits end up serialized 
• Transactions lost on shutdown? 
• Firebase and Dropbox Datastores 
(Python)
Working offline
Diff and merge 
• Keep track of a common ancestor 
• 3-way merge, git-like: 
– Diff server data against ancestor 
– Apply patch to client data 
– (or something equivalent)
Merging counts 
Ancestor: 3 
Server: 4 
Client: 5 
Merged: 3 + (4-3) + (5-3) = 6
DEMO 
Merge all the things.
Merging downsides 
• Requires tracking common ancestor 
• Sometimes ambiguous
Summary 
• Syncing is hard, so think about: 
– Dealing with concurrency 
– Thinking about offline 
– Resolving conflicts in a consistent way 
• Or use someone else’s platform 
(Dropbox!)
Image credits 
Thanks! 
https://www.flickr.com/photos/kalyan02/5458325252 
https://www.flickr.com/photos/gara/3560355335 
https://www.flickr.com/photos/somoslarevolucion/3609196127 
http://geekandpoke.typepad.com/geekandpoke/2012/09/simply-explained- 
concurrency.html 
https://www.flickr.com/photos/onesevenone/6361400909
@smarx 
smarx@dropbox.com

Contenu connexe

Tendances

Airflow - An Open Source Platform to Author and Monitor Data Pipelines
Airflow - An Open Source Platform to Author and Monitor Data PipelinesAirflow - An Open Source Platform to Author and Monitor Data Pipelines
Airflow - An Open Source Platform to Author and Monitor Data PipelinesDataWorks Summit
 
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19Bolke de Bruin
 
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot InstancesAmazon Web Services
 
Toronto High Scalability meetup - Scaling ELK
Toronto High Scalability meetup - Scaling ELKToronto High Scalability meetup - Scaling ELK
Toronto High Scalability meetup - Scaling ELKAndrew Trossman
 
Orchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWSOrchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWSDerrick Qin
 
Netflix running Presto in the AWS Cloud
Netflix running Presto in the AWS CloudNetflix running Presto in the AWS Cloud
Netflix running Presto in the AWS CloudZhenxiao Luo
 
Hyperloglog Lightning Talk
Hyperloglog Lightning TalkHyperloglog Lightning Talk
Hyperloglog Lightning TalkSimon Prickett
 
What's new in MongoDB 2.6 at India event by company
What's new in MongoDB 2.6 at India event by companyWhat's new in MongoDB 2.6 at India event by company
What's new in MongoDB 2.6 at India event by companyMongoDB APAC
 
Airflow tutorials hands_on
Airflow tutorials hands_onAirflow tutorials hands_on
Airflow tutorials hands_onpko89403
 
Fluentd and Docker - running fluentd within a docker container
Fluentd and Docker - running fluentd within a docker containerFluentd and Docker - running fluentd within a docker container
Fluentd and Docker - running fluentd within a docker containerTreasure Data, Inc.
 
Kibana + timelion: time series with the elastic stack
Kibana + timelion: time series with the elastic stackKibana + timelion: time series with the elastic stack
Kibana + timelion: time series with the elastic stackSylvain Wallez
 
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013Nick Galbreath
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.comRenzo Tomà
 
Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...
Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...
Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...Amazon Web Services
 
Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...
Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...
Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...Citus Data
 

Tendances (20)

Airflow - An Open Source Platform to Author and Monitor Data Pipelines
Airflow - An Open Source Platform to Author and Monitor Data PipelinesAirflow - An Open Source Platform to Author and Monitor Data Pipelines
Airflow - An Open Source Platform to Author and Monitor Data Pipelines
 
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19Apache Airflow (incubating) NL HUG Meetup 2016-07-19
Apache Airflow (incubating) NL HUG Meetup 2016-07-19
 
Airflow at WePay
Airflow at WePayAirflow at WePay
Airflow at WePay
 
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances(CMP310) Data Processing Pipelines Using Containers & Spot Instances
(CMP310) Data Processing Pipelines Using Containers & Spot Instances
 
tdtechtalk20160330johan
tdtechtalk20160330johantdtechtalk20160330johan
tdtechtalk20160330johan
 
Dapper performance
Dapper performanceDapper performance
Dapper performance
 
Toronto High Scalability meetup - Scaling ELK
Toronto High Scalability meetup - Scaling ELKToronto High Scalability meetup - Scaling ELK
Toronto High Scalability meetup - Scaling ELK
 
Orchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWSOrchestrating workflows Apache Airflow on GCP & AWS
Orchestrating workflows Apache Airflow on GCP & AWS
 
Netflix running Presto in the AWS Cloud
Netflix running Presto in the AWS CloudNetflix running Presto in the AWS Cloud
Netflix running Presto in the AWS Cloud
 
Hyperloglog Lightning Talk
Hyperloglog Lightning TalkHyperloglog Lightning Talk
Hyperloglog Lightning Talk
 
What's new in MongoDB 2.6 at India event by company
What's new in MongoDB 2.6 at India event by companyWhat's new in MongoDB 2.6 at India event by company
What's new in MongoDB 2.6 at India event by company
 
Airflow tutorials hands_on
Airflow tutorials hands_onAirflow tutorials hands_on
Airflow tutorials hands_on
 
ELK introduction
ELK introductionELK introduction
ELK introduction
 
Fluentd and Docker - running fluentd within a docker container
Fluentd and Docker - running fluentd within a docker containerFluentd and Docker - running fluentd within a docker container
Fluentd and Docker - running fluentd within a docker container
 
Kibana + timelion: time series with the elastic stack
Kibana + timelion: time series with the elastic stackKibana + timelion: time series with the elastic stack
Kibana + timelion: time series with the elastic stack
 
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.com
 
Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...
Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...
Running Fast, Interactive Queries on Petabyte Datasets using Presto - AWS Jul...
 
Apache airflow
Apache airflowApache airflow
Apache airflow
 
Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...
Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...
Scaling Multi-Tenant Applications Using Django and Postgres | PyBay 2018 | Sa...
 

En vedette

Implementing Scrum with Microsoft Team Foundation Service (TFS)
Implementing Scrum with Microsoft Team Foundation Service (TFS)Implementing Scrum with Microsoft Team Foundation Service (TFS)
Implementing Scrum with Microsoft Team Foundation Service (TFS)Aspenware
 
Code Review
Code ReviewCode Review
Code ReviewRavi Raj
 
Code Review: An apple a day
Code Review: An apple a dayCode Review: An apple a day
Code Review: An apple a dayKathryn Rotondo
 
How Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With GerritHow Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With GerritAnuar Nurmakanov
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelinesLalit Kale
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and WhenPaul Gower
 
Code Review
Code ReviewCode Review
Code Reviewrantav
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review ProcessDr. Syed Hassan Amin
 
Design in Tech Report 2015
Design in Tech Report 2015Design in Tech Report 2015
Design in Tech Report 2015John Maeda
 
How to successfully grow a code review culture
How to successfully grow a code review cultureHow to successfully grow a code review culture
How to successfully grow a code review cultureNina Zakharenko
 
Sass Code Reviews - How one code review changed my life #SassConf2015
Sass Code Reviews - How one code review changed my life #SassConf2015Sass Code Reviews - How one code review changed my life #SassConf2015
Sass Code Reviews - How one code review changed my life #SassConf2015Stacy Kvernmo
 

En vedette (13)

Implementing Scrum with Microsoft Team Foundation Service (TFS)
Implementing Scrum with Microsoft Team Foundation Service (TFS)Implementing Scrum with Microsoft Team Foundation Service (TFS)
Implementing Scrum with Microsoft Team Foundation Service (TFS)
 
Code Review
Code ReviewCode Review
Code Review
 
Code Review: An apple a day
Code Review: An apple a dayCode Review: An apple a day
Code Review: An apple a day
 
How Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With GerritHow Google Said - Ninja Code Review With Gerrit
How Google Said - Ninja Code Review With Gerrit
 
Code review guidelines
Code review guidelinesCode review guidelines
Code review guidelines
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Code Review
Code ReviewCode Review
Code Review
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Effective code reviews
Effective code reviewsEffective code reviews
Effective code reviews
 
Code review on the Web - Google
Code review on the Web - GoogleCode review on the Web - Google
Code review on the Web - Google
 
Design in Tech Report 2015
Design in Tech Report 2015Design in Tech Report 2015
Design in Tech Report 2015
 
How to successfully grow a code review culture
How to successfully grow a code review cultureHow to successfully grow a code review culture
How to successfully grow a code review culture
 
Sass Code Reviews - How one code review changed my life #SassConf2015
Sass Code Reviews - How one code review changed my life #SassConf2015Sass Code Reviews - How one code review changed my life #SassConf2015
Sass Code Reviews - How one code review changed my life #SassConf2015
 

Similaire à SYNCING IN JAVASCRIPT: MULTI-CLIENT COLLABORATION THROUGH DATA SHARING (Steve Marx)

[262] netflix 빅데이터 플랫폼
[262] netflix 빅데이터 플랫폼[262] netflix 빅데이터 플랫폼
[262] netflix 빅데이터 플랫폼NAVER D2
 
Parallel programming patterns (UA)
Parallel programming patterns (UA)Parallel programming patterns (UA)
Parallel programming patterns (UA)Oleksandr Pavlyshak
 
Parallel programming patterns - Олександр Павлишак
Parallel programming patterns - Олександр ПавлишакParallel programming patterns - Олександр Павлишак
Parallel programming patterns - Олександр ПавлишакIgor Bronovskyy
 
Scaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersScaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersSpeck&Tech
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Michael Renner
 
Transactional writes to cloud storage with Eric Liang
Transactional writes to cloud storage with Eric LiangTransactional writes to cloud storage with Eric Liang
Transactional writes to cloud storage with Eric LiangDatabricks
 
Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrencyAlex Miller
 
Advanced .NET Data Access with Dapper
Advanced .NET Data Access with Dapper Advanced .NET Data Access with Dapper
Advanced .NET Data Access with Dapper David Paquette
 
Migrate your Data Warehouse to Amazon Redshift - September Webinar Series
Migrate your Data Warehouse to Amazon Redshift - September Webinar SeriesMigrate your Data Warehouse to Amazon Redshift - September Webinar Series
Migrate your Data Warehouse to Amazon Redshift - September Webinar SeriesAmazon Web Services
 
ERRest - Designing a good REST service
ERRest - Designing a good REST serviceERRest - Designing a good REST service
ERRest - Designing a good REST serviceWO Community
 
Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019Joe Keeley
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkSadayuki Furuhashi
 
Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1Sadayuki Furuhashi
 
Karate for Complex Web-Service API Testing by Peter Thomas
Karate for Complex Web-Service API Testing by Peter ThomasKarate for Complex Web-Service API Testing by Peter Thomas
Karate for Complex Web-Service API Testing by Peter Thomasintuit_india
 
Python VS GO
Python VS GOPython VS GO
Python VS GOOfir Nir
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbMongoDB APAC
 
Advanced data access with Dapper
Advanced data access with DapperAdvanced data access with Dapper
Advanced data access with DapperDavid Paquette
 
From HDFS to S3: Migrate Pinterest Apache Spark Clusters
From HDFS to S3: Migrate Pinterest Apache Spark ClustersFrom HDFS to S3: Migrate Pinterest Apache Spark Clusters
From HDFS to S3: Migrate Pinterest Apache Spark ClustersDatabricks
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimizationxiaojueqq12345
 

Similaire à SYNCING IN JAVASCRIPT: MULTI-CLIENT COLLABORATION THROUGH DATA SHARING (Steve Marx) (20)

Shooting the Rapids
Shooting the RapidsShooting the Rapids
Shooting the Rapids
 
[262] netflix 빅데이터 플랫폼
[262] netflix 빅데이터 플랫폼[262] netflix 빅데이터 플랫폼
[262] netflix 빅데이터 플랫폼
 
Parallel programming patterns (UA)
Parallel programming patterns (UA)Parallel programming patterns (UA)
Parallel programming patterns (UA)
 
Parallel programming patterns - Олександр Павлишак
Parallel programming patterns - Олександр ПавлишакParallel programming patterns - Олександр Павлишак
Parallel programming patterns - Олександр Павлишак
 
Scaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customersScaling an invoicing SaaS from zero to over 350k customers
Scaling an invoicing SaaS from zero to over 350k customers
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Transactional writes to cloud storage with Eric Liang
Transactional writes to cloud storage with Eric LiangTransactional writes to cloud storage with Eric Liang
Transactional writes to cloud storage with Eric Liang
 
Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrency
 
Advanced .NET Data Access with Dapper
Advanced .NET Data Access with Dapper Advanced .NET Data Access with Dapper
Advanced .NET Data Access with Dapper
 
Migrate your Data Warehouse to Amazon Redshift - September Webinar Series
Migrate your Data Warehouse to Amazon Redshift - September Webinar SeriesMigrate your Data Warehouse to Amazon Redshift - September Webinar Series
Migrate your Data Warehouse to Amazon Redshift - September Webinar Series
 
ERRest - Designing a good REST service
ERRest - Designing a good REST serviceERRest - Designing a good REST service
ERRest - Designing a good REST service
 
Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019Rethinking Syncing at AltConf 2019
Rethinking Syncing at AltConf 2019
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with Embulk
 
Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1Understanding Presto - Presto meetup @ Tokyo #1
Understanding Presto - Presto meetup @ Tokyo #1
 
Karate for Complex Web-Service API Testing by Peter Thomas
Karate for Complex Web-Service API Testing by Peter ThomasKarate for Complex Web-Service API Testing by Peter Thomas
Karate for Complex Web-Service API Testing by Peter Thomas
 
Python VS GO
Python VS GOPython VS GO
Python VS GO
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
Advanced data access with Dapper
Advanced data access with DapperAdvanced data access with Dapper
Advanced data access with Dapper
 
From HDFS to S3: Migrate Pinterest Apache Spark Clusters
From HDFS to S3: Migrate Pinterest Apache Spark ClustersFrom HDFS to S3: Migrate Pinterest Apache Spark Clusters
From HDFS to S3: Migrate Pinterest Apache Spark Clusters
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimization
 

Plus de Future Insights

The Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'SheaThe Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'SheaFuture Insights
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromFuture Insights
 
Putting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-GuerraPutting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-GuerraFuture Insights
 
Surviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDMSurviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDMFuture Insights
 
Exploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny TongExploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny TongFuture Insights
 
A Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher MurphyA Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher MurphyFuture Insights
 
Horizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff JahnHorizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff JahnFuture Insights
 
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...Future Insights
 
Front End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon DeanerFront End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon DeanerFuture Insights
 
Structuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean LorenzStructuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean LorenzFuture Insights
 
Cinematic UX, Brad Weaver
Cinematic UX, Brad WeaverCinematic UX, Brad Weaver
Cinematic UX, Brad WeaverFuture Insights
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookFuture Insights
 
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisDesigning an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisFuture Insights
 
Accessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison AsuncionAccessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison AsuncionFuture Insights
 
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...Future Insights
 
Designing for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew ZusmanDesigning for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew ZusmanFuture Insights
 
Beyond Measure, Erika Hall
Beyond Measure, Erika HallBeyond Measure, Erika Hall
Beyond Measure, Erika HallFuture Insights
 
Real Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur ThorleifssonReal Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur ThorleifssonFuture Insights
 
Ok Computer. Peter Gasston
Ok Computer. Peter GasstonOk Computer. Peter Gasston
Ok Computer. Peter GasstonFuture Insights
 
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi KayaDigital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi KayaFuture Insights
 

Plus de Future Insights (20)

The Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'SheaThe Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'Shea
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon Satrom
 
Putting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-GuerraPutting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-Guerra
 
Surviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDMSurviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDM
 
Exploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny TongExploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny Tong
 
A Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher MurphyA Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher Murphy
 
Horizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff JahnHorizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff Jahn
 
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
 
Front End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon DeanerFront End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon Deaner
 
Structuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean LorenzStructuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean Lorenz
 
Cinematic UX, Brad Weaver
Cinematic UX, Brad WeaverCinematic UX, Brad Weaver
Cinematic UX, Brad Weaver
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan Snook
 
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisDesigning an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
 
Accessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison AsuncionAccessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison Asuncion
 
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
 
Designing for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew ZusmanDesigning for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew Zusman
 
Beyond Measure, Erika Hall
Beyond Measure, Erika HallBeyond Measure, Erika Hall
Beyond Measure, Erika Hall
 
Real Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur ThorleifssonReal Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur Thorleifsson
 
Ok Computer. Peter Gasston
Ok Computer. Peter GasstonOk Computer. Peter Gasston
Ok Computer. Peter Gasston
 
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi KayaDigital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
 

Dernier

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Dernier (20)

"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

SYNCING IN JAVASCRIPT: MULTI-CLIENT COLLABORATION THROUGH DATA SHARING (Steve Marx)

  • 1. Steve Marx Developer advocate Dropbox
  • 2.
  • 3. “Data synchronization is the process of establishing consistency among data from a source to a target data storage and vice versa and the continuous harmonization of the data over time.” – Wikipedia
  • 5. DEMO Let’s build cloud storage.
  • 6. Simple cloud storage if request.method == 'PUT' then storage.data = request.body end return storage.data
  • 8. Concurrency anti-pattern This algorithm doesn’t work: 1. GET latest from the server 2. PUT update What if things change between 1 and 2?
  • 9. if (file.exists) { file.open(); }
  • 11. Optimistic concurrency • Try update “optimistically” • Conditionally update if nothing changed • Else change is rejected • HTTP has Etag and If-Match headers
  • 12. DEMO Improved cloud storage, now without data loss!
  • 13. local hash = crypto.sha256(storage.data or '').hexdigest() if request.method == 'PUT' then if request.headers['If-Match'] == hash then storage.data = request.body or '' return 200 else return 409 end end
  • 15. Transactions Algorithm for applying an operation: 1. Read current value 2. Apply operation to value 3. Send to server 4. If rejected, GOTO 1
  • 16. function increment() { superagent.put('https://sync.webscript.io') .set('If-Match', etag).send(counter + 1) .done(function (res) { if (res.status !== 200) { counter = parseInt(res.text); etag = res.headers.etag; increment(); } }); }
  • 17. Transaction downsides • Commits end up serialized • Transactions lost on shutdown? • Firebase and Dropbox Datastores (Python)
  • 19. Diff and merge • Keep track of a common ancestor • 3-way merge, git-like: – Diff server data against ancestor – Apply patch to client data – (or something equivalent)
  • 20. Merging counts Ancestor: 3 Server: 4 Client: 5 Merged: 3 + (4-3) + (5-3) = 6
  • 21. DEMO Merge all the things.
  • 22. Merging downsides • Requires tracking common ancestor • Sometimes ambiguous
  • 23. Summary • Syncing is hard, so think about: – Dealing with concurrency – Thinking about offline – Resolving conflicts in a consistent way • Or use someone else’s platform (Dropbox!)
  • 24. Image credits Thanks! https://www.flickr.com/photos/kalyan02/5458325252 https://www.flickr.com/photos/gara/3560355335 https://www.flickr.com/photos/somoslarevolucion/3609196127 http://geekandpoke.typepad.com/geekandpoke/2012/09/simply-explained- concurrency.html https://www.flickr.com/photos/onesevenone/6361400909