Flexible Data Synchronization with
         Microsoft Sync Framework


Artemakis Artemiou
Microsoft SQL Server MVP
MCP, MC...
About me

•   Microsoft SQL Server MVP
•   MCP, MCTS:SQL Server 2005 / SQL Server 2008 (Charter Member)
•   Cyprus .NET Us...
What Will We cover?

•   Remotely vs. Occasionally Connected Applications
•   Why Use a Framework?
•   Fundamentals of Dat...
Remotely Connected Applications

                                              •   Mobile and remote workers
    Web
    S...
Occasionally Connected Applications

                                                  •   OCA
      Web
      Server     ...
Why Use a Framework?

• Synchronization is a difficult task
   –   Data conflicts detection/resolution
   –   Interruption...
Fundamentals of Data Synchronization

• Data Synchronization
   – Synchronize changes between a client-side database and a...
Fundamentals of Data Synchronization

• Synchronization Algorithm (one-way)
   1. Session gets the current knowledge of th...
Sync Framework Overview (I)

• Terminology
   – Replica: Particular repository of data to be synchronized
   – Provider: S...
Sync Framework Overview (II)

• Supplied Providers
   – Sync Services for ADO.NET
   – Sync Services for File Systems
   –...
Sync Framework Runtime (I)

• Core Components

    Sync Service Provider                            Sync Service Provider
...
Sync Framework Runtime (II)

• Synchronization Flow
   1.   Sync Session Initiated with Destination
   2.   Destination Pr...
Synchronizing Databases

• Remote Data Access (RDA)
   – Synchronize a SQL Server Compact 3.5 database with a database on
...
Creating a Sync Ecosystem
from Scratch
• Development Environment
  –   Visual Studio 2008 SP1
  –   .NET Framework 3.5
  –...
- Demo -




Creating a Sync Ecosystem
 from Scratch (Databases)




   - Flexible Data Synchronization with Microsoft Syn...
Synchronizing Files (I)

• Sync Services for File Systems provider
   – Synchronize two file system locations (can either ...
Synchronizing Files (II)

• Enabled Scenarios
   –   Multi-master file sync between multiple PCs
   –   Synchronization be...
Synchronizing Web Feeds (I)

• Sync Framework Web synchronization components
   – Enable a replica to publish its data to ...
Synchronizing Web Feeds (II)

• Sync Framework Web synchronization components
   – Enable a replica to consume an RSS or A...
- Demo -




 Synchronizing Files




- Flexible Data Synchronization with Microsoft Sync Framework -   20
Summary

• Data Synchronization With Ease – Sync Framework
   – Occasionally Connected Systems
   – Efficient conflict han...
Resources

• Microsoft Sync Framework
   – Blog: http://blogs.msdn.com/sync/
   – MSDN Library: http://msdn2.microsoft.com...
Q&A




- Flexible Data Synchronization with Microsoft Sync Framework -   23
Upcoming SlideShare
Loading in …5
×

Flexible Data Synchronization with Microsoft Sync Framework

6,792 views

Published on

My Live Webcast Session on September 19, 2009 during the MY-TG SQL Server Community Series.

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,792
On SlideShare
0
From Embeds
0
Number of Embeds
70
Actions
Shares
0
Downloads
164
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Flexible Data Synchronization with Microsoft Sync Framework

  1. 1. Flexible Data Synchronization with Microsoft Sync Framework Artemakis Artemiou Microsoft SQL Server MVP MCP, MCTS (Charter Member) CDNUG Lead INETA-Europe Country Leader (CY) September 19, 2009
  2. 2. About me • Microsoft SQL Server MVP • MCP, MCTS:SQL Server 2005 / SQL Server 2008 (Charter Member) • Cyprus .NET User Group (CDNUG) Lead • INETA-Europe Country Leader (CY) • Analyst/Programmer/Consultant • H.S.Data Ltd • Email: a_artemiou@hotmail.com • Blog: http://aartemiou.blogspot.com
  3. 3. What Will We cover? • Remotely vs. Occasionally Connected Applications • Why Use a Framework? • Fundamentals of Data Synchronization • Sync Framework Overview • Sync Framework Runtime • Synchronizing Databases • Creating a Sync Ecosystem from Scratch • Synchronizing Files • Synchronizing Web Feeds • Summary - Flexible Data Synchronization with Microsoft Sync Framework - 3
  4. 4. Remotely Connected Applications • Mobile and remote workers Web Server – Laptops Central Data source – Office desktops – Smartphones – PDAs • Data is accessed using: INTERNET – VPN connections – Web servers – Other connectivity methods - Flexible Data Synchronization with Microsoft Sync Framework - 4
  5. 5. Occasionally Connected Applications • OCA Web Server Central – Allows remote workers to Data source continue to access their data – Data is stored locally on the user’s device • Data Synchronization capabilities INTERNET – Used by an OCA in order to populate a user’s local database Standalone Database Applications - Flexible Data Synchronization with Microsoft Sync Framework - 5
  6. 6. Why Use a Framework? • Synchronization is a difficult task – Data conflicts detection/resolution – Interruptions – Restarts – Managing deleted items – Synchronization loops – … - Flexible Data Synchronization with Microsoft Sync Framework - 6
  7. 7. Fundamentals of Data Synchronization • Data Synchronization – Synchronize changes between a client-side database and a server database • Main Advantage – Users are no longer required to have a constant network connection to access their information • Basic components – Synchronization session – Two Synchronization providers (source & destination) - Flexible Data Synchronization with Microsoft Sync Framework - 7
  8. 8. Fundamentals of Data Synchronization • Synchronization Algorithm (one-way) 1. Session gets the current knowledge of the destination replica and sends it to the source provider. 2. Source provider enumerates changes that are not contained in the destination knowledge. 3. Source provider sends changes to the session. 4. Session detects conflicts and applies changes to the destination replica through the destination provider. • Two-way Synchronization Algorithm – Achieved by two one-way synchronizations - Flexible Data Synchronization with Microsoft Sync Framework - 8
  9. 9. Sync Framework Overview (I) • Terminology – Replica: Particular repository of data to be synchronized – Provider: S/W component that represents a replica for synchronization • Enables collaboration and offline access for: – Applications, Services & Devices • Features technologies that enable: – Roaming, Sharing & Taking data offline • Ability to create custom synchronization providers - Flexible Data Synchronization with Microsoft Sync Framework - 9
  10. 10. Sync Framework Overview (II) • Supplied Providers – Sync Services for ADO.NET – Sync Services for File Systems – Sync Services for FeedSync (RSS & ATOM feeds) • Participant • The combination of a provider and its associated replica • Participant Types – Full – Partial – Simple - Flexible Data Synchronization with Microsoft Sync Framework - 10
  11. 11. Sync Framework Runtime (I) • Core Components Sync Service Provider Sync Service Provider Sync Session Microsoft Sync Microsoft Sync Framework Runtime Framework Runtime Data Data Metadata Metadata Source Source - Flexible Data Synchronization with Microsoft Sync Framework - 11
  12. 12. Sync Framework Runtime (II) • Synchronization Flow 1. Sync Session Initiated with Destination 2. Destination Prepares and Sends Knowledge 3. Destination Knowledge used to Determine Changes to be sent 4. Change Versions and Source Knowledge sent to Destination 5. Local Version Retrieved for Change Items and Compared against Source Version and Knowledge 6. Conflicts are Detected and Resolved or Deferred 7. Destination Requests Item Data from Source 8. Source Prepares and Sends Item Data 9. Items are applied at Destination - Flexible Data Synchronization with Microsoft Sync Framework - 12
  13. 13. Synchronizing Databases • Remote Data Access (RDA) – Synchronize a SQL Server Compact 3.5 database with a database on another edition of SQL Server • Merge replication – Synchronize different editions of SQL Server (including SQL Server Compact 3.5) • Sync Framework – Synchronize different editions of SQL Server (including SQL Server Compact 3.5) – Enables a developer to easily create views of data on the client that are based on a server database or another data source - Flexible Data Synchronization with Microsoft Sync Framework - 13
  14. 14. Creating a Sync Ecosystem from Scratch • Development Environment – Visual Studio 2008 SP1 – .NET Framework 3.5 – SQL Server 2008 SP1 – SQL Server Compact 3.5 – Sync Framework 2.0 CTP2 • Data Source – Relational: SQL Server 2008 Database - Flexible Data Synchronization with Microsoft Sync Framework - 14
  15. 15. - Demo - Creating a Sync Ecosystem from Scratch (Databases) - Flexible Data Synchronization with Microsoft Sync Framework - 15
  16. 16. Synchronizing Files (I) • Sync Services for File Systems provider – Synchronize two file system locations (can either be local folders or network shares) – Changes to existing files are also synchronized – Uses Sync Framework’s metadata model – Enables peer-to-peer sync of file data with support for arbitrary topologies (client/server, full-mesh, P2P) including support for removable media - Flexible Data Synchronization with Microsoft Sync Framework - 16
  17. 17. Synchronizing Files (II) • Enabled Scenarios – Multi-master file sync between multiple PCs – Synchronization between PCs using a USB Drive – Taking a network share offline – Maintaining a backup copy of files • Implementation – SyncOrchestrator object – FileSyncProvider object • SourceProvider • DestinationProvider - Flexible Data Synchronization with Microsoft Sync Framework - 17
  18. 18. Synchronizing Web Feeds (I) • Sync Framework Web synchronization components – Enable a replica to publish its data to interested subscribers as an RSS or Atom feed • A Feed producer object provides the following: – A synchronization provider that represents the replica to be produced – ID and item converter objects – A stream that contains an empty RSS or Atom feed - Flexible Data Synchronization with Microsoft Sync Framework - 18
  19. 19. Synchronizing Web Feeds (II) • Sync Framework Web synchronization components – Enable a replica to consume an RSS or Atom feed and apply feed items to its data store • A Feed consumer object provides the following: – A synchronization provider that represents the replica where converted feed items will be applied – ID and item converter objects – A stream that contains the RSS or Atom feed to be consumed - Flexible Data Synchronization with Microsoft Sync Framework - 19
  20. 20. - Demo - Synchronizing Files - Flexible Data Synchronization with Microsoft Sync Framework - 20
  21. 21. Summary • Data Synchronization With Ease – Sync Framework – Occasionally Connected Systems – Efficient conflict handling – Flexible Synchronization Algorithm • Sync Framework Supplied Providers – Sync Services for ADO.NET – Sync Services for File Systems – Sync Services for FeedSync (RSS & ATOM feeds) • The Future – Codename "Huron" - Sync Enabled Cloud Data Hub - Flexible Data Synchronization with Microsoft Sync Framework - 21
  22. 22. Resources • Microsoft Sync Framework – Blog: http://blogs.msdn.com/sync/ – MSDN Library: http://msdn2.microsoft.com/library/bb902854(sql.100).aspx – Developer Center: http://msdn.microsoft.com/en-us/sync/default.aspx • Microsoft SQL Server 2008 Programmability – http://www.microsoft.com/sqlserver/2008/en/us/programmability.aspx • Project Codename “Huron” – http://www.microsoft.com/azure/huron.mspx • Personal Blog – http://aartemiou.blogspot.com - Flexible Data Synchronization with Microsoft Sync Framework - 22
  23. 23. Q&A - Flexible Data Synchronization with Microsoft Sync Framework - 23

×