Best Practices
1. Planning and Architecture D...
Sync Handling
When implementing sync in a peer-to-peer mesh network, handling synchronization efficiently is crucial. Here are some best practices for managing sync in Ditto's mesh network:
- Optimize Transport Usage: Leverage multiple communication transports (Wi-Fi, Bluetooth LE, WebSockets) based on network conditions. Ditto’s multiplexer automatically manages transport switching.
- Query Subscription System: Sync is query-based—only sync data relevant to each peer’s query to minimize bandwidth and processing.
- Conflict Resolution: Use Ditto’s conflict-free sync, which ensures eventual consistency through deterministic resolution of concurrent edits.
- Flood-Fill Strategy: For large-scale sync, Ditto uses a flood-fill process, propagating updates across the network via multihop connections. Ensure all peers share the same subscription for optimal performance.
- Concurrency Handling: Utilize Ditto’s version vectors to manage updates from peers and resolve conflicts predictably.
- Offline-first Sync: For offline functionality, configure an offline-first sync model that maintains data consistency even when devices are intermittently connected.
For more information, see Mesh Networking.
Updated 03 Oct 2024
Did this page help you?