Core Components
This article provides a high-level overview of the main components that make up the Ditto platform, along with the standard terminology used throughout the documentation.
The following table provides an overview of standard Ditto terms and definitions to be familiar with:
Item | Term | Definition |
---|---|---|
1 | Small Peer | Your app integrated with the Ditto SDK. The Ditto SDK consists of both the local Ditto store and the functionality that enables platform capabilities. (Small Peer: Your App Integrated with Ditto) |
2 | Big Peer | A cloud deployment that appears like any other peer within the decentralized network, but with elevated access permissions and advanced capabilities. (Big Peer: A Powerful Component) |
3 | Auth Service | The OnlineWithAuthentication API that you use to request your access credentials for authentication. (Getting Your Credentials and Initializing Ditto and Going Offline) |
4 | HTTP API | The API you can use to programmatically interact with the Big Peer. (HTTP API) |
5 | Change Data Capture (CDC) | The premium upgrade to implement realtime event streaming from Ditto to your own third-party database and Apache Kafka topics. (Change Data Capture) |
However, data sync goes beyond basic updates and involves sophisticated techniques like partitioning and replication:
- Partitioning is a strategy that involves dividing the data into smaller, more manageable pieces called partitions.
- These partitions are then asynchronously copied across connected Small Peers. That is, the copies of the data, or replicas, are distributed across separate storage locations running locally within an end-user's physical environment, such as a mobile device.
Partitioning and sync are central to ensuring rapid and dependable data access for your end users.
Ditto incorporates a multiplexer inside the peer-to-peer mesh network to facilitate the data sync process.
Developed by Ditto, the multiplexer is an intelligent sync machine that seamlessly switches between active transport types as needed, without duplicating data.
In addition, the multiplexer breaks data packets down into small fragments and then, once received on the other side, reassembles them.
When the transports collaborate in parallel and the multiplexer automatically switches between them to establish the most optimal connection, these diverse transport types collectively form what is known as the rainbow connection — each color of the rainbow symbolizes a different transport type:
In Ditto's decentralized architecture, data propagates asynchronously among offline peers, eliminating the need for a centralized authority like a central server to validate and merge database operations.
This decentralized model, however, presents the possibility of concurrency conflicts. A concurrency conflict happens when multiple end users make changes to the same data items at the same time. When merging these changes, any inconsistencies collide.
To resolve these concurrency conflicts, as well as enable optimizations like delta-based replication, Ditto harnesses the power of conflict-free replicated data type (CRDT) technology. CRDT is an advanced class of data type designed to manage and replicate data changes in a way that allows multiple distributed peers to make updates concurrently without the need to reach a consensus to form a single meaningful value for merge.
For an overview of the different CRDTs that Ditto offers, see Data Structures and Types.
Ditto’s peer-to-peer network architecture utilizes the following diverse set of communication transport technologies and communication channels to achieve seamless, offline-first connections between devices:
By leveraging a diverse set of technologies, Ditto supports a variety of use cases, devices, and environments.
By default, peers use all available transports available to their devices. For instructions on how to enable and disable transports, see the Platform Manual > Transports > Configuring Transports.
The following video provides a brief visual overview of how Ditto uses Bluetooth LE to form low-powered high-distance connections between devices.
The distances and bandwidth limitations and capacities illustrated in the video are approximations and vary depending on the Bluetooth® firmware installed on the device.
For detailed information, see Platform Manual > Bluetooth Low Energy.
In addition to standard peer-to-peer Wi-Fi, Ditto incorporates a customized multiplexer to increase frequency, speed, and efficiency of data transmission between peers connected in the mesh network.
The following table provides an overview of the Wi-Fi technologies Ditto supports:
The following video illustrates Ditto’s sophisticated and decentralized approach to peer-to-peer Wi-Fi connections between distributed peers connected in the mesh network:
The maximum distance of a connection can vary depending on the specific peer-to-peer transport type being used.
For detailed information, see Platform Manual > Peer-to-Peer Wi-Fi.
For detailed information, see Platform Manual > Local Area Network.
Peers use WebSocket connections to enable realtime, bidirectional sync between Small Peers and the optional cloud deployment, the Big Peer.
Before you can establish a connection with the Big Peer using a WebSocket, you need to specify an IP/PORT. For instructions, see Platform Manual > Configuring Transports.
The defining attributes of a WebSocket include:
- Requires an internet connection to establish peer-to-peer communication.
- Unlike the other peer-to-peer transport types, does not automatically discover other peers physically nearby.
- WebSocket connections can be made over a Transmission Control Protocol (TCP) or Local Area Network (LAN).
For detailed information, see Platform Manual > WebSockets.