introduction to the microsoft sync framework
play

Introduction to the Microsoft Sync Framework Michael Clark - PowerPoint PPT Presentation

Introduction to the Microsoft Sync Framework Michael Clark Development Manager Microsoft Agenda Why Is Sync both Interesting and Hard Sync Framework Overview Using the Sync Framework Future Directions Summary m Microsoft


  1. Introduction to the Microsoft Sync Framework Michael Clark Development Manager Microsoft

  2. Agenda • Why Is Sync both Interesting and Hard • Sync Framework Overview • Using the Sync Framework • Future Directions • Summary m Microsoft Sync Framework

  3. Why Is Sync Important • Computing Device Proliferation – More Common Daily Access To … • Multiple PCs • Devices • Services • Software + Services – Improve User Experience – Improve Network Utilization – Better Availability/Offline Usage m Microsoft Sync Framework

  4. Why Is Sync Hard • Local Change Detection • Change Enumeration – Avoiding Reflecting Changes • Conflict Detection/Resolution • Efficiently Handling Interruption & Restart • Managing Deleted Items – Correct Cleanup of Tombstones • Synchronization Loops • … m Microsoft Sync Framework

  5. Agenda • Why Is Sync both Interesting and Hard • Sync Framework Overview • Using the Sync Framework • Future Directions • Summary m Microsoft Sync Framework

  6. What Is The Sync Framework? • Metadata – Handles Common Cases Efficiently – Correctly Handles Corner Cases – Useable in Any Topology – Can be Used to Bridge Multiple Solutions • Platform – Supports Low Level Use Of the Metadata – Provider Model to Abstract Interaction Between Stores – Provides ‘Make it Simple’ Services – Factored to Enable Expansion • Infrastructure – Common Stores – Common Protocols – Server & Services Integration m Microsoft Sync Framework

  7. How to Use The Sync Framework • Write Sync Applications to synchronize stores – Using other people’s or your own providers • Write Providers for your stores and apps – Using the Framework’s Sync Runtime – Choose your balance of performance vs. complexity m Microsoft Sync Framework

  8. Example Synchronization Session Sync Application Configuration Sync Orchestrator changes changes Sync Sync Meta-data Provider Services Provider Interpretation Provider Tools Sync Runtime Data Data MD Store Store Store changes changes m Microsoft Sync Framework

  9. Example Remote Sync Session Sync Application Sync Orchestrator Sync Provider Provider Provider Proxy Stub Local Remote Store Store m Microsoft Sync Framework

  10. Data Model Concepts • The framework does not mandate a data model Scope: User Mailbox – Just a few concepts that can be mapped to most models Consistency: • Sync Scope : the set of objects being synchronized across a Message set of partners Body Attach- Flags • Change unit : granularity of change tracking in a store ments – Granularity of change propagation: only changed units need Header be sent … – Granularity of conflict detection: independent changes to the same change unit are a conflict Consistency: Message • Consistency unit : granularity of consistency – All changes within the same consistency unit are sent together Consistency: – Thus, sync can never be interrupted with part of a consistency unit applied Message … m Microsoft Sync Framework

  11. Basic Metadata Concepts User Knowledge • Peers make changes independently Mailbox • Synchronization: making peers aware of all changes Consistency: Message • Each change has a globally-unique version Body version Att 1 • Fundamental concept: Knowledge version – A “concise” description of the set of changes that a peer is Flags aware of version Att 2 – Knowledge is portable Header version • knowledge specification can be understood by any peer • not pair- specific: not “what I have received from you” version … – Main operations on knowledge • Test if a given knowledge covers a given change Consistency: • Add one piece of knowledge to another to produce Message combined knowledge Consistency: Message • Each replica maintains its own “knowledge” … m Microsoft Sync Framework

  12. Incremental Sync using Knowledge 1. RequestChanges A B 3. ConveyChanges 2. Enumerate Changes 4. Apply Changes • RequestChanges: supply your knowledge • Enumerate Changes. Is my version covered by your knowledge ? If not, send. • ConveyChanges: send along – Version of the change – Enumerator’s knowledge • what the peer making the change knew when he made it • what the recipient will learn by applying this change • Apply Changes: Conflict detection algorithm – Is your version covered by my knowledge ? If not, you have a conflict m Microsoft Sync Framework

  13. Basic Metadata Details • Version – The ID of the replica making the change + replica-specific number • Replica IDs are GUIDs • Replica-specific number is ever-increasing at the replica • Clock vector: X4 Y3 Z7 – A set of (replica GUID, replica-specific number) pairs – Semantics: “all versions authored by this replica up to this number” – The simplest example of knowledge • Gets more complex as failures, interruptions and such occur • But quiesces to the simple form m Microsoft Sync Framework

  14. Platform • Sync Orchestration Between Providers – Simple Interaction for Applications • Implementation of Core Metadata Services – Knowledge management interfaces • Learning new things: K new = K old + K learned – Version-to-knowledge comparisons: v ≤ K • Change enumeration assistance • Conflict detection – Tombstone management, filtering, fidelity management, much more • Core services are platform, storage, and data-type-independent – Applicable regardless of protocol being used – Unmanaged implementation for device portability – Convenient managed wrappers • ‘Make it Simple’ Services – Support for Change Application – Metadata Storage m Microsoft Sync Framework

  15. Some Infrastructure We Provide • File Sync Provider – Useable on FAT as well as NTFS Filesystems • Relational Sync Provider – Supporting any ADO.Net Enabled Database • Feedsync – Produce or Consume Feeds in RSS or ATOM • SyncToy – Useful UI for Configuring Filesync Partnerships • Other m Microsoft Sync Framework

  16. Agenda • Why Is Sync both Interesting and Hard • Sync Framework Overview • Using the Sync Framework • Future Directions • Summary m Microsoft Sync Framework

  17. Application Code Sample Using the built-in file sync provider Public Class MySyncController Public Sub SynchronizeFolders() Dim SyncOrchestrator As New SyncOrchestrator Dim LocalProvider As New FileSyncProvider(mySourceReplicaId, _ "c:\folder1") Dim RemoteProvider As New FileSyncProvider(myDestinationReplicaId, _ "d:\folder2") With SyncOrchestrator .LocalProvider = LocalProvider .RemoteProvider = RemoteProvider .Synchronize() End With End Sub End Class m Microsoft Sync Framework

  18. Recall: The Sync Session Sync Application Sync Orchestrator changes changes Sync Sync Meta-data Provider Services Provider Interpretation Provider Tools Sync Runtime Data Data MD Store Store Store changes changes m Microsoft Sync Framework

  19. Provider Interactions GetSyncBatchParameters Orchestrator Metadata Provider read Knowledge Code A15,B37,C8 Sync Versions Runtime I: A12 J: A9 L: B25 M: C8 Data m Microsoft Sync Framework

  20. Provider Interactions Orchestrator GetChangeBatch(Kd) Metadata minLocalTick(Kd)? Provider Knowledge Code isContained in Kd? A15,B37,C8 Sync Versions Runtime read AddToBatch I: A12 ChangeBatch J: A9 L: B25 read M: C8 Data m Microsoft Sync Framework

  21. Provider Interactions Orchestrator ProcessChangeBatch(changes, Ks) ApplyChanges Metadata GetVersion Provider read Knowledge Code write A15,B37,C8 SaveItem Sync Versions SaveKnowledge Runtime read I: A12 J: A9 write L: B25 M: C8 write Data m Microsoft Sync Framework

  22. Metadata store • Internal Databsae storage for provider’s Provider metadata Code Sync – Knowledge, versions, tombstones, etc Runtime • Extremely useful for those who can’t store metadata in their store – E.g. FAT On change Metadata Data Store • Makes it easy to write “maintaining providers”: – Whenever you detect a change, tell metadata store • It will update the metadata (new version, tombstone) • Can happen in notifications , or during sync – Change enumeration is taken care of • You just read the data from the store – Change application is largely taken care of • You just write the data to the store and forward the calls m Microsoft Sync Framework

  23. Change Enumeration Code snippet public override ChangeBatch GetChangeBatch( uint batchSize, SyncKnowledge destinationKnowledge, out object changeDataRetriever) { ChangeBatch batch = _metadata.GetChangeBatch(batchSize, destinationKnowledge); changeDataRetriever = this; // this is where the transfer // mechanism/protocol would go. // For an in memory provider, // this is sufficient return batch; } m Microsoft Sync Framework

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend