Best Practices
5. Testing and Optimization

Setting Routing Hints

This article includes concepts and step-by-step instructions for modeling, configuring, and managing routing hints within your app.

Overview

When using the Big Peer 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.

Represented as an unsigned integer with 32 bits (uint32), a routing hint is a value you define at the device level that the Big Peer references to optimize connections with peers consuming the same datasets.

Example Usage Scenario

In a scenario where several restaurants operate on the same Big Peer cloud instance and devices within each restaurant share the same cloud data, assigning a single routing hint across peers within each restaurant optimizes individual peer connections with the Big Peer.

Implementing Routing Hints

To set a routing hint in your app, from the top-most scope before starting the sync process:

1

Instantiate a TransportConfig object:

Swift
Kotlin
JS
Java
C#
C++
Rust
Dart

2

Set the routingHint on the configobject:

Swift
Kotlin
JS
Java
C#
C++
Rust
Dart

3

Using the TransportConfig object, specify the configuration settings for your Ditto instance:

Swift
Kotlin
JS
Java
C#
C++
Rust
Dart