Optimizing Server Performance
This article includes some considerations to improve server sync performance.
Overview
In environments with a high density of devices and data traffic, additional optimizations may be necessary:
- Limit Active Connections: Dozens of devices in a single mesh can lead to congestion in some cases. Strategically limit the number of active connections to balance the load effectively.
- Avoid Verbose Logging: Verbose logging, especially with large datasets, can significantly slow down the synchronization process. Ensure that logging is kept to a necessary minimum during high-load times to prevent this.
- Use Routing Hints: When using the Ditto Server optional cloud deployment and managing large document collections, you can group peers with similar data access patterns by assigning specific labels, known as routing hints.
- Flood-Fill Strategy: For large-scale sync, ensure all peers in the same local mesh share the same subscription for optimal performance.
For additional information, see Troubleshooting and Transports
Routing Hints
Represented as an unsigned integer with 32 bits (uint32
), a routing hint is a
value you define at the device level that Ditto Server references to optimize
connections with peers consuming the same datasets.
For example, several restaurants operate on the same Ditto Server instance and devices within each restaurant share the same data. Each restaurant is identified by 32-bit integer, which is used as the routing hint to the server to ensure data is co-located.
Code Samples
To set a routing hint in your app’s transport config, from the top-most scope before calling startSync
.
Was this page helpful?